Merged 5.2.N (5.2.1) to trunk (5.2)

124168 adavis: Merged 5.1.N (5.1.2) to 5.2.N (5.2.1)
      124150 adavis: Merged 5.1.1 (5.1.1) to 5.1.N (5.1.2)
         124081: Reverting incorrect merges from mass WOLF-6 merge,
         124078: Merged WOLF-6 (WOLF.0.0) to 5.1.1 (5.1.1)
            123532 mrogers: Now that the end to end test passes, use a junit assert to break the build if it fails.,
         124077: Merged WOLF-6 (WOLF.0.0) to 5.1.1 (5.1.1)
            123527 mrogers: Correct path for share-config-custom.xml,
         124076: Merged WOLF-6 (WOLF.0.0) to 5.1.1 (5.1.1)
            123525 mrogers: Add the solr4 archive schema.xml to the update package.,
         124075: Merged WOLF-6 (WOLF.0.0) to 5.1.1 (5.1.1)
            123519 mrogers: Ignore share-config-custom.xml,
         124074: Merged WOLF-6 (WOLF.0.0) to 5.1.1 (5.1.1)
            123498 mrogers: Another README that needs converting to dos,
         124073: Merged WOLF-6 (WOLF.0.0) to 5.1.1 (5.1.1)
            123497 mrogers: convert the readme to windows line format.,
         124072: Merged WOLF-6 (WOLF.0.0) to 5.1.1 (5.1.1)
            123496 mrogers: alfresco-share-services.amp needs to be called exactly that not with a 5.1.1-SNAPSHOT,
         124071: Merged WOLF-6 (WOLF.0.0) to 5.1.1 (5.1.1)
            123492 mrogers: Package the correct README for the all in one installer.,
         124070: Merged WOLF-6 (WOLF.0.0) to 5.1.1 (5.1.1) (RECORD ONLY) : 
            - 123337,123472,
         124069: Merged WOLF-6 (WOLF.0.0) to 5.1.1 (5.1.1)
            123314 mrogers: File tree comparison needs to ignore comment lines.,
         124068: Merged WOLF-6 (WOLF.0.0) to 5.1.1 (5.1.1) (RECORD ONLY) : 
            - 123310,
         124067: Merged WOLF-6 (WOLF.0.0) to 5.1.1 (5.1.1) (RECORD ONLY) : 
            - 123308,
         124066: Merged WOLF-6 (WOLF.0.0) to 5.1.1 (5.1.1) (RECORD ONLY) : 
            - 123307,
         124065: Merged WOLF-6 (WOLF.0.0) to 5.1.1 (5.1.1)
            123305 mrogers: Change update assistant to use renamed alfresco-one-platform-distributionzip,
         124064: Merged WOLF-6 (WOLF.0.0) to 5.1.1 (5.1.1) (RECORD ONLY) : 
            - 123304,
         124062: Merged WOLF-6 (WOLF.0.0) to 5.1.1 (5.1.1) (RECORD ONLY) : 
            - 123289,
         124061: Merged WOLF-6 (WOLF.0.0) to 5.1.1 (5.1.1) (RECORD ONLY) : 
            - 123288,
         124060: Merged WOLF-6 (WOLF.0.0) to 5.1.1 (5.1.1) (RECORD ONLY) : 
            - 123286,
         124059: Merged WOLF-6 (WOLF.0.0) to 5.1.1 (5.1.1) (RECORD ONLY) : 
            - 123285,
         124058: Merged WOLF-6 (WOLF.0.0) to 5.1.1 (5.1.1) (RECORD ONLY) : 
            - 123284,
         124050: Merged WOLF-6 (WOLF.0.0) to 5.1.1 (5.1.1)
            123278 mrogers: Merged trunk (2015.0) to WOLF-6 (WOLF.0.0)
               118074 jphuynh: ACE-4600: Upgraded to InstallBuilder 15.10.1 (Custom),
         124049: Merged WOLF-6 (WOLF.0.0) to 5.1.1 (5.1.1)
            123277 mrogers: Merged trunk (2015.0) to WOLF-6 (WOLF.0.0)
               117929 jphuynh: ACE-4675: Upgraded common package to fix CVE-2015-8126,
         124048: Merged WOLF-6 (WOLF.0.0) to 5.1.1 (5.1.1)
            123276 mrogers: Merged trunk (2015.0) to WOLF-6 (WOLF.0.0)
               117634 jphuynh: Merged BDE-443 (5.1.0) to trunk (2015.0)
                  114665 jphuynh: Updated:
                  - installer.common.version=5.1-20151016 
                  - installer.postgresql.version=9.4.4-20151016 
                  - installer.libreoffice.version=4.4.5-20151016,
         124047: Merged WOLF-6 (WOLF.0.0) to 5.1.1 (5.1.1)
            123267 mrogers: Merged trunk (2015.0) to WOLF-6 (WOLF.0.0)
               115174 jphuynh: ACE-4494: Updated Java to 1.8.0_65 to fix the following vulnerabilities:
               - CVE-2015-4868
               - CVE-2015-4803
               - CVE-2015-4893
               - CVE-2015-4911
               - CVE-2015-4872,
         124045: Merged WOLF-6 (WOLF.0.0) to 5.1.1 (5.1.1)
            123270 mrogers: Merged trunk (2015.0) to WOLF-6 (WOLF.0.0)
               116128 jphuynh: ACE-4561: Release Agility: Updates to the installer
               - Distribution zip name remains the same as before.,
         124044: Merged WOLF-6 (WOLF.0.0) to 5.1.1 (5.1.1)
            123269 mrogers: Merged trunk (2015.0) to WOLF-6 (WOLF.0.0)
               116121 jphuynh: ACE-4561: Release Agility: Updates to the installer
               - Alfresco One Enterprise,
         124043: Merged WOLF-6 (WOLF.0.0) to 5.1.1 (5.1.1)
            123268 mrogers: Merged trunk (2015.0) to WOLF-6 (WOLF.0.0)
               115782 jphuynh: ACE-4547: Clean up and updated consistency of the README files.,
         124042: Merged WOLF-6 (WOLF.0.0) to 5.1.1 (5.1.1)
            123265 mrogers: Merged trunk (2015.0) to WOLF-6 (WOLF.0.0)
               115168 jphuynh: ACE-4508: Reinstated the forgotten alfresco-spp.amp,
         124041: Merged WOLF-6 (WOLF.0.0) to 5.1.1 (5.1.1)
            123264 mrogers: Merged trunk (2015.0) to WOLF-6 (WOLF.0.0)
               113813 jphuynh: ACE-4276: Upgraded Installbuilder to 15.9.0,
         124040: Merged WOLF-6 (WOLF.0.0) to 5.1.1 (5.1.1)
            123263 mrogers: Merged trunk (2015.0) to WOLF-6 (WOLF.0.0)
               113466 jphuynh: ACE-4335: Added missing enterprise classifier for GoogleDocs integration artifacts.,
         124039: Merged WOLF-6 (WOLF.0.0) to 5.1.1 (5.1.1)
            123262 mrogers: Merged trunk (2015.0) to WOLF-6 (WOLF.0.0)
               113363 jphuynh: ACE-4312: Fixed missing web-extension folder in the EAR Distribution
               + Removed unnecessary modules/platform folder.,
         124038: Merged WOLF-6 (WOLF.0.0) to 5.1.1 (5.1.1)
            123261 mrogers: Merged trunk (2015.0) to WOLF-6 (WOLF.0.0)
               113329 jphuynh: ACE-4314: Added a release profile to enforce the installer naming convention,
         124037: Merged WOLF-6 (WOLF.0.0) to 5.1.1 (5.1.1)
            123256 mrogers: rollback 123243,
         124036: Merged WOLF-6 (WOLF.0.0) to 5.1.1 (5.1.1)
            123243 mrogers: Merged trunk (2015.0) to WOLF-6 (WOLF.0.0)
               122874 slanglois: ACE-5135 ACE-5131 Pre-apply share-services AMP in alfresco.war packaged in EAR,
         124035: Merged WOLF-6 (WOLF.0.0) to 5.1.1 (5.1.1)
            123239 mrogers: Build against Platform 5.1.1-SNAPSHOT since that contains our MMT fixes.,
         124034: Merged WOLF-6 (WOLF.0.0) to 5.1.1 (5.1.1)
            123233 mrogers: Run the test against alfresco-one-update-package not alfresco-enterprise-update-package,
         124033: Merged WOLF-6 (WOLF.0.0) to 5.1.1 (5.1.1)
            123231 mrogers: Rename the alfresco-enterprise-update-package to the alfresco-one-update-package,
         124032: Merged WOLF-6 (WOLF.0.0) to 5.1.1 (5.1.1)
            123230 mrogers: Rollback previous changes.,
         124031: Merged WOLF-6 (WOLF.0.0) to 5.1.1 (5.1.1)
            123184 mrogers: More work on pom files,
         124030: Merged WOLF-6 (WOLF.0.0) to 5.1.1 (5.1.1)
            123183 mrogers: Update pom files to a) reflect the fact that the "enterprise" artifact name has been changed to "one", b) update to what is on 5.1,
         124029: Merged WOLF-6 (WOLF.0.0) to 5.1.1 (5.1.1) (RECORD ONLY) : 
            - 123159,
         124028: Merged WOLF-6 (WOLF.0.0) to 5.1.1 (5.1.1)
            123121 mrogers: when comparing the two trees, ignore the sol1 war file in alf_data,
         124027: Merged WOLF-6 (WOLF.0.0) to 5.1.1 (5.1.1) (RECORD ONLY) : 
            - 123096,
         124026: Merged WOLF-6 (WOLF.0.0) to 5.1.1 (5.1.1)
            123084 mrogers: Add more ignorePaths,
         124025: Merged WOLF-6 (WOLF.0.0) to 5.1.1 (5.1.1)
            123080 mrogers: Fix for file names within ZipFormatter ... had // in the path.,
         124024: Merged WOLF-6 (WOLF.0.0) to 5.1.1 (5.1.1)
            123059 mrogers: UTF-378 - Try toRealPath on file comparison utility.,
         124023: Merged WOLF-6 (WOLF.0.0) to 5.1.1 (5.1.1) (RECORD ONLY) : 
            - 123042,
         124022: Merged WOLF-6 (WOLF.0.0) to 5.1.1 (5.1.1)
            123029 mrogers: UTF-378 - A few additions to the ignore patterns + change for zip format to use absolute paths.,
         124021: Merged WOLF-6 (WOLF.0.0) to 5.1.1 (5.1.1)
            123015 mrogers: UTF-378 - Now produce the zip file of the update test differences.,
         124020: Merged WOLF-6 (WOLF.0.0) to 5.1.1 (5.1.1)
            122949 mrogers: UTF-378 - Added some code to ignore module.install date within module.properties,
         124019: Merged WOLF-6 (WOLF.0.0) to 5.1.1 (5.1.1)
            122922 mward: UTF-378: added some diff ignore patterns.,
         124018: Merged WOLF-6 (WOLF.0.0) to 5.1.1 (5.1.1)
            122881 mrogers: Update googledocs to 3.0.3 to keep in line with release,
         124017: Merged WOLF-6 (WOLF.0.0) to 5.1.1 (5.1.1) (RECORD ONLY) : 
            - 122880,
         124016: Merged WOLF-6 (WOLF.0.0) to 5.1.1 (5.1.1)
            122860 mward: UTF-378: improved test to ensure multiple occurrences of replacement text are all replaced.,
         124015: Merged WOLF-6 (WOLF.0.0) to 5.1.1 (5.1.1)
            122856 mward: UTF-384: swapped the 'fresh' and 'updated' in the comparison method call so that the report appears with them in the correct columns.,
         124014: Merged WOLF-6 (WOLF.0.0) to 5.1.1 (5.1.1)
            122846 mrogers: BDE-539 - Remove kludge.,
         124013: Merged WOLF-6 (WOLF.0.0) to 5.1.1 (5.1.1)
            122824 jphuynh: BDE-539: Use latest 5.1-SNAPSHOT build as base version for now. (Latest as in previous successful build excluding the current one.),
         124012: Merged WOLF-6 (WOLF.0.0) to 5.1.1 (5.1.1)
            122800 mrogers: kludge tests to get something to run.,
         124011: Merged WOLF-6 (WOLF.0.0) to 5.1.1 (5.1.1)
            122797 mrogers: Corrected test to run on windows.,
         124010: Merged WOLF-6 (WOLF.0.0) to 5.1.1 (5.1.1)
            122785 mward: UTF-378: fixed path pattern matching on Windows.,
         124009: Merged WOLF-6 (WOLF.0.0) to 5.1.1 (5.1.1)
            122774 jphuynh: BDE-539: alfrescosharepoint is not a selectable component.,
         124008: Merged WOLF-6 (WOLF.0.0) to 5.1.1 (5.1.1)
            122767 jphuynh: BDE-539: this.installer.args!,
         124007: Merged WOLF-6 (WOLF.0.0) to 5.1.1 (5.1.1)
            122766 jphuynh: BDE-539: AOS Module Only exist on 5.1. Added changes in installer.args to reflect that.,
         124006: Merged WOLF-6 (WOLF.0.0) to 5.1.1 (5.1.1)
            122764 mward: UTF-378: added missing test data,
         124005: Merged WOLF-6 (WOLF.0.0) to 5.1.1 (5.1.1)
            122763 mward: UTF-378: improve result set formatting.,
         124004: Merged WOLF-6 (WOLF.0.0) to 5.1.1 (5.1.1)
            122756 jphuynh: BDE-539: Fixed typo.,
         124003: Merged WOLF-6 (WOLF.0.0) to 5.1.1 (5.1.1)
            122755 mward: UTF-378: Fix unit tests,
         124002: Merged WOLF-6 (WOLF.0.0) to 5.1.1 (5.1.1)
            122753 jphuynh: BDE-539: Changed wget to ant get.,
         124001: Merged WOLF-6 (WOLF.0.0) to 5.1.1 (5.1.1)
            122752 mward: UTF-378: Delete temp files when no longer needed,
         124000: Merged WOLF-6 (WOLF.0.0) to 5.1.1 (5.1.1)
            122751 mward: UTF-384: wired in comparison tool and HTML formatter to the build.,
         123999: Merged WOLF-6 (WOLF.0.0) to 5.1.1 (5.1.1)
            122745 mward: UTF-383: added support for deep differencing in amp files.,
         123998: Merged WOLF-6 (WOLF.0.0) to 5.1.1 (5.1.1)
            122731 mward: UTF-383: added support for ignoring differences in files where it is just the absolute tree root.,
         123997: Merged WOLF-6 (WOLF.0.0) to 5.1.1 (5.1.1)
            122730 jphuynh: BDE-539: Fixed path and added base version extension check.,
         123995: Merged WOLF-6 (WOLF.0.0) to 5.1.1 (5.1.1)
            122721 jphuynh: BDE-539: Amended the installer download part.,
         123994: Merged WOLF-6 (WOLF.0.0) to 5.1.1 (5.1.1)
            122698 mward: UTF-378: bring back all the default java behaviour by removing the pom packaging specification.,
         123993: Merged WOLF-6 (WOLF.0.0) to 5.1.1 (5.1.1)
            122694 mward: UTF-378: moved the big end-to-end to happen during integration testing.,
         123992: Merged WOLF-6 (WOLF.0.0) to 5.1.1 (5.1.1)
            122681 mward: Added some sensible svn ignore patterns.,
         123991: Merged WOLF-6 (WOLF.0.0) to 5.1.1 (5.1.1)
            122680 mward: UTF-383: moved diff tool from update-tool to full-installer code base.
            Had erroneously added the code to the wrong project.,
         123990: Merged WOLF-6 (WOLF.0.0) to 5.1.1 (5.1.1)
            122672 mward: Changed language level to 1.7 so that IDEs may pick up the correct configuration.,
         123989: Merged WOLF-6 (WOLF.0.0) to 5.1.1 (5.1.1) (RECORD ONLY) : 
            - 122662,
         123988: Merged WOLF-6 (WOLF.0.0) to 5.1.1 (5.1.1)
            122643 mrogers: UTF-371 - Add AOS to the update package.,
         123987: Merged WOLF-6 (WOLF.0.0) to 5.1.1 (5.1.1) (RECORD ONLY) : 
            - 122613,122620,
         123986: Merged WOLF-6 (WOLF.0.0) to 5.1.1 (5.1.1)
            122231 mrogers: UTF-382 - Added the skeleton of the End to End update test.,
         123985: Merged WOLF-6 (WOLF.0.0) to 5.1.1 (5.1.1)
            122191 mrogers: Try again,
         123984: Merged WOLF-6 (WOLF.0.0) to 5.1.1 (5.1.1)
            122189 mrogers: For now we have a hard coded url and its just changed.,
         123983: Merged WOLF-6 (WOLF.0.0) to 5.1.1 (5.1.1)
            122186 mrogers: UTF-380 Now should update both source and target instances of alfresco.   (They are both the same but that should allow us to progress with building the rest of build.),
         123982: Merged WOLF-6 (WOLF.0.0) to 5.1.1 (5.1.1)
            122179 mrogers: UTF-380 Try again.,
         123981: Merged WOLF-6 (WOLF.0.0) to 5.1.1 (5.1.1)
            122172 mrogers: UTF-380 Temp build fix,
         123980: Merged WOLF-6 (WOLF.0.0) to 5.1.1 (5.1.1)
            122162 mrogers: UTF-380 - Add install steps,
         123979: Merged WOLF-6 (WOLF.0.0) to 5.1.1 (5.1.1)
            122157 mrogers: UTF-380 - Work in progress.,
         123977: Merged WOLF-6 (WOLF.0.0) to 5.1.1 (5.1.1)
            122137 mrogers: Fix merge error.,
         123976: Merged WOLF-6 (WOLF.0.0) to 5.1.1 (5.1.1) (RECORD ONLY) : 
            - 122095,122124,
         123975: Merged WOLF-6 (WOLF.0.0) to 5.1.1 (5.1.1)
            122086 mrogers: UTF-379 - add new test project.,
         123974: Merged WOLF-6 (WOLF.0.0) to 5.1.1 (5.1.1) (RECORD ONLY) : 
            - 121992,122038,
         123973: Merged WOLF-6 (WOLF.0.0) to 5.1.1 (5.1.1)
            121858 nsmintanca: Merged 5.0.N (5.0.4) to WOLF-6 (WOLF.0.0)
               121838 mward: UTF-370: fixed and added back apply_updates.sh executable bit tests.,
         123972: Merged WOLF-6 (WOLF.0.0) to 5.1.1 (5.1.1) (RECORD ONLY) : 
            - 121857,
         123971: Merged WOLF-6 (WOLF.0.0) to 5.1.1 (5.1.1)
            121760 nsmintanca: Merged 5.0.N (5.0.4) to WOLF-6 (WOLF.0.0)
               121725 mrogers: UTF-370 - Disable permissions unit test.,
         123970: Merged WOLF-6 (WOLF.0.0) to 5.1.1 (5.1.1) (RECORD ONLY) : 
            - 121759,
         123969: Merged WOLF-6 (WOLF.0.0) to 5.1.1 (5.1.1)
            121758 nsmintanca: Merged 5.0.N (5.0.4) to WOLF-6 (WOLF.0.0)
               121690 mrogers: UTF-370 - Replace TgZFormatIntegrationTest with ZipFormatIntegrationTest,
         123968: Merged WOLF-6 (WOLF.0.0) to 5.1.1 (5.1.1) (RECORD ONLY) : 
            - 121683,
         123967: Merged WOLF-6 (WOLF.0.0) to 5.1.1 (5.1.1)
            121669 mrogers: Merged 5.0.N (5.0.4) to WOLF-6 (WOLF.0.0)
               121667 mrogers: UTF-370 - Get rid of the .tgz archive,
         123966: Merged WOLF-6 (WOLF.0.0) to 5.1.1 (5.1.1)
            121668 mrogers: Merged 5.0.N (5.0.4) to WOLF-6 (WOLF.0.0)
               121665 mrogers: Remove un-used update assembly,
         123965: Merged WOLF-6 (WOLF.0.0) to 5.1.1 (5.1.1) (RECORD ONLY) : 
            - 121638,
         123964: Merged WOLF-6 (WOLF.0.0) to 5.1.1 (5.1.1)
            121560 mrogers: Merged 5.0.N (5.0.4) to WOLF-6 (WOLF.0.0)
               121460 mrogers: UTF-375 - added awe.war and also simplified update build to use the wqs distribution package,
         123963: Merged WOLF-6 (WOLF.0.0) to 5.1.1 (5.1.1) (RECORD ONLY) : 
            - 121490,
         123962: Merged WOLF-6 (WOLF.0.0) to 5.1.1 (5.1.1)
            121487 abalmus: Merged 5.0.N (5.0.4) to WOLF-6 (WOLF.0.0)
               121456 mrogers: UTF-373 - Add _vti_bin.war to 5.0 update package,
         123961: Merged WOLF-6 (WOLF.0.0) to 5.1.1 (5.1.1) (RECORD ONLY) : 
            - 121407,121449,121486,
         123960: Merged WOLF-6 (WOLF.0.0) to 5.1.1 (5.1.1)
            121406 rmunteanu: Merged 5.0.N (5.0.4) to WOLF-6 (WOLF.0.0)
               121352 mrogers: Correcting upgrade assistant script,
         123959: Merged WOLF-6 (WOLF.0.0) to 5.1.1 (5.1.1) (RECORD ONLY) : 
            - 121308,121405,
         123958: Merged WOLF-6 (WOLF.0.0) to 5.1.1 (5.1.1)
            121307 amorarasu: Merged 5.0.N (5.0.4) to WOLF-6 (WOLF.0.0)
               121251 mrogers: UTF-365 - Adding Update Script to the 5.0 update package,
         123957: Merged WOLF-6 (WOLF.0.0) to 5.1.1 (5.1.1) (RECORD ONLY) : 
            - 121306,
         123956: Merged WOLF-6 (WOLF.0.0) to 5.1.1 (5.1.1)
            121294 mward: UTF-348: include filtered package.properties in package.,
         123955: Merged WOLF-6 (WOLF.0.0) to 5.1.1 (5.1.1) (RECORD ONLY) : 
            - 121239,
         123954: Merged WOLF-6 (WOLF.0.0) to 5.1.1 (5.1.1)
            121209 mward: UTF-348: Tie the update tool version to the encompasing package,
         123953: Merged WOLF-6 (WOLF.0.0) to 5.1.1 (5.1.1) (RECORD ONLY) : 
            - 121126,121131,121138,
         123952: Merged WOLF-6 (WOLF.0.0) to 5.1.1 (5.1.1)
            121089 mrogers: UTF-368 - Add the share specific README to the update package,
         123951: Merged WOLF-6 (WOLF.0.0) to 5.1.1 (5.1.1)
            121083 mrogers: Remove some maven warnings from updateTool.xml assembly,
         123950: Merged WOLF-6 (WOLF.0.0) to 5.1.1 (5.1.1)
            121081 mrogers: UTF-366 - add new test for update package that now contains bin/mmt.jar & rework for 5.1,
         123949: Merged WOLF-6 (WOLF.0.0) to 5.1.1 (5.1.1) (RECORD ONLY) : 
            - 121055,
         123948: Merged WOLF-6 (WOLF.0.0) to 5.1.1 (5.1.1)
            121054 amorarasu: Merged 5.0.N (5.0.4) to WOLF-6 (WOLF.0.0)
               121039 mrogers: UTF-366 - Adding MMT.jar to update package,
         123947: Merged WOLF-6 (WOLF.0.0) to 5.1.1 (5.1.1)
            121053 amorarasu: Merged 5.0.N (5.0.4) to WOLF-6 (WOLF.0.0)
               121032 mrogers: UTF-367 - The update tool needs to update the $ALF_HOME/README file in the root of $ALF_HOME,
         123946: Merged WOLF-6 (WOLF.0.0) to 5.1.1 (5.1.1) (RECORD ONLY) : 
            - 120741,120754,120829,120900,120948,120974,121052,
         123945: Merged WOLF-6 (WOLF.0.0) to 5.1.1 (5.1.1)
            120733 aleahu:       Reverse merged WOLF-6 (WOLF.0.0)
                     120727 aleahu: Merged 5.0.N (5.0.4) to WOLF-6 (WOLF.0.0)
                        120639 mrogers: UTF-464 - update package should contain share-enterprise not share [community] on 5.0,
         123944: Merged WOLF-6 (WOLF.0.0) to 5.1.1 (5.1.1) (RECORD ONLY) : 
            - 120728,
         123943: Merged WOLF-6 (WOLF.0.0) to 5.1.1 (5.1.1)
            120727 aleahu:       120727 aleahu: Merged 5.0.N (5.0.4) to WOLF-6 (WOLF.0.0)
                     120639 mrogers: UTF-464 - update package should contain share-enterprise not share [community] on 5.0,
         123942: Merged WOLF-6 (WOLF.0.0) to 5.1.1 (5.1.1) (RECORD ONLY) : 
            - 120532,120599,120702,120703,120710,
         123941: Merged WOLF-6 (WOLF.0.0) to 5.1.1 (5.1.1)
            120497 mrogers: Merged 5.0.N (5.0.4) to WOLF-6 (WOLF.0.0)
               120491 mrogers: UTF-359 - Add WQS artifacts to upgrade package.,
         123940: Merged WOLF-6 (WOLF.0.0) to 5.1.1 (5.1.1)
            120494 mrogers: Adding ignore for .settings,
         123939: Merged WOLF-6 (WOLF.0.0) to 5.1.1 (5.1.1) (RECORD ONLY) : 
            - 115409,115501,115512,115541,115756,115819,115835,115957,
              115964,115986,116209,116408,116540,116549,116648,117382,
              117504,117524,117594,117705,117946,117947,117964,118107,
              118180,118197,118329,118434,118530,118647,118727,118901,
              118921,118945,119296,119533,119585,119607,119703,119827,
              119855,120070,120115,120164,120265,120300,120348,120376,
              120419,
         123938: Merged WOLF-6 (WOLF.0.0) to 5.1.1 (5.1.1)
            115360 mrogers: UTF-310 - added share service amp to update package.,
         123937: Merged WOLF-6 (WOLF.0.0) to 5.1.1 (5.1.1) (RECORD ONLY) : 
            - 114842,115008,115300,
         123936: Merged WOLF-6 (WOLF.0.0) to 5.1.1 (5.1.1)
            114818 mrogers: Merged 5.0.N (5.0.3) to WOLF-6 (WOLF.0.0)
               114806: UTF-302 - adding README.txt to update package.,
         123935: Merged WOLF-6 (WOLF.0.0) to 5.1.1 (5.1.1) (RECORD ONLY) : 
            - 113266,113276,113286,113430,113507,113549,113595,113681,
              113736,113817,113901,114028,114097,114234,114304,114478,
              114479,114480,114481,114748,
         123934: Merged WOLF-6 (WOLF.0.0) to 5.1.1 (5.1.1)
            113265 adavis: Merged 5.0.N (5.0.3) to WOLF-6 (WOLF.0.0)
               113207 mrogers: Add googledocs AMPS again,
         123933: Merged WOLF-6 (WOLF.0.0) to 5.1.1 (5.1.1) (RECORD ONLY) : 
            - 112929,113056,113114,113262,113263,113264,
         123932: Merged WOLF-6 (WOLF.0.0) to 5.1.1 (5.1.1)
            112712 mrogers: Merged 5.0.N (5.0.3) to WOLF-6 (WOLF.0.0)
               112710: UTF-272 - Add SOLR4.WAR to update package.,
         123931: Merged WOLF-6 (WOLF.0.0) to 5.1.1 (5.1.1) (RECORD ONLY) : 
            - 112358,112463,112530,112565,112625,
         123930: Merged WOLF-6 (WOLF.0.0) to 5.1.1 (5.1.1)
            112277 mrogers: Make this file compile!,
         123929: Merged WOLF-6 (WOLF.0.0) to 5.1.1 (5.1.1)
            112275 mrogers: Please work!,
         123928: Merged WOLF-6 (WOLF.0.0) to 5.1.1 (5.1.1)
            112266 mrogers: Correcting packaging unit test,
         123927: Merged WOLF-6 (WOLF.0.0) to 5.1.1 (5.1.1) (RECORD ONLY) : 
            - 112223,112265,
         123926: Merged WOLF-6 (WOLF.0.0) to 5.1.1 (5.1.1)
            112207 mrogers: Merged 5.0.N (5.0.3) to WOLF-6 (WOLF.0.0)
               112201: UTF-264 - Make update test aware that its no longer a "tar bomb",
         123925: Merged WOLF-6 (WOLF.0.0) to 5.1.1 (5.1.1) (RECORD ONLY) : 
            - 112182,
         123924: Merged WOLF-6 (WOLF.0.0) to 5.1.1 (5.1.1)
            112169 mrogers: attempt to get these tests to work.,
         123923: Merged WOLF-6 (WOLF.0.0) to 5.1.1 (5.1.1)
            112147 mrogers: Merged 5.0.N (5.0.3) to WOLF-6 (WOLF.0.0)
               112133: Fix up TgZ test after moving apply_updates.sh,
         123922: Merged WOLF-6 (WOLF.0.0) to 5.1.1 (5.1.1)
            112146 mrogers: Merged 5.0.N (5.0.3) to WOLF-6 (WOLF.0.0)
               112131: Change structure of update package.,
         123921: Merged WOLF-6 (WOLF.0.0) to 5.1.1 (5.1.1) (RECORD ONLY) : 
            - 111938,112043,112116,
         123920: Merged WOLF-6 (WOLF.0.0) to 5.1.1 (5.1.1)
            111926 adavis: Merged 5.0.N (5.0.3) to WOLF-6 (WOLF.0.0)
               111638: UTF-242: refactored archive unpacking code to use try-with-resources for brevity.,
         123919: Merged WOLF-6 (WOLF.0.0) to 5.1.1 (5.1.1)
            111925 adavis: Merged 5.0.N (5.0.3) to WOLF-6 (WOLF.0.0)
               111630: UTF-242: Unix specific test for apply_updates.sh,
         123918: Merged WOLF-6 (WOLF.0.0) to 5.1.1 (5.1.1)
            111924 adavis: Merged 5.0.N (5.0.3) to WOLF-6 (WOLF.0.0)
               111613: UTF-242: added maven integration-test support to the update package project.,
         123917: Merged WOLF-6 (WOLF.0.0) to 5.1.1 (5.1.1)
            111922 adavis: Merged 5.0.N (5.0.3) to WOLF-6 (WOLF.0.0)
               111602: UTF-241: Create a new upgrade package in .tgz format.
               Note that the subpackage (the "update contents") within the tgz is still a zip file - the update tool expects to find a zip file that it can use.
               Also note that the zip package format is in fact capable of storing the execute bits and when unpacking it on a *nix machine, I do see the bin/apply_updates.sh file as having the correct 755 file mode.


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/services/full-installer/trunk@125963 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Matt Ward
2016-04-28 10:37:37 +00:00
parent 3ac3055238
commit fad95f309e
51 changed files with 2849 additions and 139 deletions

View File

@@ -0,0 +1 @@
mvn install -Dthis.installer.location=c:\demo\alfresco-one-installer-20160203-SNAPSHOT-664-win-x64.exe -Dbase.installer.location=c:\demo\alfresco-one-installer-20160203-SNAPSHOT-664-win-x64.exe

View File

@@ -0,0 +1,273 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>alfresco-enterprise-update-test</artifactId>
<name>End to end test of the installer and update</name>
<parent>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-full-installation</artifactId>
<version>5.2.1-SNAPSHOT</version>
</parent>
<!--
To run this locally without the involvement of bamboo and nightly builds
it requires the paths of two alfresco installers to be set
-Dthis.installer.location=<Path of the installer for this build>
-Dbase.installer.location <Path of the installer for the X.X.0 version
e.g. -Dthis.installer.location=c:\demo\alfresco-one-installer-20160203-SNAPSHOT-664-win-x64.exe -Dbase.installer.location=c:\demo\alfresco-one-installer-20160203-SNAPSHOT-664-win-x64.exe
-->
<properties>
<!-- The version have to follow the following pattern
Enterprise-5.[0,1]/5.[0.1].[0]
-->
<base.installer.version></base.installer.version>
<!-- Where to put the two deployed instances of alfresco -->
<base.alfresco.instance>${project.build.directory}/test-data/base-alf-installation</base.alfresco.instance>
<this.alfresco.instance>${project.build.directory}/test-data/this-alf-installation</this.alfresco.instance>
<installer.args>--mode unattended --alfresco_admin_password admin --jdbc_username alfresco --jdbc_password alfresco
--tomcat_server_domain ${HOSTNAME} --disable-components postgres --enable-components javaalfresco,libreofficecomponent,alfrescosolr,alfrescosolr4,aosmodule,alfrescowcmqs,alfrescogoogledocs
--alfrescocustomstack_services_startup demand
</installer.args>
<unpacked.update.package>${project.build.directory}/test-data/alfresco-one-update-package</unpacked.update.package>
</properties>
<dependencies>
<!-- Testing dependencies -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>de.schlichtherle.truezip</groupId>
<artifactId>truezip-driver-zip</artifactId>
<version>7.7.9</version>
</dependency>
<dependency>
<groupId>de.schlichtherle.truezip</groupId>
<artifactId>truezip-file</artifactId>
<version>7.7.9</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.4</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<version>2.3</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>2.3</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>4.2.4.RELEASE</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.5.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<!-- unpack the update package for this version -->
<execution>
<id>unpack-update-package</id>
<phase>generate-resources</phase>
<goals>
<goal>unpack</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-one-update-package</artifactId>
<version>${project.version}</version>
<overWrite>true</overWrite>
<outputDirectory>${unpacked.update.package}</outputDirectory>
<type>zip</type>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
<!-- Download and install the two versions of Alfresco -->
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<id>fetch-installer</id>
<phase>pre-integration-test</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<target>
<taskdef resource="net/sf/antcontrib/antlib.xml" />
<condition property="isWindows" value="true">
<os family="windows" />
</condition>
<condition property="isLinux" value="true">
<os family="unix" />
</condition>
<echo>Is base.installer.version provided ?</echo>
<if>
<or>
<equals arg1="${base.installer.version}" arg2=""/>
<not>
<matches string="${base.installer.version}" pattern="^*.bin$"/>
</not>
</or>
<then>
<fail message="Missing Alfresco Base version. Example: -Dbase.installer.version=https://nightlybuilds.alfresco.com/Enterprise-5.1/5.1/LATEST/ALL/alfresco-one-installer-LATEST-linux-x64.bin" />
</then>
</if>
<!-- Download and install the base version of alfresco -->
<if>
<not>
<isset property="base.installer.location" />
</not>
<then>
<property name="base.installer.location" location="${basedir}/target/base-alf-installer.bin" />
</then>
</if>
<echo>Downloading Base Alfresco installer ${base.installer.version}...</echo>
<get src="${base.installer.version}" dest="${base.installer.location}"/>
<chmod file="${base.installer.location}" perm="a+x" verbose="true" />
<echo>Installing the base Version of Alfresco... to ${base.alfresco.instance}</echo>
<exec executable="${base.installer.location}" dir="target" failonerror="true">
<arg line="${installer.args} --prefix ${base.alfresco.instance} " />
</exec>
<if>
<not>
<isset property="this.installer.location" />
</not>
<then>
<path id="this.installer.name">
<fileset dir="../enterprise-installer/target">
<include name="alfresco-*.bin"/>
</fileset>
</path>
<property name="this.installer.location" refid="this.installer.name" />
</then>
</if>
<echo>Installing newly generated version of Alfresco...</echo>
<exec executable="${this.installer.location}" dir="target" failonerror="true">
<arg line="${installer.args} --prefix ${this.alfresco.instance} " />
</exec>
</target>
</configuration>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.apache.ant</groupId>
<artifactId>ant-jsch</artifactId>
<version>1.8.2</version>
</dependency>
<dependency>
<groupId>ant-contrib</groupId>
<artifactId>ant-contrib</artifactId>
<version>1.0b3</version>
<exclusions>
<exclusion>
<groupId>ant</groupId>
<artifactId>ant</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
</plugin>
<!-- Configure unit and integration tests -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<executions>
<execution>
<id>default-test</id>
<phase>test</phase>
<goals>
<goal>test</goal>
</goals>
<configuration>
<excludes>
<exclude>**/*IntegrationTest.java</exclude>
</excludes>
<redirectTestOutputToFile>true</redirectTestOutputToFile>
<runOrder>alphabetical</runOrder>
<systemPropertyVariables>
<alfresco.update.package>${alfresco.update.package}</alfresco.update.package>
<alfresco.target.dir>${project.build.directory}</alfresco.target.dir>
<this.alfresco.instance>${this.alfresco.instance}</this.alfresco.instance>
<base.alfresco.instance>${base.alfresco.instance}</base.alfresco.instance>
</systemPropertyVariables>
</configuration>
</execution>
<execution>
<id>integration-test</id>
<phase>integration-test</phase>
<goals>
<goal>test</goal>
</goals>
<configuration>
<skip>false</skip>
<workingDirectory>${project.build.directory}</workingDirectory>
<redirectTestOutputToFile>true</redirectTestOutputToFile>
<runOrder>alphabetical</runOrder>
<excludes>
<exclude>none</exclude>
</excludes>
<includes>
<include>**/*IntegrationTest.java</include>
</includes>
<systemPropertyVariables>
<alfresco.update.package.zip>${project.artifactId}-${installer.version.name}.zip</alfresco.update.package.zip>
<alfresco.target.dir>${project.build.directory}</alfresco.target.dir>
</systemPropertyVariables>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<profiles>
</profiles>
</project>

View File

@@ -0,0 +1,28 @@
/*
* Copyright 2016 Alfresco Software, Ltd. All rights reserved.
*
* License rights for this program may be obtained from Alfresco Software, Ltd.
* pursuant to a written agreement and any use of this program without such an
* agreement is prohibited.
*/
package org.alfresco.update.tool.dircomp;
import java.nio.file.Path;
import java.util.Comparator;
/**
* Provides a platform agnostic and consistent sorting mechanism
* for {@link java.nio.file.Path} objects.
*
* @author Matt Ward
*/
public class CaseSensitivePathComparator implements Comparator<Path>
{
@Override
public int compare(Path p1, Path p2)
{
String pathStr1 = p1.toString();
String pathStr2 = p2.toString();
return pathStr1.compareTo(pathStr2);
}
}

View File

@@ -0,0 +1,22 @@
/*
* Copyright 2016 Alfresco Software, Ltd. All rights reserved.
*
* License rights for this program may be obtained from Alfresco Software, Ltd.
* pursuant to a written agreement and any use of this program without such an
* agreement is prohibited.
*/
package org.alfresco.update.tool.dircomp;
import java.nio.file.Path;
import java.util.List;
/**
* File tree comparison tool interface.
*
* @author Matt Ward
*/
public interface FileTreeCompare
{
ResultSet compare(Path p1, Path p2);
}

View File

@@ -0,0 +1,395 @@
/*
* Copyright 2016 Alfresco Software, Ltd. All rights reserved.
*
* License rights for this program may be obtained from Alfresco Software, Ltd.
* pursuant to a written agreement and any use of this program without such an
* agreement is prohibited.
*/
package org.alfresco.update.tool.dircomp;
import de.schlichtherle.truezip.file.TArchiveDetector;
import de.schlichtherle.truezip.file.TConfig;
import de.schlichtherle.truezip.file.TFile;
import de.schlichtherle.truezip.file.TVFS;
import de.schlichtherle.truezip.fs.archive.zip.ZipDriver;
import de.schlichtherle.truezip.socket.sl.IOPoolLocator;
import org.alfresco.update.tool.dircomp.exception.FileTreeCompareException;
import org.apache.commons.io.FileUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.util.AntPathMatcher;
import java.io.*;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* Class capable of comparing two trees of files to determine which directories or
* files appear in one tree and not the other, or whether a file that appears in
* both has differences in its content.
*
* @author Matt Ward
*/
public class FileTreeCompareImpl implements FileTreeCompare
{
private static final Logger log = LogManager.getLogger(FileTreeCompareImpl.class);
private final Set<String> ignorePaths = new HashSet<>();
private final Set<String> allowedDiffsPaths = new HashSet<>();
private final AntPathMatcher pathMatcher = new AntPathMatcher(File.separator);
public FileTreeCompareImpl()
{
this(null, null);
}
public FileTreeCompareImpl(Set<String> ignorePaths, Set<String> allowedDiffsPaths)
{
// This config MUST be present before any TFile objects etc. are created.
TConfig config = TConfig.get();
config.setArchiveDetector(new TArchiveDetector("war|jar|amp", new ZipDriver(IOPoolLocator.SINGLETON)));
if (ignorePaths == null)
{
// Add default ignores
ignorePaths = new HashSet<>();
ignorePaths.add(toPlatformPath("alf_data/postgresql/**"));
ignorePaths.add(toPlatformPath("alf_data/oouser/user/**"));
ignorePaths.add(toPlatformPath("alf_data/solr/*.war"));
ignorePaths.add(toPlatformPath("common/**"));
ignorePaths.add(toPlatformPath("META-INF/MANIFEST.MF"));
ignorePaths.add(toPlatformPath("META-INF/maven/**"));
ignorePaths.add(toPlatformPath("licenses/notice.txt"));
ignorePaths.add(toPlatformPath("uninstall.app/**"));
ignorePaths.add(toPlatformPath("uninstall/**"));
ignorePaths.add(toPlatformPath("uninstall.exe"));
ignorePaths.add(toPlatformPath("uninstall.dat"));
ignorePaths.add(toPlatformPath("libreoffice.app/**"));
ignorePaths.add(toPlatformPath("libreoffice/**"));
ignorePaths.add(toPlatformPath("java/**"));
ignorePaths.add(toPlatformPath("applied-updates/**"));
ignorePaths.add(toPlatformPath("~build/**"));
ignorePaths.add(toPlatformPath("properties.ini"));
ignorePaths.add(toPlatformPath("**/log.txt"));
ignorePaths.add(toPlatformPath("**/solrcore.properties"));
ignorePaths.add(toPlatformPath("**/modifications.install"));
ignorePaths.add(toPlatformPath("tomcat/webapps/ROOT.war"));
// Ignore for 5.1 MNT-14307
ignorePaths.add(toPlatformPath("tomcat/shared/classes/alfresco/web-extension/share-config-custom.xml"));
}
if (allowedDiffsPaths == null)
{
// Add default paths where certain differences are allowed, e.g. absolute path references.
allowedDiffsPaths = new HashSet<>();
allowedDiffsPaths.add(toPlatformPath("common/bin/**"));
allowedDiffsPaths.add(toPlatformPath("common/include/**/*.h"));
allowedDiffsPaths.add(toPlatformPath("common/lib/**/*.pc"));
allowedDiffsPaths.add(toPlatformPath("common/lib/**/*.la"));
allowedDiffsPaths.add(toPlatformPath("libreoffice.app/Contents/Resources/bootstraprc"));
allowedDiffsPaths.add(toPlatformPath("postgresql/bin/**"));
allowedDiffsPaths.add(toPlatformPath("**/*.sh"));
allowedDiffsPaths.add(toPlatformPath("**/*.bat"));
allowedDiffsPaths.add(toPlatformPath("**/*.ini"));
allowedDiffsPaths.add(toPlatformPath("**/*.properties"));
allowedDiffsPaths.add(toPlatformPath("**/*.xml"));
allowedDiffsPaths.add(toPlatformPath("**/*.sample"));
allowedDiffsPaths.add(toPlatformPath("**/*.txt"));
allowedDiffsPaths.add(toPlatformPath("tomcat/conf/Catalina/localhost/solr4.xml"));
allowedDiffsPaths.add(toPlatformPath("tomcat/conf/Catalina/localhost/solr.xml"));
}
this.ignorePaths.addAll(ignorePaths);
this.allowedDiffsPaths.addAll(allowedDiffsPaths);
}
private String toPlatformPath(String path)
{
return path.replace("/", File.separator);
}
@Override
public ResultSet compare(Path p1, Path p2)
{
ResultSet resultSet = new ResultSet();
try
{
compare(resultSet.stats, resultSet.results, p1, p2);
}
catch (Exception e)
{
throw new FileTreeCompareException("Unable to compare file trees.", e);
}
return resultSet;
}
private void compare(ResultSet.Stats stats, List<Result> results, Path tree1, Path tree2) throws IOException
{
SortedPathSet set1 = sortedPaths(tree1);
SortedPathSet set2 = sortedPaths(tree2);
SortedPathSet all = new SortedPathSet();
all.addAll(set1);
all.addAll(set2);
for (Path pathToFind : all)
{
if (pathMatchesIgnorePattern(pathToFind))
{
// Skip paths that we don't want to examine, e.g. tomcat/temp
log.debug("Skipping path: "+pathToFind);
stats.ignoredFileCount++;
continue;
}
Result result = new Result();
results.add(result);
stats.resultCount++;
if (set1.contains(pathToFind) && set2.contains(pathToFind))
{
log.debug("In both: "+pathToFind);
// Set the results, translating paths back to absolute as required.
result.p1 = tree1.resolve(pathToFind);
result.p2 = tree2.resolve(pathToFind);
boolean contentMatches = false;
if (Files.isRegularFile(result.p1) && Files.isRegularFile(result.p2))
{
contentMatches = FileUtils.contentEquals(result.p1.toFile(), result.p2.toFile());
if (!contentMatches)
{
if (pathMatchesAllowedDiffsPattern(pathToFind))
{
File f1 = preprocessFile(tree1, result.p1.toFile());
File f2 = preprocessFile(tree2, result.p2.toFile());
contentMatches = FileUtils.contentEquals(f1, f2);
// Delete the files now that we no longer need them. The originals are still available.
f1.delete();
f2.delete();
if (contentMatches)
{
// If the preprocessed files match, then although the files didn't
// match when first compared byte-for-byte, they do match as far as we are concerned.
// But add to the stats that this is what has happened.
stats.suppressedDifferenceCount++;
}
}
else if (isSpecialArchive(pathToFind))
{
Path archive1 = extract(result.p1);
Path archive2 = extract(result.p2);
result.subTree1 = archive1;
result.subTree2 = archive2;
final int diffBefore = stats.differenceCount;
compare(stats, result.subResults, archive1, archive2);
final int diffAfter = stats.differenceCount;
if (diffAfter == diffBefore)
{
// No significant differences were found in the (recursive) subtree comparison.
// We can therefore mark the special archive files matching in both trees.
contentMatches = true;
}
}
}
}
else if (Files.isDirectory(result.p1) && Files.isDirectory(result.p2))
{
// Two directories are counted as the same.
contentMatches = true;
}
result.equal = contentMatches;
}
else if (set1.contains(pathToFind))
{
log.debug("In tree1 only: "+pathToFind);
result.p1 = tree1.resolve(pathToFind);
result.p2 = null;
}
else if (set2.contains(pathToFind))
{
log.debug("In tree2 only: "+pathToFind);
result.p1 = null;
result.p2 = tree2.resolve(pathToFind);
}
else
{
throw new IllegalStateException(
"Something went wrong. The path is not found in either tree: "+pathToFind);
}
if (!result.equal)
{
stats.differenceCount++;
}
}
}
private File preprocessFile(Path tree, File orig) throws IOException
{
// Create a set of replacements that we intend to make. Replacing them with
// a known token allows us to remove differences (that we're not interested in) in the files.
Map<String, String> replacements = new HashMap<>();
replacements.put(tree.toRealPath().toString(), replacementToken("comparison_root"));
// Create a pattern for module.installDate
Pattern installDatePattern = Pattern.compile("module.installDate=.*[\n\r\f]*$");
Pattern commentPattern = Pattern.compile("^#.*");
File processed = Files.createTempFile(orig.getName(), ".tmp").toFile();
try(Reader r = new FileReader(orig);
BufferedReader br = new BufferedReader(r);
Writer w = new FileWriter(processed);
PrintWriter pw = new PrintWriter(w))
{
String line;
while ((line = br.readLine()) != null)
{
for (String replKey : replacements.keySet())
{
String replVal = replacements.get(replKey);
line = line.replace(replKey, replVal);
}
Matcher m = installDatePattern.matcher(line);
if(m.matches())
{
// replace module.installDate
line = m.replaceFirst("module.installDate=<install-date>");
}
Matcher cp = commentPattern.matcher(line);
if(cp.matches())
{
// replace module.installDate
line = "# {comment suppressed}\n";
}
pw.println(line);
}
}
return processed;
}
private String replacementToken(String label)
{
return String.format("@$@$@$@${{TREE_COMPARE_%s}}", label);
}
private boolean isSpecialArchive(Path pathToFind)
{
return pathToFind.getFileName().toString().toLowerCase().endsWith(".war") ||
pathToFind.getFileName().toString().toLowerCase().endsWith(".jar") ||
pathToFind.getFileName().toString().toLowerCase().endsWith(".amp");
}
/**
* If the set of paths to allow <em>certain</em> differences ({@link #allowedDiffsPaths})
* contains a pattern matching the specified path, then true is returned.
* <p>
* Patterns are ant-style patterns.
*
* @param path The path to check
* @return True if there is a pattern in the allowedDiffsPaths set matching the path.
*/
private boolean pathMatchesAllowedDiffsPattern(String path)
{
return pathMatchesPattern(path, allowedDiffsPaths);
}
/**
* @see #pathMatchesAllowedDiffsPattern(String)
*/
private boolean pathMatchesAllowedDiffsPattern(Path path)
{
return pathMatchesAllowedDiffsPattern(path.toString());
}
/**
* If the set of paths to ignore ({@link #ignorePaths}) contains
* a pattern matching the specified path, then true is returned.
* <p>
* Patterns are ant-style patterns.
*
* @param path The path to check
* @return True if there is a path in the ignorePaths set that is a prefix of the path.
*/
private boolean pathMatchesIgnorePattern(String path)
{
return pathMatchesPattern(path, ignorePaths);
}
/**
* @see #pathMatchesIgnorePattern(String)
*/
private boolean pathMatchesIgnorePattern(Path path)
{
return pathMatchesIgnorePattern(path.toString());
}
private boolean pathMatchesPattern(String path, Set<String> patterns)
{
for (String pattern : patterns)
{
if (pathMatcher.match(pattern, path))
{
return true;
}
}
return false;
}
private Path extract(Path archivePath) throws IOException
{
String destDirName = archivePath.getFileName().toString();
Path dest = Files.createTempDirectory(destDirName);
extract(archivePath, dest);
return dest;
}
private void extract(Path archivePath, Path destPath) throws IOException
{
TFile archive = new TFile(archivePath.toFile());
TFile dest = new TFile(destPath.toFile(), TArchiveDetector.NULL);
try
{
// Unzip the archive.
archive.cp_rp(dest);
}
finally
{
TVFS.umount(archive);
TVFS.umount(dest);
}
}
/**
* Traverse path and create a {@link SortedPathSet} containing the set
* of paths encountered. The {@link Path} instances are relative to
* the base path provided as a parameter to this method.
*
* @param path The path to traverse.
* @return SortedPathSet
* @throws IOException
*/
protected SortedPathSet sortedPaths(Path path) throws IOException
{
SortedPathSet sortedPaths = new SortedPathSet();
collectPaths(sortedPaths, path, path.toFile());
return sortedPaths;
}
private void collectPaths(SortedPathSet sortedSet, Path root, File path) throws IOException
{
for (File f : path.listFiles())
{
Path relativePath = root.relativize(f.toPath());
sortedSet.add(relativePath);
if (f.isDirectory())
{
collectPaths(sortedSet, root, f);
}
}
}
}

View File

@@ -0,0 +1,170 @@
/*
* Copyright 2016 Alfresco Software, Ltd. All rights reserved.
*
* License rights for this program may be obtained from Alfresco Software, Ltd.
* pursuant to a written agreement and any use of this program without such an
* agreement is prohibited.
*/
package org.alfresco.update.tool.dircomp;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.List;
/**
* Format results as HTML.
*
* @author Matt Ward
*/
public class HtmlResultFormatter implements ResultFormatter
{
private int maxPathDisplayLength = 50;
private boolean differencesOnly;
@Override
public void format(ResultSet resultSet, OutputStream out)
{
boolean failed = resultSet.stats.differenceCount > 0;
try(PrintWriter pw = new PrintWriter(out))
{
pw.println("<!DOCTYPE HTML>");
pw.println("<html>");
pw.println("<head>");
pw.println("<title>File tree comparison results</title>");
pw.println("<link rel=\"stylesheet\" href=\"https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css\" integrity=\"sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7\" crossorigin=\"anonymous\">");
pw.println("<link rel=\"stylesheet\" href=\"https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap-theme.min.css\" integrity=\"sha384-fLW2N01lMqjakBkx3l/M9EahuwpSfeNvV63J5ezn3uZzapT0u7EYsXMjQV+0En5r\" crossorigin=\"anonymous\">");
pw.println("</head>");
pw.println("<body>");
pw.println("<div class=\"container\">");
String passOrFail;
String alertClass;
if (failed)
{
alertClass = "alert-danger";
passOrFail = "FAILED";
}
else
{
alertClass = "alert-success";
passOrFail = "PASSED";
}
pw.println("<div class=\"page-header\">\n" +
" <h1>Fresh installation vs updated installation <small>Diff tool results</small></h1>\n" +
"</div>");
pw.println("<div class=\"alert "+alertClass+"\" role=\"alert\">");
pw.println(" <p>Status: "+passOrFail+"</p>");
pw.println(" <p>Files examined: <strong>"+resultSet.stats.resultCount+"</strong></p>");
pw.println(" <p>Files with differences: <strong>"+resultSet.stats.differenceCount+"</strong></p>");
pw.println(" <p>Files with <em>allowed</em> differences: <strong>"+resultSet.stats.suppressedDifferenceCount+"</strong></p>");
pw.println(" <p>Ignored files: <strong>"+resultSet.stats.ignoredFileCount+"</strong></p>");
pw.println("</div>");
outputResultsTable(resultSet.results, pw, 0);
pw.println("</div><!-- end container -->");
pw.println("</body>");
pw.println("</html>");
}
}
private void outputResultsTable(List<Result> results, PrintWriter pw, int row)
{
pw.println("<table class=\"table table-striped table-hover\">");
pw.println("<thead>");
pw.println("<tr>");
pw.println("<th>#</th>");
pw.println("<th>Updated install</th>");
pw.println("<th>Fresh install</th>");
pw.println("</tr>");
pw.println("</thead>");
pw.println("<tbody>");
for (Result r : results)
{
++row;
outputResult(pw, row, r);
if (!r.subResults.isEmpty())
{
// Only show the subresults if there are
if (!differencesOnly || !r.equal)
{
pw.println("<tr><td>&nbsp;</td><td colspan=\"2\">");
outputResultsTable(r.subResults, pw, row);
pw.println("</td></tr>");
}
}
}
pw.println("</tbody>");
pw.println("</table>");
}
private void outputResult(PrintWriter pw, int row, Result r)
{
if (differencesOnly && r.equal)
{
return;
}
pw.println("<tr>");
pw.println("<td>"+row+"</td>");
String p1 = (r.p1 == null) ? "" : r.p1.toString();
String p1Abbr = abbreviate(p1, maxPathDisplayLength);
String p2 = (r.p2 == null) ? "" : r.p2.toString();
String p2Abbr = abbreviate(p2, maxPathDisplayLength);
// TODO: URL/HTML-encode as appropriate
String diffClass;
if (r.equal)
{
if (r.subResults.isEmpty())
{
// Result refers to a normal file or directory.
diffClass = "info";
}
else
{
// File is a special archive, but no differences in the sub-results are considered important.
diffClass = "warning";
}
}
else
{
// The file/directory appears different in each tree. If it is a special archive, then there
// are differences that we care about.
diffClass = "danger";
}
pw.println(
String.format("<td class=\"%s\"><a href=\"file://%s\">%s</a></td><td class=\"%s\"><a href=\"file://%s\">%s</a></td>",
diffClass,
p1,
p1Abbr,
diffClass,
p2,
p2Abbr));
pw.println("</tr>");
}
private String abbreviate(String str, int maxLength)
{
return (str.length() > maxLength) ? "..."+str.substring(str.length()-maxLength) : str;
}
public void setMaxPathDisplayLength(int maxPathDisplayLength)
{
this.maxPathDisplayLength = maxPathDisplayLength;
}
public void setDifferencesOnly(boolean differencesOnly)
{
this.differencesOnly = differencesOnly;
}
}

View File

@@ -0,0 +1,95 @@
/*
* Copyright 2016 Alfresco Software, Ltd. All rights reserved.
*
* License rights for this program may be obtained from Alfresco Software, Ltd.
* pursuant to a written agreement and any use of this program without such an
* agreement is prohibited.
*/
package org.alfresco.update.tool.dircomp;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.List;
/**
* Simple struct-style result data class.
*
* @author Matt Ward
*/
public final class Result
{
/**
* The path within tree1 being compared (intended to be the updated Alfresco installation).
* <p>
* This field will be <code>null</code> if the file in question appears only in the tree2.
*/
Path p1;
/**
* The path within tree2 being compared (intended to be the freshly installed equivalent of {@link #p1}).
* <p>
* This field will be <code>null</code> if the file in question appears only in the tree1.
*/
Path p2;
/**
* Are the paths in {@link #p1} and {@link #p2} of identical content? If they refer to a directory, then
* equal in this sense is to have the same directory name. If they refer to a plain file, then equal means
* that they contain the exact same contents.
*/
boolean equal;
/**
* The root path of sub-tree1 to which {@link #subResults} refers.
* @see #subResults
*/
Path subTree1;
/**
* The root path of sub-tree2 to which {@link #subResults} refers.
* @see #subResults
*/
Path subTree2;
/**
* If p1 and p2 refer to a special archive with differences, e.g. they refer to alfresco.war,
* then a deep comparison of the archives will be performed and the results stored here.
* <p>
* The paths to the expanded archives will be stored in {@link #subTree1} and {@link #subTree2}
* and all the paths in {@link #subResults} will be within those new roots.
*/
List<Result> subResults = new ArrayList<>();
@Override
public int hashCode()
{
final int prime = 31;
int result = 1;
result = prime * result + (this.equal ? 1231 : 1237);
result = prime * result + ((this.p1 == null) ? 0 : this.p1.hashCode());
result = prime * result + ((this.p2 == null) ? 0 : this.p2.hashCode());
return result;
}
@Override
public boolean equals(Object obj)
{
if (this == obj) return true;
if (obj == null) return false;
if (getClass() != obj.getClass()) return false;
Result other = (Result) obj;
if (this.equal != other.equal) return false;
if (this.p1 == null)
{
if (other.p1 != null) return false;
}
else if (!this.p1.equals(other.p1)) return false;
if (this.p2 == null)
{
if (other.p2 != null) return false;
}
else if (!this.p2.equals(other.p2)) return false;
return true;
}
@Override
public String toString()
{
return String.format("Result[p1=%s, p2=%s, equal=%b]", p1, p2, equal);
}
}

View File

@@ -0,0 +1,28 @@
/*
* Copyright 2016 Alfresco Software, Ltd. All rights reserved.
*
* License rights for this program may be obtained from Alfresco Software, Ltd.
* pursuant to a written agreement and any use of this program without such an
* agreement is prohibited.
*/
package org.alfresco.update.tool.dircomp;
import java.io.OutputStream;
import java.util.Collection;
/**
* Format a set of {@link Result} objects.
*
* @author Matt Ward
*/
public interface ResultFormatter
{
/**
* Format the result set to the supplied {@link OutputStream}. The caller
* must take care of creating and destroying the OutputStream correctly.
*
* @param results The results to format.
* @param out The stream to format the results to.
*/
void format(ResultSet results, OutputStream out);
}

View File

@@ -0,0 +1,44 @@
package org.alfresco.update.tool.dircomp;
import java.util.ArrayList;
import java.util.List;
/*
* Copyright 2015-2016 Alfresco Software, Ltd. All rights reserved.
*
* License rights for this program may be obtained from Alfresco Software, Ltd.
* pursuant to a written agreement and any use of this program without such an
* agreement is prohibited.
*/
public class ResultSet
{
final List<Result> results = new ArrayList<>();
public final Stats stats = new Stats();
/**
* Class for aggregating basic statistics relating to the directory tree comparisons.
* <p>
* For all counts, unless specified otherwise, if a file appears in both trees, it is
* counted only once, as it is relative files we are tracking regardless of which
* tree(s) they exist in.
*/
public static class Stats
{
/**
* The number of files (including directories) examined.
*/
public int resultCount;
/**
* The number of files discovered to have differences that are not allowed or ignored.
*/
public int differenceCount;
/**
* The number of files discovered to have differences, but the difference is allowed.
*/
public int suppressedDifferenceCount;
/**
* The number of files that were completely ignored due to being in the ignore list.
*/
public int ignoredFileCount;
}
}

View File

@@ -0,0 +1,28 @@
/*
* Copyright 2016 Alfresco Software, Ltd. All rights reserved.
*
* License rights for this program may be obtained from Alfresco Software, Ltd.
* pursuant to a written agreement and any use of this program without such an
* agreement is prohibited.
*/
package org.alfresco.update.tool.dircomp;
import java.nio.file.Path;
import java.util.TreeSet;
/**
* Sorted set of {@link Path} objects that provides consistent
* cross-platform sort order.
*
* @see java.util.TreeSet
* @author Matt Ward
*/
public class SortedPathSet extends TreeSet<Path>
{
private static final long serialVersionUID = 1L;
public SortedPathSet()
{
super(new CaseSensitivePathComparator());
}
}

View File

@@ -0,0 +1,73 @@
package org.alfresco.update.tool.dircomp;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.nio.file.Path;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;
/**
* Format the org.alfresco.update.tool.dircomp.ResultSet as a set of files inside a zip file.
*
* Files that are equal are not added to the zip file.
*
* @author mrogers
*/
public class ZipResultFormatter implements ResultFormatter
{
@Override
public void format(ResultSet resultSet, OutputStream out)
{
ZipOutputStream zos = (ZipOutputStream)out;
for(Result result : resultSet.results)
{
if(!result.equal)
{
try
{
putFile(result.p1, zos);
putFile(result.p2, zos);
}
catch (IOException ie)
{
// Do nothing
}
}
}
}
private void putFile(Path path, ZipOutputStream zos) throws IOException
{
if(path != null)
{
byte[] buffer = new byte[1024];
File file = path.toFile();
if(file.isFile())
{
ZipEntry zipEntry = new ZipEntry(getEntryName(path));
zipEntry.setTime(file.lastModified());
try (FileInputStream ins = new FileInputStream(file))
{
zos.putNextEntry(zipEntry);
int len;
while ((len = ins.read(buffer)) > 0)
{
zos.write(buffer, 0, len);
}
zos.closeEntry();
}
}
}
}
private String getEntryName(Path path)
{
// eg differences/xml-data/foo/bar
return "differences" + path.normalize().toString().replace('\\', '/').trim();
}
}

View File

@@ -0,0 +1,31 @@
/*
* Copyright 2016 Alfresco Software, Ltd. All rights reserved.
*
* License rights for this program may be obtained from Alfresco Software, Ltd.
* pursuant to a written agreement and any use of this program without such an
* agreement is prohibited.
*/
package org.alfresco.update.tool.dircomp.exception;
import org.alfresco.update.tool.dircomp.FileTreeCompare;
/**
* Exception class representing failures during file tree comparison.
*
* @see FileTreeCompare
* @author Matt Ward
*/
public class FileTreeCompareException extends RuntimeException
{
private static final long serialVersionUID = 1L;
public FileTreeCompareException(String message)
{
super(message);
}
public FileTreeCompareException(String message, Throwable cause)
{
super(message, cause);
}
}

View File

@@ -0,0 +1,303 @@
/*
* Copyright 2015-2016 Alfresco Software, Ltd. All rights reserved.
*
* License rights for this program may be obtained from Alfresco Software, Ltd.
* pursuant to a written agreement and any use of this program without such an
* agreement is prohibited.
*/
import org.alfresco.update.tool.dircomp.FileTreeCompare;
import org.alfresco.update.tool.dircomp.FileTreeCompareImpl;
import org.alfresco.update.tool.dircomp.HtmlResultFormatter;
import org.alfresco.update.tool.dircomp.Result;
import org.alfresco.update.tool.dircomp.ResultSet;
import org.alfresco.update.tool.dircomp.ZipResultFormatter;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
import java.io.*;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Set;
import java.util.zip.ZipOutputStream;
import static org.junit.Assert.assertTrue;
public class EndToEndIntegrationTest
{
private final static String JAR_FILE_NAME = "alfresco-update-tool.jar";
File targetDir;
private String getBasePath()
{
String basePath = System.getProperty("base.alfresco.instance");
if (basePath == null)
{
basePath = "./test-data/base-alf-installation";
}
File base = new File(targetDir, basePath);
assertTrue("base instance does not exist :" + base, base.exists());
return base.getAbsolutePath();
}
private String getThisPath()
{
String basePath = System.getProperty("this.alfresco.instance");
if (basePath == null)
{
basePath = "./test-data/this-alf-installation";
}
File base = new File(targetDir, basePath);
assertTrue("this instance (the one to update) does not exist :" + base, base.exists());
return base.getAbsolutePath();
}
private String getUpdatePath()
{
String basePath = System.getProperty("unpacked.update.package");
if (basePath == null)
{
basePath = "./test-data/alfresco-one-update-package";
}
File base = new File(targetDir, basePath);
assertTrue(base.isDirectory());
assertTrue("the update package does not exist :" + base, base.exists());
String[] dirs = base.list();
assertTrue(dirs.length == 1);
return new File(base, dirs[0]).getAbsolutePath();
}
private void initTargetDir()
{
String targetDir = System.getProperty("alfresco.target.dir");
if (targetDir == null)
{
targetDir = "./target"; // test needs to be run in target dir.
}
this.targetDir = new File(targetDir);
assertTrue("target dir does not exist :" + targetDir, this.targetDir.exists());
}
@Before
public void setUp() throws Exception
{
initTargetDir();
}
@Test
public void testEndToEndUpdate() throws Exception
{
File updateThisOne = new File(getBasePath());
File referenceInstance = new File(getThisPath());
File updatePackage = new File(getUpdatePath());
// Run the update
runUpdateTool(updateThisOne, updatePackage);
// Run the diff tool
compare(referenceInstance, updateThisOne);
}
/**
* Run the update tool
*/
public void runUpdateTool(File instanceToUpdate, File updatePackage) throws Exception
{
// expect to find jar at "lib/alfresco-update-tool.jar"
File jar = new File(updatePackage, "lib/" + JAR_FILE_NAME);
assertTrue("lib/" + JAR_FILE_NAME, jar.exists());
// expect to find update resources
String options = " --assumeyes -u " + updatePackage;
String cmd = "java -jar " + jar.getAbsolutePath() + options + " " + instanceToUpdate.getPath();
boolean found = runCommand(
targetDir,
cmd,
null,
0,
"The update was successful"
);
assertTrue("The update was successful", found);
}
/**
* Run the diff tool
*
* @param freshInstallation
* @param updatedInstallation
*/
public void compare(File freshInstallation, File updatedInstallation) throws IOException
{
FileTreeCompare comparator = new FileTreeCompareImpl();
ResultSet resultSet = comparator.compare(updatedInstallation.toPath(), freshInstallation.toPath());
File dircompDir = new File(targetDir, "installation-diff");
dircompDir.mkdirs();
// Format the results as an HTML report.
File file = new File(dircompDir, "installation-diff-report.html");
file.createNewFile();
HtmlResultFormatter formatter = new HtmlResultFormatter();
formatter.setDifferencesOnly(true);
try(FileOutputStream fos = new FileOutputStream(file);
BufferedOutputStream bos = new BufferedOutputStream(fos))
{
formatter.format(resultSet, bos);
}
File zipFile = new File(dircompDir, "installation-diff-report.zip");
zipFile.createNewFile();
ZipResultFormatter zformatter = new ZipResultFormatter();
try (FileOutputStream fos = new FileOutputStream(zipFile);
ZipOutputStream zos = new ZipOutputStream(fos))
{
zformatter.format(resultSet, zos);
}
assertTrue("update test has found unexpected differences, see the installation-diff-report for further details", resultSet.stats.differenceCount == 0);
}
/**
* Utility/harness to allow easy testing of {@link #compare(File, File)}.
* <p>
* Uncomment @Ignore, but do not check in.
*
* @throws IOException
*/
@Ignore
@Test
public void bigDiff() throws IOException
{
Path path1 = Paths.get("/Users/MWard/dev2/alf-installs/alf-5.1-b667");
Path path2 = Paths.get("/Users/MWard/dev2/alf-installs/alf-5.1-b669");
compare(path1.toFile(), path2.toFile());
}
/*
* Method to execute a command
*
* This variant of runCommand takes multiple expected messages.
* If a message is repeated twice in <i>expectedMessage</i> then the message must appear in
* the command line output at least twice to return true.
*
* @param targetLocation location for executing the command
* @param cmd the command to be executed
* @param input - input for command line prompts, may be null if not required
* @param expectedMessage... messages to be verified
* @param expectedReturnCode 0 for success
* @return true the messages are all found
* @throws IOException
*/
public boolean runCommand(File targetLocation, String cmd, String[] input, int expectedReturnCode, String... expectedMessage) throws IOException, InterruptedException
{
Runtime rt = Runtime.getRuntime();
String line = null;
Process pr = rt.exec(cmd, null, targetLocation);
if(input != null && input.length > 0)
{
Input inputThread = new Input(pr.getOutputStream(), input);
inputThread.start();
}
ArrayList<String> toFind = new ArrayList<String>();
for(int i = 0; i < expectedMessage.length; i++)
{
toFind.add(expectedMessage[i]);
}
int found;
try (BufferedReader out = new BufferedReader(new InputStreamReader(pr.getInputStream())))
{
while ((line = out.readLine()) != null)
{
found = -1;
for(int i = 0; i < toFind.size() ; i++)
{
if (line.contains(toFind.get(i)))
{
found = i;
}
}
System.out.println(line);
if(found >= 0)
{
toFind.remove(found);
}
}
}
int retCode = pr.waitFor();
if(retCode != expectedReturnCode)
{
System.out.println("Not expected return code expected:" + expectedReturnCode + " actual: " + retCode);
return false;
}
if(toFind.size() == 0)
{
return true;
}
System.out.println("Did not find expected message: " + toFind);
return false;
}
/**
*
*/
protected class Input extends Thread
{
OutputStream is;
String[] input;
Input(OutputStream is, String[] input)
{
this.is = is;
this.input = input;
}
public void run()
{
try (BufferedWriter in = new BufferedWriter(new OutputStreamWriter(is));)
{
for (String line : input)
{
in.write(line);
in.newLine();
System.out.println("wrote : " + line);
}
}
catch (IOException e)
{
}
}
}
}

View File

@@ -0,0 +1,415 @@
/*
* Copyright 2016 Alfresco Software, Ltd. All rights reserved.
*
* License rights for this program may be obtained from Alfresco Software, Ltd.
* pursuant to a written agreement and any use of this program without such an
* agreement is prohibited.
*/
package org.alfresco.update.tool.dircomp;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import java.io.File;
import java.io.IOException;
import java.net.URISyntaxException;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Date;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
import org.apache.commons.io.FileUtils;
import org.junit.Before;
import org.junit.Test;
import org.springframework.util.AntPathMatcher;
/**
* Tests for the {@link FileTreeCompareImpl} class.
*
* @author Matt Ward
*/
public class FileTreeCompareImplTest
{
FileTreeCompareImpl comparator;
@Before
public void setUp() throws Exception
{
comparator = new FileTreeCompareImpl(new HashSet<String>(), new HashSet<String>());
}
@Test
public void canGetSortedPathSet() throws IOException
{
Path tree = pathFromClasspath("dir_compare/simple_file_folders/tree1");
SortedPathSet paths = comparator.sortedPaths(tree);
Iterator<Path> it = paths.iterator();
System.out.println("Paths:");
for (Path p : paths)
{
System.out.println("\t"+p);
}
assertEquals(11, paths.size());
assertEquals("a", unixPathStr(tree, it.next()));
assertEquals("b", unixPathStr(tree, it.next()));
assertEquals("b/blah.txt", unixPathStr(tree, it.next()));
assertEquals("c", unixPathStr(tree, it.next()));
assertEquals("c/c1", unixPathStr(tree, it.next()));
assertEquals("c/c1/commands.bat", unixPathStr(tree, it.next()));
assertEquals("c/c1/commands.sh", unixPathStr(tree, it.next()));
assertEquals("c/c2", unixPathStr(tree, it.next()));
assertEquals("c/c2/Aardvark.java", unixPathStr(tree, it.next()));
assertEquals("c/c2/Banana.java", unixPathStr(tree, it.next()));
assertEquals("d", unixPathStr(tree, it.next()));
}
private String unixPathStr(Path root, Path path)
{
// Allow test to run on Windows also
String pathStr = path.toString();
pathStr = pathStr.replace(File.separatorChar, '/');
return pathStr;
}
@Test
public void canDiffSimpleTreesOfFilesAndFolders()
{
Path tree1 = pathFromClasspath("dir_compare/simple_file_folders/tree1");
Path tree2 = pathFromClasspath("dir_compare/simple_file_folders/tree2");
ResultSet resultSet = comparator.compare(tree1, tree2);
System.out.println("Comparison results:");
for (Result r : resultSet.results)
{
System.out.println("\t"+r);
}
// One result for each relative file/folder
assertEquals(13, resultSet.results.size());
assertEquals(13, resultSet.stats.resultCount);
Iterator<Result> rit = resultSet.results.iterator();
// TODO: currently all of the files are in one, other or both but where they
// are in both, the file *contents* are identical.
// TODO: evolve test data and functionality to cope with different file contents.
assertResultEquals(tree1.resolve("a"), tree2.resolve("a"), true, rit.next());
assertResultEquals(null, tree2.resolve("a/story.txt"), false, rit.next());
assertResultEquals(tree1.resolve("b"), tree2.resolve("b"), true, rit.next());
assertResultEquals(tree1.resolve("b/blah.txt"), tree2.resolve("b/blah.txt"), true, rit.next());
assertResultEquals(tree1.resolve("c"), tree2.resolve("c"), true, rit.next());
assertResultEquals(tree1.resolve("c/c1"), tree2.resolve("c/c1"), true, rit.next());
assertResultEquals(tree1.resolve("c/c1/commands.bat"), tree2.resolve("c/c1/commands.bat"), true, rit.next());
assertResultEquals(tree1.resolve("c/c1/commands.sh"), tree2.resolve("c/c1/commands.sh"), true, rit.next());
assertResultEquals(tree1.resolve("c/c2"), tree2.resolve("c/c2"), true, rit.next());
// Aardvark.java appears in both trees but is not the same!
assertResultEquals(tree1.resolve("c/c2/Aardvark.java"), tree2.resolve("c/c2/Aardvark.java"), false, rit.next());
assertResultEquals(tree1.resolve("c/c2/Banana.java"), null, false, rit.next());
assertResultEquals(tree1.resolve("d"), null, false, rit.next());
assertResultEquals(null, tree2.resolve("e"), false, rit.next());
}
/**
* A "learning test" allowing me to check my assumptions and document the expected behaviour.
*/
@Test
public void testAntPathMatcher()
{
AntPathMatcher matcher = new AntPathMatcher();
assertTrue(matcher.match("**/common/lib/**/*.pc", "prefix/common/lib/pkgconfig/ImageMagick++-6.Q16.pc"));
assertFalse(matcher.match("**/common/lib/**/*.pc", "/absolute/prefix/common/lib/pkgconfig/ImageMagick++-6.Q16.pc"));
assertTrue(matcher.match("/**/common/lib/**/*.pc", "/absolute/prefix/common/lib/pkgconfig/ImageMagick++-6.Q16.pc"));
assertTrue(matcher.match("common/lib/**/*.pc", "common/lib/pkgconfig/Wand.pc"));
assertTrue(matcher.match("**/*.pc", "common/lib/pkgconfig/Wand.pc"));
assertFalse(matcher.match("*.pc", "common/lib/pkgconfig/Wand.pc"));
assertTrue(matcher.match("libreoffice.app/Contents/Resources/bootstraprc", "libreoffice.app/Contents/Resources/bootstraprc"));
assertTrue(matcher.match("*.sh", "alfresco.sh"));
assertFalse(matcher.match("*.sh", "a/different/alfresco.sh"));
// Windows matcher
// It seems that changing the path separator on an instance that's already been
// used isn't a good idea due to pattern caching.
matcher = new AntPathMatcher("\\");
assertTrue(matcher.match("**\\common\\lib\\**\\*.pc", "prefix\\common\\lib\\pkgconfig\\ImageMagick++-6.Q16.pc"));
assertTrue(matcher.match("\\**\\common\\lib\\**\\*.pc", "\\absolute\\prefix\\common\\lib\\pkgconfig\\ImageMagick++-6.Q16.pc"));
assertTrue(matcher.match("b\\blah.txt", "b\\blah.txt"));
}
@Test
public void canIgnoreSpecifiedPaths()
{
Path tree1 = pathFromClasspath("dir_compare/simple_file_folders/tree1");
Path tree2 = pathFromClasspath("dir_compare/simple_file_folders/tree2");
Set<String> ignorePaths = new HashSet<>();
ignorePaths.add(toPlatformPath("b/blah.txt"));
ignorePaths.add(toPlatformPath("c/c2/**"));
ignorePaths.add(toPlatformPath("d/**"));
ignorePaths.add(toPlatformPath("e/**"));
comparator = new FileTreeCompareImpl(ignorePaths, new HashSet<String>());
// Perform the comparison
ResultSet resultSet = comparator.compare(tree1, tree2);
System.out.println("Comparison results:");
for (Result r : resultSet.results)
{
System.out.println("\t"+r);
}
Iterator<Result> rit = resultSet.results.iterator();
assertResultEquals(tree1.resolve("a"), tree2.resolve("a"), true, rit.next());
assertResultEquals(null, tree2.resolve("a/story.txt"), false, rit.next());
assertResultEquals(tree1.resolve("b"), tree2.resolve("b"), true, rit.next());
// No b/blah.txt here.
assertResultEquals(tree1.resolve("c"), tree2.resolve("c"), true, rit.next());
assertResultEquals(tree1.resolve("c/c1"), tree2.resolve("c/c1"), true, rit.next());
assertResultEquals(tree1.resolve("c/c1/commands.bat"), tree2.resolve("c/c1/commands.bat"), true, rit.next());
assertResultEquals(tree1.resolve("c/c1/commands.sh"), tree2.resolve("c/c1/commands.sh"), true, rit.next());
// No c/c2, c/c2/Aardvark.java, c/c2/Banana.java, d or e here.
List<Result> results = resultSet.results;
assertResultNotPresent(tree1.resolve("b/blah.txt"), tree2.resolve("b/blah.txt"), true, results);
assertResultNotPresent(tree1.resolve("c/c2"), tree2.resolve("c/c2"), true, results);
assertResultNotPresent(tree1.resolve("c/c2/Aardvark.java"), tree2.resolve("c/c2/Aardvark.java"), false, results);
assertResultNotPresent(tree1.resolve("c/c2/Banana.java"), null, false, results);
assertResultNotPresent(tree1.resolve("d"), null, false, results);
assertResultNotPresent(null, tree2.resolve("e"), false, results);
assertEquals(7, results.size());
// TODO: What about paths within war/jar/zip files?
// ...at the moment, if we specify a path of "mydir/README.txt" to be ignored,
// this will be ignored in the main tree, e.g. <tree1>/mydir/README.txt but also
// within sub-trees if there is a match, e.g. <expanded alfresco.war>/mydir/README.txt
}
@Test
public void canSpecifyFilesThatShouldHaveCertainDifferencesAllowed() throws IOException
{
Path tree1 = pathFromClasspath("dir_compare/allowed_differences/tree1");
Path tree2 = pathFromClasspath("dir_compare/allowed_differences/tree2");
// Check that two identical trees are... identical!
ResultSet resultSet = comparator.compare(tree1, tree2);
System.out.println("Comparison results:");
for (Result r : resultSet.results)
{
System.out.println("\t"+r);
}
assertEquals(0, resultSet.stats.differenceCount);
assertEquals(0, resultSet.stats.ignoredFileCount);
assertEquals(4, resultSet.stats.resultCount);
assertEquals(4, resultSet.results.size());
// Now add files that are different only in there use of tree1 and tree2's absolute paths.
File t1File = new File(tree1.toFile(), "different.txt");
t1File.deleteOnExit();
FileUtils.write(t1File, sampleText(tree1.toAbsolutePath().toString()));
File t2File = new File(tree2.toFile(), "different.txt");
t2File.deleteOnExit();
FileUtils.write(t2File, sampleText(tree2.toAbsolutePath().toString()));
// Now add a module.properties that are different in their "installDate" property only.
File t3File = new File(tree1.toFile(), "module.properties");
t3File.deleteOnExit();
Date date = new Date();
FileUtils.write(t3File, sampleModuleProperties("2016-02-29T16\\:26\\:18.053Z"));
File t4File = new File(tree2.toFile(), "module.properties");
t4File.deleteOnExit();
FileUtils.write(t4File, sampleModuleProperties("2016-02-28T14\\:30\\:14.035Z"));
// Perform the comparison
comparator = new FileTreeCompareImpl(new HashSet<String>(), new HashSet<String>());
resultSet = comparator.compare(tree1, tree2);
System.out.println("Comparison results:");
for (Result r : resultSet.results)
{
System.out.println("\t"+r);
}
// We should see a difference
assertEquals(0, resultSet.stats.suppressedDifferenceCount);
assertEquals(2, resultSet.stats.differenceCount);
assertEquals(0, resultSet.stats.ignoredFileCount);
assertEquals(6, resultSet.stats.resultCount);
assertEquals(6, resultSet.results.size());
Iterator<Result> rit = resultSet.results.iterator();
assertResultEquals(tree1.resolve("different.txt"), tree2.resolve("different.txt"), false, rit.next());
// Perform the comparison again, but after allowing the files to be different.
Set<String> allowedDiffsPaths = new HashSet<>();
allowedDiffsPaths.add(toPlatformPath("**/*.txt"));
allowedDiffsPaths.add(toPlatformPath("**/module.properties"));
// Perform the comparison, this time with some allowed differences
comparator = new FileTreeCompareImpl(new HashSet<String>(), allowedDiffsPaths);
resultSet = comparator.compare(tree1, tree2);
// We should see a difference - but it is in the 'suppressed' list.
assertEquals(2, resultSet.stats.suppressedDifferenceCount);
assertEquals(0, resultSet.stats.differenceCount);
assertEquals(0, resultSet.stats.ignoredFileCount);
assertEquals(6, resultSet.stats.resultCount);
assertEquals(6, resultSet.results.size());
rit = resultSet.results.iterator();
assertResultEquals(tree1.resolve("different.txt"), tree2.resolve("different.txt"), true, rit.next());
}
private String sampleText(String absPath)
{
StringBuilder sb = new StringBuilder();
sb.append("This is some example text\n");
sb.append("...in tree: "+absPath);
sb.append(" ...and here is some more text.\n");
sb.append("...but wait! here's an absolute path again:"+absPath+", yes.");
sb.append("The End.");
return sb.toString();
}
private String sampleModuleProperties(String installDateAsString)
{
StringBuilder sb = new StringBuilder();
sb.append("# " + installDateAsString + "\n");
sb.append("module.id=org.alfresco.integrations.share.google.docs\n");
sb.append("module.version=3.0.3\n");
sb.append("module.buildnumber=4ent\n");
sb.append("module.title=Alfresco / Google Docs Share Module\n");
sb.append("module.description=The Share side artifacts of the Alfresco / Google Docs Integration.\n");
sb.append("module.repo.version.min=5.0.0\n");
sb.append("module.repo.version.max=5.99.99\n");
sb.append("module.installState=INSTALLED\n");
// this is the problem we are trying to solve
sb.append("module.installDate=" + installDateAsString + "\n");
return sb.toString();
}
@Test
public void canDiffTreesContainingWarFiles()
{
Path tree1 = pathFromClasspath("dir_compare/file_folders_plus_war/tree1");
Path tree2 = pathFromClasspath("dir_compare/file_folders_plus_war/tree2");
ResultSet resultSet = comparator.compare(tree1, tree2);
System.out.println("Comparison results:");
for (Result r : resultSet.results)
{
System.out.println("\t"+r);
}
// The 14 top-level results + 17 sub-results.
assertEquals(31, resultSet.stats.resultCount);
// One result for each relative file/folder
assertEquals(14, resultSet.results.size());
Iterator<Result> rit = resultSet.results.iterator();
// TODO: currently all of the files are in one, other or both but where they
// are in both, the file *contents* are identical.
// TODO: evolve test data and functionality to cope with different file contents.
assertResultEquals(tree1.resolve("a"), tree2.resolve("a"), true, rit.next());
assertResultEquals(null, tree2.resolve("a/story.txt"), false, rit.next());
assertResultEquals(tree1.resolve("b"), tree2.resolve("b"), true, rit.next());
// Examine the results of the war file comparison
Result result = rit.next();
// The WAR files are different.
assertResultEquals(
tree1.resolve("b/alfresco-testdata-webapp.war"),
tree2.resolve("b/alfresco-testdata-webapp.war"),
false,
result);
List<Result> subResults = result.subResults;
System.out.println("subResults:");
for (Result r : subResults)
{
System.out.println("\t"+r);
}
Iterator<Result> subIt = subResults.iterator();
Path subTree1 = result.subTree1;
Path subTree2 = result.subTree2;
assertEquals(17, subResults.size());
assertResultEquals(subTree1.resolve("META-INF"), subTree2.resolve("META-INF"), true, subIt.next());
assertResultEquals(subTree1.resolve("META-INF/MANIFEST.MF"), subTree2.resolve("META-INF/MANIFEST.MF"), false, subIt.next());
assertResultEquals(subTree1.resolve("META-INF/maven"), subTree2.resolve("META-INF/maven"), true, subIt.next());
assertResultEquals(subTree1.resolve("META-INF/maven/org.alfresco.dummy"), subTree2.resolve("META-INF/maven/org.alfresco.dummy"), true, subIt.next());
assertResultEquals(subTree1.resolve("META-INF/maven/org.alfresco.dummy/alfresco-testdata-webapp"), subTree2.resolve("META-INF/maven/org.alfresco.dummy/alfresco-testdata-webapp"), true, subIt.next());
assertResultEquals(subTree1.resolve("META-INF/maven/org.alfresco.dummy/alfresco-testdata-webapp/pom.properties"), subTree2.resolve("META-INF/maven/org.alfresco.dummy/alfresco-testdata-webapp/pom.properties"), false, subIt.next());
assertResultEquals(subTree1.resolve("META-INF/maven/org.alfresco.dummy/alfresco-testdata-webapp/pom.xml"), subTree2.resolve("META-INF/maven/org.alfresco.dummy/alfresco-testdata-webapp/pom.xml"), true, subIt.next());
assertResultEquals(subTree1.resolve("WEB-INF"), subTree2.resolve("WEB-INF"), true, subIt.next());
assertResultEquals(subTree1.resolve("WEB-INF/classes"), subTree2.resolve("WEB-INF/classes"), true, subIt.next());
assertResultEquals(subTree1.resolve("WEB-INF/classes/org"), subTree2.resolve("WEB-INF/classes/org"), true, subIt.next());
assertResultEquals(subTree1.resolve("WEB-INF/classes/org/alfresco"), subTree2.resolve("WEB-INF/classes/org/alfresco"), true, subIt.next());
assertResultEquals(subTree1.resolve("WEB-INF/classes/org/alfresco/testdata"), subTree2.resolve("WEB-INF/classes/org/alfresco/testdata"), true, subIt.next());
assertResultEquals(subTree1.resolve("WEB-INF/classes/org/alfresco/testdata/webapp"), subTree2.resolve("WEB-INF/classes/org/alfresco/testdata/webapp"), true, subIt.next());
assertResultEquals(null, subTree2.resolve("WEB-INF/classes/org/alfresco/testdata/webapp/Another.class"), false, subIt.next());
assertResultEquals(subTree1.resolve("WEB-INF/classes/org/alfresco/testdata/webapp/ExampleJavaClass.class"), subTree2.resolve("WEB-INF/classes/org/alfresco/testdata/webapp/ExampleJavaClass.class"), true, subIt.next());
assertResultEquals(subTree1.resolve("WEB-INF/web.xml"), subTree2.resolve("WEB-INF/web.xml"), true, subIt.next());
assertResultEquals(subTree1.resolve("index.jsp"), subTree2.resolve("index.jsp"), false, subIt.next());
// Back up to the top-level comparisons
assertResultEquals(tree1.resolve("b/blah.txt"), tree2.resolve("b/blah.txt"), true, rit.next());
assertResultEquals(tree1.resolve("c"), tree2.resolve("c"), true, rit.next());
assertResultEquals(tree1.resolve("c/c1"), tree2.resolve("c/c1"), true, rit.next());
assertResultEquals(tree1.resolve("c/c1/commands.bat"), tree2.resolve("c/c1/commands.bat"), true, rit.next());
assertResultEquals(tree1.resolve("c/c1/commands.sh"), tree2.resolve("c/c1/commands.sh"), true, rit.next());
assertResultEquals(tree1.resolve("c/c2"), tree2.resolve("c/c2"), true, rit.next());
// Aardvark.java appears in both trees but is not the same!
assertResultEquals(tree1.resolve("c/c2/Aardvark.java"), tree2.resolve("c/c2/Aardvark.java"), false, rit.next());
assertResultEquals(tree1.resolve("c/c2/Banana.java"), null, false, rit.next());
assertResultEquals(tree1.resolve("d"), null, false, rit.next());
assertResultEquals(null, tree2.resolve("e"), false, rit.next());
}
private void assertResultNotPresent(Path p1, Path p2, boolean contentEqual, List<Result> results)
{
Result r = new Result();
r.p1 = p1;
r.p2 = p2;
r.equal = contentEqual;
assertFalse("Result should not be present: "+r, results.contains(r));
}
private void assertResultEquals(Path p1, Path p2, boolean contentEqual, Result result)
{
Result expected = new Result();
expected.p1 = p1;
expected.p2 = p2;
expected.equal = contentEqual;
assertEquals(expected, result);
}
private Path pathFromClasspath(String path)
{
try
{
return Paths.get(getClass().getClassLoader().getResource(path).toURI());
}
catch (URISyntaxException error)
{
throw new RuntimeException("");
}
}
private String toPlatformPath(String path)
{
return path.replace("/", File.separator);
}
}

View File

@@ -0,0 +1,85 @@
/*
* Copyright 2016 Alfresco Software, Ltd. All rights reserved.
*
* License rights for this program may be obtained from Alfresco Software, Ltd.
* pursuant to a written agreement and any use of this program without such an
* agreement is prohibited.
*/
package org.alfresco.update.tool.dircomp;
import java.io.BufferedOutputStream;
import java.io.ByteArrayOutputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import org.apache.commons.io.FileUtils;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
import org.springframework.util.AntPathMatcher;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
/**
* Tests for the {@link HtmlResultFormatter} class.
* <p>
* TODO: currently these aren't tests so much as useful utilities to help with manual testing.
*
* @author Matt Ward
*/
public class HtmlResultFormatterTest
{
@Before
public void setUp() throws Exception
{
}
@Test
public void canFormatToHTML() throws IOException
{
ResultSet resultSet = new ResultSet();
List<Result> results = resultSet.results;
addResult(results, "/t1/a", "/t2/a", true);
addResult(results, "/t1/a/b", "/t2/a/b", true);
addResult(results, "/t1/a/c", "/t2/a/c", true);
addResult(results, "/t1/a/b/c/something.txt", "/t2/a/b/c/something.txt", true);
addResult(results, "/t1/a/b/c/another.txt", "/t2/a/b/c/another.txt", false);
addResult(results, null, "/t2/a/b/c/blah.txt", false);
addResult(results, "/t1/dir-only-in-p1", null, false);
addResult(results, null, "/t2/dir-only-in-p2", false);
resultSet.stats.suppressedDifferenceCount = 2;
resultSet.stats.differenceCount = 4;
resultSet.stats.ignoredFileCount = 0;
resultSet.stats.resultCount = results.size();
try(ByteArrayOutputStream os = new ByteArrayOutputStream())
{
HtmlResultFormatter formatter = new HtmlResultFormatter();
formatter.format(resultSet, os);
System.out.println(os.toString());
// Uncomment to write to file
// Path file = Files.createTempFile(getClass().getSimpleName(), ".html");
// FileUtils.write(file.toFile(), os.toString());
// System.out.println("File: "+file);
}
}
private void addResult(List<Result> results, String p1, String p2, boolean contentMatch)
{
Result r = new Result();
r.p1 = p1 != null ? Paths.get(p1) : null;
r.p2 = p2 != null ? Paths.get(p2) : null;
r.equal = contentMatch;
results.add(r);
}
}

View File

@@ -0,0 +1,82 @@
package org.alfresco.update.tool.dircomp;
import static org.junit.Assert.*;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.net.URL;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.List;
import java.util.zip.ZipOutputStream;
import org.junit.Before;
import org.junit.Test;
/**
* Tests for the {@link ZipResultFormatter} class.
* <p>
*
* @author Mark Rogers
*/
public class ZipResultFormatterTest
{
@Before
public void setUp() throws Exception
{
}
@Test
public void canFormatToZip() throws IOException
{
ResultSet resultSet = new ResultSet();
List<Result> results = resultSet.results;
URL srcDir = getClass().getClassLoader().getResource("dir_compare/allowed_differences/tree1");
assertNotNull(srcDir.getPath());
File f = new File(srcDir.getPath());
File[] files = f.listFiles();
for(File file : files)
{
addResult(results, file.getAbsolutePath(), null, false);
}
resultSet.stats.suppressedDifferenceCount = 2;
resultSet.stats.differenceCount = 4;
resultSet.stats.ignoredFileCount = 0;
resultSet.stats.resultCount = results.size();
ZipResultFormatter zof = new ZipResultFormatter();
Path file = Files.createTempFile(getClass().getSimpleName(), ".zip");
File zipFile = file.toFile();
zipFile.createNewFile();
zipFile.deleteOnExit();
ZipResultFormatter zformatter = new ZipResultFormatter();
try (FileOutputStream fos = new FileOutputStream(zipFile);
ZipOutputStream zos = new ZipOutputStream(fos))
{
zof.format(resultSet, zos);
}
assertTrue(zipFile.length() > 0);
}
private void addResult(List<Result> results, String p1, String p2, boolean contentMatch)
{
Result r = new Result();
r.p1 = p1 != null ? Paths.get(p1) : null;
r.p2 = p2 != null ? Paths.get(p2) : null;
r.equal = contentMatch;
results.add(r);
}
}

View File

@@ -0,0 +1,5 @@
Once upon
A time
Lived
A
Troll

View File

@@ -0,0 +1,2 @@
Sample content
More sample content

View File

@@ -0,0 +1,5 @@
Once upon
A time
Lived
A
Troll

View File

@@ -0,0 +1,2 @@
Sample content
More sample content

View File

@@ -0,0 +1,2 @@
Sample content
More sample content

View File

@@ -0,0 +1,4 @@
#!/bin/bash
echo hello
echo world

View File

@@ -0,0 +1,7 @@
public class Aardvark
{
public static void main(String[] args)
{
System.out.println("Aardvark!");
}
}

View File

@@ -0,0 +1,7 @@
public class Aardvark
{
public static void main(String[] args)
{
System.out.println("Banana!");
}
}

View File

@@ -0,0 +1,5 @@
Once upon
A time
Lived
A
Troll

View File

@@ -0,0 +1,2 @@
Sample content
More sample content

View File

@@ -0,0 +1,4 @@
#!/bin/bash
echo hello
echo world

View File

@@ -0,0 +1,7 @@
public class Aardvark
{
public static void main(String[] args)
{
System.out.println("Hello Aardvark!");
}
}

View File

@@ -0,0 +1,2 @@
Sample content
More sample content

View File

@@ -0,0 +1,2 @@
echo Hello
echo World

View File

@@ -0,0 +1,4 @@
#!/bin/bash
echo hello
echo world

View File

@@ -0,0 +1,7 @@
public class Aardvark
{
public static void main(String[] args)
{
System.out.println("Aardvark!");
}
}

View File

@@ -0,0 +1,7 @@
public class Aardvark
{
public static void main(String[] args)
{
System.out.println("Banana!");
}
}

View File

@@ -0,0 +1,5 @@
Once upon
A time
Lived
A
Troll

View File

@@ -0,0 +1,2 @@
Sample content
More sample content

View File

@@ -0,0 +1,2 @@
echo Hello
echo World

View File

@@ -0,0 +1,4 @@
#!/bin/bash
echo hello
echo world

View File

@@ -0,0 +1,7 @@
public class Aardvark
{
public static void main(String[] args)
{
System.out.println("Hello Aardvark!");
}
}

View File

@@ -1,39 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<assembly
xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
<id>update</id>
<formats>
<format>zip</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<dependencySets>
<!-- alfresco web app -->
<dependencySet>
<useProjectArtifact>false</useProjectArtifact>
<useStrictFiltering>true</useStrictFiltering>
<outputDirectory>assets/web-server/webapps</outputDirectory>
<outputFileNameMapping>alfresco.war</outputFileNameMapping>
<includes>
<include>org.alfresco:alfresco-platform-enterprise:war</include>
</includes>
</dependencySet>
<!-- share web app -->
<dependencySet>
<useProjectArtifact>false</useProjectArtifact>
<useStrictFiltering>true</useStrictFiltering>
<outputDirectory>assets/web-server/webapps</outputDirectory>
<outputFileNameMapping>share.war</outputFileNameMapping>
<includes>
<include>org.alfresco:share:war</include>
</includes>
</dependencySet>
</dependencySets>
</assembly>

View File

@@ -9,44 +9,231 @@
<format>zip</format> <format>zip</format>
</formats> </formats>
<includeBaseDirectory>false</includeBaseDirectory> <includeBaseDirectory>true</includeBaseDirectory>
<files> <fileSets>
<file> <!-- Pack the bin files except for the .sh files -->
<source>${project.basedir}/target/update-contents-${installer.version.name}.zip</source> <fileSet>
<outputDirectory>update</outputDirectory> <directory>${unpacked.update.tool}/bin</directory>
</file>
</files>
<dependencySets>
<!-- The update tool itself -->
<dependencySet>
<useProjectArtifact>false</useProjectArtifact>
<useStrictFiltering>true</useStrictFiltering>
<outputDirectory>bin</outputDirectory>
<outputFileNameMapping>alfresco-update-tool.jar</outputFileNameMapping>
<includes>
<include>org.alfresco:alfresco-update-tool:jar</include>
</includes>
</dependencySet>
<dependencySet>
<useProjectArtifact>false</useProjectArtifact>
<useStrictFiltering>true</useStrictFiltering>
<outputDirectory></outputDirectory> <outputDirectory></outputDirectory>
<unpack>true</unpack>
<unpackOptions>
<lineEnding>keep</lineEnding>
<excludes>
<exclude>META-INF/**</exclude>
</excludes>
</unpackOptions>
<includes> <includes>
<include>org.alfresco:alfresco-update-tool-distribution:jar</include> <include>*.bat</include>
</includes>
<lineEnding>dos</lineEnding>
</fileSet>
<fileSet>
<directory>${unpacked.update.tool}/bin</directory>
<outputDirectory></outputDirectory>
<includes>
<include>*.sh</include>
</includes>
<lineEnding>unix</lineEnding>
<!-- Add the correct execute permissions to *.sh file(s) -->
<fileMode>0755</fileMode>
</fileSet>
<!-- Repack bits of the distribution zip Over time we will probably add more -->
<fileSet>
<directory>${unpacked.alfresco.platform.distribution}</directory>
<outputDirectory>resources/distribution/platform</outputDirectory>
<includes>
<include>package.properties</include>
</includes>
<lineEnding>dos</lineEnding>
</fileSet>
<fileSet>
<directory>${unpacked.alfresco.one.distribution}</directory>
<outputDirectory>resources/distribution/platform</outputDirectory>
<includes>
<include>README.txt</include>
</includes>
<lineEnding>dos</lineEnding>
</fileSet>
<!-- Platform Only distribution - currently the same as full platform -->
<fileSet>
<directory>${unpacked.alfresco.platform.distribution}</directory>
<outputDirectory>resources/distribution/platform_only</outputDirectory>
<includes>
<include>README.txt</include>
<include>package.properties</include>
</includes>
<lineEnding>dos</lineEnding>
</fileSet>
<!-- Share only distribution -->
<fileSet>
<directory>${unpacked.alfresco.share.distribution}</directory>
<outputDirectory>resources/distribution/share_only</outputDirectory>
<includes>
<include>README.txt</include>
<include>package.properties</include>
</includes>
<lineEnding>dos</lineEnding>
</fileSet>
<!-- Common distribution -->
<fileSet>
<directory>${unpacked.alfresco.platform.distribution}/bin</directory>
<outputDirectory>resources/distribution/common/bin</outputDirectory>
<includes>
<include>alfresco-mmt.jar</include>
<include>alfresco-spring-encryptor.jar</include>
</includes>
<lineEnding>keep</lineEnding>
</fileSet>
<!-- Solr4 schema file -->
<fileSet>
<directory>${unpacked.solr4.distribution}/archive-SpacesStore/conf</directory>
<outputDirectory>resources/distribution/common/solr4/archive-SpacesStore/conf</outputDirectory>
<includes>
<include>schema.xml</include>
</includes>
<lineEnding>keep</lineEnding>
</fileSet>
<!-- AOS VTI.WAR -->
<fileSet>
<directory>${unpacked.org.alfresco.aos.distribution}</directory>
<outputDirectory>resources/war</outputDirectory>
<includes>
<include>*.war</include>
</includes>
<lineEnding>keep</lineEnding>
</fileSet>
<!-- AOS AMP -->
<fileSet>
<directory>${unpacked.org.alfresco.aos.distribution}</directory>
<outputDirectory>resources/amp/platform</outputDirectory>
<includes>
<include>*.amp</include>
</includes>
<lineEnding>keep</lineEnding>
</fileSet>
<fileSet>
<directory>${unpacked.update.tool}/bin</directory>
<outputDirectory>lib</outputDirectory>
<includes>
<include>*.jar</include>
</includes>
</fileSet>
<fileSet>
<directory>${unpacked.update.tool}</directory>
<outputDirectory></outputDirectory>
<includes>
<include>README.txt</include>
<include>package.properties</include>
</includes>
<lineEnding>dos</lineEnding>
</fileSet>
<fileSet>
<directory>${unpacked.update.script}</directory>
<outputDirectory>/resources/script</outputDirectory>
<includes>
<include>*.auas</include>
</includes>
<lineEnding>keep</lineEnding>
</fileSet>
<!-- WQS Assets -->
<fileSet>
<directory>${unpacked.alfresco.wcmqs.distribution}</directory>
<outputDirectory>resources/amp/platform</outputDirectory>
<includes>
<include>alfresco-wcmqs.amp</include>
</includes>
</fileSet>
<fileSet>
<directory>${unpacked.alfresco.wcmqs.distribution}</directory>
<outputDirectory>resources/amp/share</outputDirectory>
<includes>
<include>alfresco-wcmqs-share.amp</include>
</includes>
</fileSet>
<fileSet>
<directory>${unpacked.alfresco.wcmqs.distribution}</directory>
<outputDirectory>resources/war</outputDirectory>
<includes>
<include>*.war</include>
</includes>
</fileSet>
</fileSets>
<dependencySets>
<!-- alfresco web app -->
<dependencySet>
<useProjectArtifact>false</useProjectArtifact>
<useStrictFiltering>true</useStrictFiltering>
<outputDirectory>resources/war</outputDirectory>
<outputFileNameMapping>alfresco.war</outputFileNameMapping>
<includes>
<include>org.alfresco:alfresco-platform-enterprise:war</include>
</includes> </includes>
</dependencySet> </dependencySet>
<!-- share web app -->
<dependencySet>
<useProjectArtifact>false</useProjectArtifact>
<useStrictFiltering>true</useStrictFiltering>
<outputDirectory>resources/war</outputDirectory>
<outputFileNameMapping>share.war</outputFileNameMapping>
<includes>
<include>org.alfresco:share:war</include>
</includes>
</dependencySet>
<!-- SOLR4 Web App -->
<dependencySet>
<useProjectArtifact>false</useProjectArtifact>
<useStrictFiltering>true</useStrictFiltering>
<outputDirectory>resources/war</outputDirectory>
<outputFileNameMapping>solr4.war</outputFileNameMapping>
<includes>
<include>org.alfresco:alfresco-solr4:war</include>
</includes>
</dependencySet>
<!-- Google docs AMP -->
<dependencySet>
<useProjectArtifact>false</useProjectArtifact>
<useStrictFiltering>true</useStrictFiltering>
<outputDirectory>resources/amp/platform</outputDirectory>
<includes>
<include>org.alfresco.integrations:alfresco-googledocs-repo:amp:enterprise:*</include>
</includes>
</dependencySet>
<!-- Share Services AMP -->
<dependencySet>
<useProjectArtifact>false</useProjectArtifact>
<useStrictFiltering>true</useStrictFiltering>
<outputDirectory>resources/amp/platform</outputDirectory>
<outputFileNameMapping>alfresco-share-services.amp</outputFileNameMapping>
<includes>
<include>org.alfresco:alfresco-share-services:amp:*</include>
</includes>
</dependencySet>
<dependencySet>
<useProjectArtifact>false</useProjectArtifact>
<useStrictFiltering>true</useStrictFiltering>
<outputDirectory>resources/amp/share</outputDirectory>
<includes>
<include>org.alfresco.integrations:alfresco-googledocs-share:amp:enterprise:*</include>
</includes>
</dependencySet>
</dependencySets> </dependencySets>
</assembly> </assembly>

View File

@@ -7,12 +7,24 @@
<artifactId>alfresco-full-installation</artifactId> <artifactId>alfresco-full-installation</artifactId>
<version>5.2-SNAPSHOT</version> <version>5.2-SNAPSHOT</version>
</parent> </parent>
<artifactId>alfresco-enterprise-update-package</artifactId> <artifactId>alfresco-one-update-package</artifactId>
<packaging>jar</packaging> <packaging>jar</packaging>
<name>Alfresco Enterprise Update Package</name> <name>Alfresco One Update Package</name>
<properties>
<unpacked.update.tool>${project.build.directory}/dependency/alfresco-update-tool-distribution-${alfresco.updatetool.version}</unpacked.update.tool>
<unpacked.alfresco.platform.distribution>${project.build.directory}/dependency/alfresco-one-platform-distributionzip-${alfresco.platform.version}</unpacked.alfresco.platform.distribution>
<unpacked.alfresco.share.distribution>${project.build.directory}/dependency/alfresco-share-distribution-${alfresco.share.version}</unpacked.alfresco.share.distribution>
<unpacked.alfresco.wcmqs.distribution>${project.build.directory}/dependency/wcmqs-${project.version}</unpacked.alfresco.wcmqs.distribution>
<unpacked.org.alfresco.aos.distribution>${project.build.directory}/dependency/aos-${alfresco.aos-module.version}</unpacked.org.alfresco.aos.distribution>
<unpacked.alfresco.one.distribution>${project.build.directory}/dependency/alfresco-one-distribution-${project.version}</unpacked.alfresco.one.distribution>
<unpacked.solr4.distribution>${project.build.directory}/dependency/solr4-distribution-${project.version}</unpacked.solr4.distribution>
<!-- e.g. pull the update scripts from src/main/resources/script/5.0 -->
<unpacked.update.script>${project.build.directory}/classes/script/${version.major}.${version.minor}</unpacked.update.script>
</properties>
<dependencies> <dependencies>
<!-- WAR files --> <!-- Alfresco platform WAR file -->
<dependency> <dependency>
<groupId>org.alfresco</groupId> <groupId>org.alfresco</groupId>
<artifactId>alfresco-platform-enterprise</artifactId> <artifactId>alfresco-platform-enterprise</artifactId>
@@ -20,6 +32,7 @@
<type>war</type> <type>war</type>
</dependency> </dependency>
<!-- Share WAR file -->
<dependency> <dependency>
<groupId>org.alfresco</groupId> <groupId>org.alfresco</groupId>
<artifactId>share</artifactId> <artifactId>share</artifactId>
@@ -27,22 +40,88 @@
<type>war</type> <type>war</type>
</dependency> </dependency>
<!-- Update Tool Itself --> <!-- SOLR4 is currently versioned as part of the platform release -->
<dependency> <dependency>
<groupId>org.alfresco</groupId> <groupId>org.alfresco</groupId>
<artifactId>alfresco-update-tool</artifactId> <artifactId>alfresco-solr4</artifactId>
<version>${alfresco.updatetool.version}</version> <version>${alfresco.platform.version}</version>
<type>jar</type> <type>war</type>
</dependency> </dependency>
<!-- GoogleDocs AMP -->
<dependency> <dependency>
<groupId>org.alfresco</groupId> <groupId>org.alfresco.integrations</groupId>
<artifactId>alfresco-update-tool-distribution</artifactId> <artifactId>alfresco-googledocs-repo</artifactId>
<version>${alfresco.updatetool.version}</version> <version>${alfresco.googledocs.version}</version>
<type>jar</type> <classifier>enterprise</classifier>
<type>amp</type>
</dependency>
<dependency>
<groupId>org.alfresco.integrations</groupId>
<artifactId>alfresco-googledocs-share</artifactId>
<version>${alfresco.googledocs.version}</version>
<classifier>enterprise</classifier>
<type>amp</type>
</dependency> </dependency>
<!-- Test dependencies --> <!-- Share Services AMP for alfresco.war -->
<dependency>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-share-services</artifactId>
<version>${alfresco.share.version}</version>
<type>amp</type>
</dependency>
<dependency>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-wcmqs-distribution</artifactId>
<version>${alfresco.share.version}</version>
<type>zip</type>
</dependency>
<!-- Update Tool distribution package -->
<dependency>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-update-tool-distribution</artifactId>
<version>${alfresco.updatetool.version}</version>
<type>zip</type>
</dependency>
<!-- Platform dependencies -->
<dependency>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-one-platform-distributionzip</artifactId>
<version>${alfresco.platform.version}</version>
<type>zip</type>
</dependency>
<!-- Share dependencies -->
<dependency>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-share-distribution</artifactId>
<version>${alfresco.share.version}</version>
<type>zip</type>
</dependency>
<!-- Full Installer dependencies -->
<dependency>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-one-distribution</artifactId>
<version>${project.version}</version>
<type>jar</type>
</dependency>
<!-- Solr4 dependencies -->
<dependency>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-solr4</artifactId>
<version>${alfresco.platform.version}</version>
<classifier>config</classifier>
<type>zip</type>
</dependency>
<!-- Testing dependencies -->
<dependency> <dependency>
<groupId>junit</groupId> <groupId>junit</groupId>
<artifactId>junit</artifactId> <artifactId>junit</artifactId>
@@ -53,24 +132,195 @@
<build> <build>
<finalName>${project.artifactId}-${installer.version.name}</finalName> <finalName>${project.artifactId}-${installer.version.name}</finalName>
<sourceDirectory>src/main/java</sourceDirectory>
<resources>
<resource>
<directory>src/main/resources</directory>
</resource>
</resources>
<testSourceDirectory>src/test/java</testSourceDirectory>
<testResources>
<testResource>
<directory>src/test/resources</directory>
</testResource>
</testResources>
<plugins> <plugins>
<!--
The assembly plugin doesn't offer the flexibility we need when using dependencySets to unpack
dependencies, so unpacking first using the dependency plugin.
-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>unpack-wcmqs-distribution</id>
<phase>generate-resources</phase>
<goals>
<goal>unpack</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-wcmqs-distribution</artifactId>
<version>${alfresco.share.version}</version>
<type>zip</type>
<outputDirectory>${unpacked.alfresco.wcmqs.distribution}</outputDirectory>
</artifactItem>
</artifactItems>
</configuration>
</execution>
<execution>
<id>unpack-update-tool-distribution</id>
<phase>generate-resources</phase>
<goals>
<goal>unpack</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-update-tool-distribution</artifactId>
<version>${alfresco.updatetool.version}</version>
<overWrite>true</overWrite>
<type>zip</type>
</artifactItem>
</artifactItems>
</configuration>
</execution>
<execution>
<id>unpack-alfresco-enterprise-distribution</id>
<phase>generate-resources</phase>
<goals>
<goal>unpack</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-one-platform-distributionzip</artifactId>
<version>${alfresco.platform.version}</version>
<overWrite>true</overWrite>
<type>zip</type>
</artifactItem>
</artifactItems>
</configuration>
</execution>
<execution>
<id>unpack-alfresco-share-distribution</id>
<phase>generate-resources</phase>
<goals>
<goal>unpack</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-share-distribution</artifactId>
<version>${alfresco.share.version}</version>
<overWrite>true</overWrite>
<type>zip</type>
</artifactItem>
</artifactItems>
</configuration>
</execution>
<execution>
<id>unpack-aos-distribution</id>
<phase>generate-resources</phase>
<goals>
<goal>unpack</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>org.alfresco.aos-module</groupId>
<artifactId>alfresco-aos-module-distributionzip</artifactId>
<version>${alfresco.aos-module.version}</version>
<overWrite>true</overWrite>
<type>zip</type>
<outputDirectory>${unpacked.org.alfresco.aos.distribution}</outputDirectory>
</artifactItem>
</artifactItems>
</configuration>
</execution>
<execution>
<id>unpack-one-distribution</id>
<phase>generate-resources</phase>
<goals>
<goal>unpack</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-one-distribution</artifactId>
<version>${project.version}</version>
<overWrite>true</overWrite>
<type>jar</type>
<outputDirectory>${unpacked.alfresco.one.distribution}</outputDirectory>
</artifactItem>
</artifactItems>
</configuration>
</execution>
<execution>
<id>unpack-solr4-distribution</id>
<phase>generate-resources</phase>
<goals>
<goal>unpack</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-solr4</artifactId>
<version>${alfresco.platform.version}</version>
<classifier>config</classifier>
<overWrite>true</overWrite>
<type>zip</type>
<outputDirectory>${unpacked.solr4.distribution}</outputDirectory>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>com.google.code.maven-replacer-plugin</groupId>
<artifactId>replacer</artifactId>
<version>1.5.3</version>
<executions>
<execution>
<phase>prepare-package</phase>
<goals>
<goal>replace</goal>
</goals>
</execution>
</executions>
<configuration>
<filesToInclude>${unpacked.update.tool}/README.txt,${unpacked.update.tool}/package.properties</filesToInclude>
<replacements>
<replacement>
<token>@Version@</token>
<value>${version}</value>
</replacement>
<replacement>
<token>@UpdateAssistantVersion@</token>
<value>${alfresco.updatetool.version}</value>
</replacement>
</replacements>
</configuration>
</plugin>
<plugin> <plugin>
<artifactId>maven-assembly-plugin</artifactId> <artifactId>maven-assembly-plugin</artifactId>
<executions> <executions>
<execution>
<id>update</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<appendAssemblyId>false</appendAssemblyId>
<descriptors>
<descriptor>assemblies/update.xml</descriptor>
</descriptors>
<finalName>update-contents-${installer.version.name}</finalName>
</configuration>
</execution>
<execution> <execution>
<id>update-tool</id> <id>update-tool</id>
<phase>package</phase> <phase>package</phase>
@@ -90,16 +340,26 @@
</execution> </execution>
</executions> </executions>
</plugin> </plugin>
<!-- Configure unit and integration tests -->
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId> <artifactId>maven-surefire-plugin</artifactId>
<configuration>
<excludes>
<exclude>**/*IntegrationTest.java</exclude>
</excludes>
</configuration>
<executions> <executions>
<execution>
<id>default-test</id>
<phase>test</phase>
<goals>
<goal>test</goal>
</goals>
<configuration>
<excludes>
<exclude>**/*IntegrationTest.java</exclude>
</excludes>
<redirectTestOutputToFile>true</redirectTestOutputToFile>
<runOrder>alphabetical</runOrder>
</configuration>
</execution>
<execution> <execution>
<id>integration-test</id> <id>integration-test</id>
<phase>integration-test</phase> <phase>integration-test</phase>
@@ -109,18 +369,19 @@
<configuration> <configuration>
<skip>false</skip> <skip>false</skip>
<workingDirectory>${project.build.directory}</workingDirectory> <workingDirectory>${project.build.directory}</workingDirectory>
<redirectTestOutputToFile>false</redirectTestOutputToFile> <redirectTestOutputToFile>true</redirectTestOutputToFile>
<runOrder>alphabetical</runOrder> <runOrder>alphabetical</runOrder>
<systemPropertyVariables>
<alfresco.update.package>${project.artifactId}-${installer.version.name}.zip</alfresco.update.package>
<alfresco.contents.package>update-contents-${installer.version.name}.zip</alfresco.contents.package>
</systemPropertyVariables>
<excludes> <excludes>
<exclude>none</exclude> <exclude>none</exclude>
</excludes> </excludes>
<includes> <includes>
<include>**/*IntegrationTest.java</include> <include>**/*IntegrationTest.java</include>
</includes> </includes>
<systemPropertyVariables>
<alfresco.update.package.zip>${project.artifactId}-${installer.version.name}.zip</alfresco.update.package.zip>
<alfresco.update.package.tgz>${project.artifactId}-${installer.version.name}.tgz</alfresco.update.package.tgz>
<alfresco.target.dir>${project.build.directory}</alfresco.target.dir>
</systemPropertyVariables>
</configuration> </configuration>
</execution> </execution>
</executions> </executions>

View File

@@ -0,0 +1,5 @@
// ALFRESCO UPDATE ASSISTANT SCRIPT for 5.0
// update5-0.auas
DELETE /tomcat/endorsed/xalan-2.7.2.jar
DELETE /tomcat/endorsed/serializer-2.7.2.jar

View File

@@ -0,0 +1,4 @@
// ALFRESCO UPDATE ASSISTANT SCRIPT for 5.1
// update5-1.auas
// EMPTY AT THE MOMENT

View File

@@ -1,4 +1,10 @@
/*
* Copyright 2015-2015 Alfresco Software, Ltd. All rights reserved.
*
* License rights for this program may be obtained from Alfresco Software, Ltd.
* pursuant to a written agreement and any use of this program without such an
* agreement is prohibited.
*/
package org.alfresco.update.packaging; package org.alfresco.update.packaging;
import static org.junit.Assert.*; import static org.junit.Assert.*;
@@ -20,8 +26,7 @@ import org.junit.Test;
* <p> * <p>
* To run these tests in Eclipse, add the following to the "VM arguments" for the junit Run Configuration: * To run these tests in Eclipse, add the following to the "VM arguments" for the junit Run Configuration:
* <pre> * <pre>
* -Dalfresco.update.package=target/alfresco-enterprise-update-package-2015-1-EA-SNAPSHOT.zip * -Dalfresco.update.package.zip=target/alfresco-enterprise-update-package-2015-1-EA-SNAPSHOT.zip
* -Dalfresco.contents.package=target/update-contents-2015-1-EA-SNAPSHOT.zip
* </pre> * </pre>
* *
* ...or similar, depending on current version etc. There probably is a better way. * ...or similar, depending on current version etc. There probably is a better way.
@@ -31,18 +36,13 @@ import org.junit.Test;
public class PackagingIntegrationTest public class PackagingIntegrationTest
{ {
private File updatePackage; private File updatePackage;
private File contentsPackage;
@Before @Before
public void setUp() throws Exception public void setUp() throws Exception
{ {
String pkgName = System.getProperty("alfresco.update.package"); String pkgName = System.getProperty("alfresco.update.package.zip");
assertNotNull("Could not determine package name."); assertNotNull("Could not determine package name.", pkgName);
updatePackage = new File(pkgName); updatePackage = new File(pkgName);
String contentsPkgName = System.getProperty("alfresco.contents.package");
assertNotNull("Could not determine content package name.");
contentsPackage = new File(contentsPkgName);
} }
@Test @Test
@@ -51,30 +51,28 @@ public class PackagingIntegrationTest
// Check the package exists before we go any further // Check the package exists before we go any further
assertTrue("Update package does not exist.", updatePackage.exists()); assertTrue("Update package does not exist.", updatePackage.exists());
Set<String> paths = listFiles(updatePackage); Set<String> paths = listFiles(updatePackage);
assertTrue("too few paths in the update package", paths.size() > 3);
String firstPath = (String)paths.toArray()[0];
String dirs[] = firstPath.split("/");
// Are the binaries present? // Are the binaries present?
assertPathPresent(paths, "bin/alfresco-update-tool.jar"); assertPathPresent(paths, dirs[0] + "/lib/alfresco-update-tool.jar");
assertPathPresent(paths, "bin/apply_updates.sh"); assertPathPresent(paths, dirs[0] + "/apply_updates.sh");
assertPathPresent(paths, "bin/apply_updates.bat"); assertPathPresent(paths, dirs[0] + "/apply_updates.bat");
// Is the content sub-package present? // Is the content sub-package present?
assertPathPresent(paths, "update/"+contentsPackage.getName()); assertPathPresent(paths, dirs[0] + "/resources/war/alfresco.war");
} assertPathPresent(paths, dirs[0] + "/resources/war/share.war");
@Test
public void testContentsPackageStructureIsAsExpected() throws ZipException, IOException
{
// Check the package exists before we go any further
assertTrue("Contents package does not exist.", contentsPackage.exists());
Set<String> paths = listFiles(contentsPackage); // Is the mmt in the correct place ?
assertPathPresent(paths, dirs[0] + "/resources/distribution/common/bin/alfresco-mmt.jar");
assertPathPresent(paths, dirs[0] + "/resources/distribution/common/bin/alfresco-spring-encryptor.jar");
// Are the webapps present?
assertPathPresent(paths, "assets/web-server/webapps/alfresco.war");
assertPathPresent(paths, "assets/web-server/webapps/share.war");
} }
private void assertPathPresent(Set<String> pathsToCheck, String expectedPath) private void assertPathPresent(Set<String> pathsToCheck, String expectedPath)
{ {
assertTrue("Expected path to be present, but was not: "+expectedPath, assertTrue("Expected path to be present, but was not: "+expectedPath,
@@ -102,3 +100,4 @@ public class PackagingIntegrationTest
return paths; return paths;
} }
} }

View File

@@ -0,0 +1,47 @@
package org.alfresco.update.pkg.test;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import java.io.File;
import org.junit.Before;
/**
* Abstract base class for tests.
*
* @author Matt Ward
*/
public abstract class AbstractIntegrationTest
{
protected File targetDir;
@Before
public void setUp() throws Exception
{
initTargetDir();
}
private void initTargetDir()
{
String targetDir = System.getProperty("alfresco.target.dir");
if (targetDir == null)
{
targetDir = "./target"; // test needs to be run in target dir.
}
this.targetDir = new File(targetDir);
assertTrue("target dir does not exist :" + targetDir, this.targetDir.exists());
}
protected boolean runningOnWindows()
{
String os = System.getProperty("os.name").toLowerCase();
if (os.contains("windows"))
{
return true;
}
return false;
}
}

View File

@@ -0,0 +1,74 @@
/*
* Copyright 2005-2015 Alfresco Software, Ltd. All rights reserved.
*
* License rights for this program may be obtained from Alfresco Software, Ltd.
* pursuant to a written agreement and any use of this program without such an
* agreement is prohibited.
*/
package org.alfresco.update.pkg.test;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.assertNotNull;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Enumeration;
import org.apache.commons.compress.archivers.ArchiveException;
import org.apache.commons.compress.archivers.zip.ZipArchiveEntry;
import org.apache.commons.compress.archivers.zip.ZipFile;
import org.apache.commons.compress.compressors.CompressorException;
import org.junit.Before;
import org.junit.Test;
/**
* Tests for the tgz format packaging.
*
* To run these tests in Eclipse, add the following to the "VM arguments" for the junit Run Configuration:
* <pre>
* -Dalfresco.update.package.zip=target/alfresco-enterprise-update-package-2015-1-EA-SNAPSHOT.zip
* </pre>
*
* @author Matt Ward
*/
public class ZipFormatIntegrationTest extends AbstractIntegrationTest
{
File updatePackage;
@Before
public void setUp() throws Exception
{
super.setUp();
String pkgName = System.getProperty("alfresco.update.package.zip");
assertNotNull("Could not determine package name.", pkgName);
updatePackage = new File(pkgName);
}
@Test
public void applyUpdatesScriptHasExecutableBitsSet() throws FileNotFoundException, ArchiveException, IOException, CompressorException
{
assertTrue("File does not exist: "+ updatePackage, updatePackage.exists());
try (ZipFile zipFile = new ZipFile(updatePackage))
{
Enumeration<ZipArchiveEntry> e = zipFile.getEntries();
boolean found = false;
while (!found && e.hasMoreElements())
{
ZipArchiveEntry entry = e.nextElement();
File f = new File(entry.getName());
if (f.getName().equalsIgnoreCase("apply_updates.sh"))
{
found = true;
System.out.println("Found the unix shell wrapper script.");
final int expectedPerms = 0755;
// Other bits may be set, but check 755 octal are set.
System.out.println("File has permissions: "+Integer.toString(entry.getUnixMode(), 8));
assertEquals(expectedPerms, entry.getUnixMode() & expectedPerms);
}
}
}
}
}

View File

@@ -82,6 +82,7 @@
<module>enterprise-distribution</module> <module>enterprise-distribution</module>
<module>enterprise-update</module> <module>enterprise-update</module>
<module>enterprise-installer</module> <module>enterprise-installer</module>
<module>enterprise-update-test</module>
</modules> </modules>
</profile> </profile>
<profile> <profile>