diff --git a/.gitignore b/.gitignore
index b8d1c59..8c7c6b8 100644
--- a/.gitignore
+++ b/.gitignore
@@ -73,6 +73,7 @@ local.properties
### Maven ###
target/
+report/
pom.xml.tag
pom.xml.releaseBackup
pom.xml.versionsBackup
diff --git a/COPYRIGHT b/COPYRIGHT
new file mode 100644
index 0000000..d7eb3f1
--- /dev/null
+++ b/COPYRIGHT
@@ -0,0 +1,17 @@
+
+ Copyright (c) 2018-2019 Linagora
+
+ This program/library is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation, either version 2.1 of the License, or (at your
+ option) any later version.
+
+ This program/library is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program/library; If not, see http://www.gnu.org/licenses/
+ for the GNU Lesser General Public License version 2.1.
+
\ No newline at end of file
diff --git a/LICENSE b/LICENSE
index 0a04128..60d7ac2 100644
--- a/LICENSE
+++ b/LICENSE
@@ -1,165 +1,502 @@
- GNU LESSER GENERAL PUBLIC LICENSE
- Version 3, 29 June 2007
+ GNU LESSER GENERAL PUBLIC LICENSE
+ Version 2.1, February 1999
- Copyright (C) 2007 Free Software Foundation, Inc.
+ Copyright (C) 1991, 1999 Free Software Foundation, Inc.
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
-
- This version of the GNU Lesser General Public License incorporates
-the terms and conditions of version 3 of the GNU General Public
-License, supplemented by the additional permissions listed below.
-
- 0. Additional Definitions.
-
- As used herein, "this License" refers to version 3 of the GNU Lesser
-General Public License, and the "GNU GPL" refers to version 3 of the GNU
-General Public License.
-
- "The Library" refers to a covered work governed by this License,
-other than an Application or a Combined Work as defined below.
-
- An "Application" is any work that makes use of an interface provided
-by the Library, but which is not otherwise based on the Library.
-Defining a subclass of a class defined by the Library is deemed a mode
-of using an interface provided by the Library.
-
- A "Combined Work" is a work produced by combining or linking an
-Application with the Library. The particular version of the Library
-with which the Combined Work was made is also called the "Linked
-Version".
-
- The "Minimal Corresponding Source" for a Combined Work means the
-Corresponding Source for the Combined Work, excluding any source code
-for portions of the Combined Work that, considered in isolation, are
-based on the Application, and not on the Linked Version.
-
- The "Corresponding Application Code" for a Combined Work means the
-object code and/or source code for the Application, including any data
-and utility programs needed for reproducing the Combined Work from the
-Application, but excluding the System Libraries of the Combined Work.
-
- 1. Exception to Section 3 of the GNU GPL.
-
- You may convey a covered work under sections 3 and 4 of this License
-without being bound by section 3 of the GNU GPL.
-
- 2. Conveying Modified Versions.
-
- If you modify a copy of the Library, and, in your modifications, a
-facility refers to a function or data to be supplied by an Application
-that uses the facility (other than as an argument passed when the
-facility is invoked), then you may convey a copy of the modified
-version:
-
- a) under this License, provided that you make a good faith effort to
- ensure that, in the event an Application does not supply the
- function or data, the facility still operates, and performs
- whatever part of its purpose remains meaningful, or
-
- b) under the GNU GPL, with none of the additional permissions of
- this License applicable to that copy.
-
- 3. Object Code Incorporating Material from Library Header Files.
-
- The object code form of an Application may incorporate material from
-a header file that is part of the Library. You may convey such object
-code under terms of your choice, provided that, if the incorporated
-material is not limited to numerical parameters, data structure
-layouts and accessors, or small macros, inline functions and templates
-(ten or fewer lines in length), you do both of the following:
-
- a) Give prominent notice with each copy of the object code that the
- Library is used in it and that the Library and its use are
- covered by this License.
-
- b) Accompany the object code with a copy of the GNU GPL and this license
- document.
-
- 4. Combined Works.
-
- You may convey a Combined Work under terms of your choice that,
-taken together, effectively do not restrict modification of the
-portions of the Library contained in the Combined Work and reverse
-engineering for debugging such modifications, if you also do each of
-the following:
-
- a) Give prominent notice with each copy of the Combined Work that
- the Library is used in it and that the Library and its use are
- covered by this License.
-
- b) Accompany the Combined Work with a copy of the GNU GPL and this license
- document.
-
- c) For a Combined Work that displays copyright notices during
- execution, include the copyright notice for the Library among
- these notices, as well as a reference directing the user to the
- copies of the GNU GPL and this license document.
-
- d) Do one of the following:
-
- 0) Convey the Minimal Corresponding Source under the terms of this
- License, and the Corresponding Application Code in a form
- suitable for, and under terms that permit, the user to
- recombine or relink the Application with a modified version of
- the Linked Version to produce a modified Combined Work, in the
- manner specified by section 6 of the GNU GPL for conveying
- Corresponding Source.
-
- 1) Use a suitable shared library mechanism for linking with the
- Library. A suitable mechanism is one that (a) uses at run time
- a copy of the Library already present on the user's computer
- system, and (b) will operate properly with a modified version
- of the Library that is interface-compatible with the Linked
- Version.
-
- e) Provide Installation Information, but only if you would otherwise
- be required to provide such information under section 6 of the
- GNU GPL, and only to the extent that such information is
- necessary to install and execute a modified version of the
- Combined Work produced by recombining or relinking the
- Application with a modified version of the Linked Version. (If
- you use option 4d0, the Installation Information must accompany
- the Minimal Corresponding Source and Corresponding Application
- Code. If you use option 4d1, you must provide the Installation
- Information in the manner specified by section 6 of the GNU GPL
- for conveying Corresponding Source.)
-
- 5. Combined Libraries.
-
- You may place library facilities that are a work based on the
-Library side by side in a single library together with other library
-facilities that are not Applications and are not covered by this
-License, and convey such a combined library under terms of your
-choice, if you do both of the following:
-
- a) Accompany the combined library with a copy of the same work based
- on the Library, uncombined with any other library facilities,
- conveyed under the terms of this License.
-
- b) Give prominent notice with the combined library that part of it
- is a work based on the Library, and explaining where to find the
- accompanying uncombined form of the same work.
-
- 6. Revised Versions of the GNU Lesser General Public License.
-
- The Free Software Foundation may publish revised and/or new versions
-of the GNU Lesser General Public License from time to time. Such new
-versions will be similar in spirit to the present version, but may
-differ in detail to address new problems or concerns.
-
- Each version is given a distinguishing version number. If the
-Library as you received it specifies that a certain numbered version
-of the GNU Lesser General Public License "or any later version"
-applies to it, you have the option of following the terms and
-conditions either of that published version or of any later version
-published by the Free Software Foundation. If the Library as you
-received it does not specify a version number of the GNU Lesser
-General Public License, you may choose any version of the GNU Lesser
-General Public License ever published by the Free Software Foundation.
-
- If the Library as you received it specifies that a proxy can decide
-whether future versions of the GNU Lesser General Public License shall
-apply, that proxy's public statement of acceptance of any version is
-permanent authorization for you to choose that version for the
+[This is the first released version of the Lesser GPL. It also counts
+ as the successor of the GNU Library Public License, version 2, hence
+ the version number 2.1.]
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+Licenses are intended to guarantee your freedom to share and change
+free software--to make sure the software is free for all its users.
+
+ This license, the Lesser General Public License, applies to some
+specially designated software packages--typically libraries--of the
+Free Software Foundation and other authors who decide to use it. You
+can use it too, but we suggest you first think carefully about whether
+this license or the ordinary General Public License is the better
+strategy to use in any particular case, based on the explanations below.
+
+ When we speak of free software, we are referring to freedom of use,
+not price. Our General Public Licenses are designed to make sure that
+you have the freedom to distribute copies of free software (and charge
+for this service if you wish); that you receive source code or can get
+it if you want it; that you can change the software and use pieces of
+it in new free programs; and that you are informed that you can do
+these things.
+
+ To protect your rights, we need to make restrictions that forbid
+distributors to deny you these rights or to ask you to surrender these
+rights. These restrictions translate to certain responsibilities for
+you if you distribute copies of the library or if you modify it.
+
+ For example, if you distribute copies of the library, whether gratis
+or for a fee, you must give the recipients all the rights that we gave
+you. You must make sure that they, too, receive or can get the source
+code. If you link other code with the library, you must provide
+complete object files to the recipients, so that they can relink them
+with the library after making changes to the library and recompiling
+it. And you must show them these terms so they know their rights.
+
+ We protect your rights with a two-step method: (1) we copyright the
+library, and (2) we offer you this license, which gives you legal
+permission to copy, distribute and/or modify the library.
+
+ To protect each distributor, we want to make it very clear that
+there is no warranty for the free library. Also, if the library is
+modified by someone else and passed on, the recipients should know
+that what they have is not the original version, so that the original
+author's reputation will not be affected by problems that might be
+introduced by others.
+
+ Finally, software patents pose a constant threat to the existence of
+any free program. We wish to make sure that a company cannot
+effectively restrict the users of a free program by obtaining a
+restrictive license from a patent holder. Therefore, we insist that
+any patent license obtained for a version of the library must be
+consistent with the full freedom of use specified in this license.
+
+ Most GNU software, including some libraries, is covered by the
+ordinary GNU General Public License. This license, the GNU Lesser
+General Public License, applies to certain designated libraries, and
+is quite different from the ordinary General Public License. We use
+this license for certain libraries in order to permit linking those
+libraries into non-free programs.
+
+ When a program is linked with a library, whether statically or using
+a shared library, the combination of the two is legally speaking a
+combined work, a derivative of the original library. The ordinary
+General Public License therefore permits such linking only if the
+entire combination fits its criteria of freedom. The Lesser General
+Public License permits more lax criteria for linking other code with
+the library.
+
+ We call this license the "Lesser" General Public License because it
+does Less to protect the user's freedom than the ordinary General
+Public License. It also provides other free software developers Less
+of an advantage over competing non-free programs. These disadvantages
+are the reason we use the ordinary General Public License for many
+libraries. However, the Lesser license provides advantages in certain
+special circumstances.
+
+ For example, on rare occasions, there may be a special need to
+encourage the widest possible use of a certain library, so that it becomes
+a de-facto standard. To achieve this, non-free programs must be
+allowed to use the library. A more frequent case is that a free
+library does the same job as widely used non-free libraries. In this
+case, there is little to gain by limiting the free library to free
+software only, so we use the Lesser General Public License.
+
+ In other cases, permission to use a particular library in non-free
+programs enables a greater number of people to use a large body of
+free software. For example, permission to use the GNU C Library in
+non-free programs enables many more people to use the whole GNU
+operating system, as well as its variant, the GNU/Linux operating
+system.
+
+ Although the Lesser General Public License is Less protective of the
+users' freedom, it does ensure that the user of a program that is
+linked with the Library has the freedom and the wherewithal to run
+that program using a modified version of the Library.
+
+ The precise terms and conditions for copying, distribution and
+modification follow. Pay close attention to the difference between a
+"work based on the library" and a "work that uses the library". The
+former contains code derived from the library, whereas the latter must
+be combined with the library in order to run.
+
+ GNU LESSER GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License Agreement applies to any software library or other
+program which contains a notice placed by the copyright holder or
+other authorized party saying it may be distributed under the terms of
+this Lesser General Public License (also called "this License").
+Each licensee is addressed as "you".
+
+ A "library" means a collection of software functions and/or data
+prepared so as to be conveniently linked with application programs
+(which use some of those functions and data) to form executables.
+
+ The "Library", below, refers to any such software library or work
+which has been distributed under these terms. A "work based on the
+Library" means either the Library or any derivative work under
+copyright law: that is to say, a work containing the Library or a
+portion of it, either verbatim or with modifications and/or translated
+straightforwardly into another language. (Hereinafter, translation is
+included without limitation in the term "modification".)
+
+ "Source code" for a work means the preferred form of the work for
+making modifications to it. For a library, complete source code means
+all the source code for all modules it contains, plus any associated
+interface definition files, plus the scripts used to control compilation
+and installation of the library.
+
+ Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running a program using the Library is not restricted, and output from
+such a program is covered only if its contents constitute a work based
+on the Library (independent of the use of the Library in a tool for
+writing it). Whether that is true depends on what the Library does
+and what the program that uses the Library does.
+
+ 1. You may copy and distribute verbatim copies of the Library's
+complete source code as you receive it, in any medium, provided that
+you conspicuously and appropriately publish on each copy an
+appropriate copyright notice and disclaimer of warranty; keep intact
+all the notices that refer to this License and to the absence of any
+warranty; and distribute a copy of this License along with the
Library.
+
+ You may charge a fee for the physical act of transferring a copy,
+and you may at your option offer warranty protection in exchange for a
+fee.
+
+ 2. You may modify your copy or copies of the Library or any portion
+of it, thus forming a work based on the Library, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) The modified work must itself be a software library.
+
+ b) You must cause the files modified to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ c) You must cause the whole of the work to be licensed at no
+ charge to all third parties under the terms of this License.
+
+ d) If a facility in the modified Library refers to a function or a
+ table of data to be supplied by an application program that uses
+ the facility, other than as an argument passed when the facility
+ is invoked, then you must make a good faith effort to ensure that,
+ in the event an application does not supply such function or
+ table, the facility still operates, and performs whatever part of
+ its purpose remains meaningful.
+
+ (For example, a function in a library to compute square roots has
+ a purpose that is entirely well-defined independent of the
+ application. Therefore, Subsection 2d requires that any
+ application-supplied function or table used by this function must
+ be optional: if the application does not supply it, the square
+ root function must still compute square roots.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Library,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Library, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote
+it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Library.
+
+In addition, mere aggregation of another work not based on the Library
+with the Library (or with a work based on the Library) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may opt to apply the terms of the ordinary GNU General Public
+License instead of this License to a given copy of the Library. To do
+this, you must alter all the notices that refer to this License, so
+that they refer to the ordinary GNU General Public License, version 2,
+instead of to this License. (If a newer version than version 2 of the
+ordinary GNU General Public License has appeared, then you can specify
+that version instead if you wish.) Do not make any other change in
+these notices.
+
+ Once this change is made in a given copy, it is irreversible for
+that copy, so the ordinary GNU General Public License applies to all
+subsequent copies and derivative works made from that copy.
+
+ This option is useful when you wish to copy part of the code of
+the Library into a program that is not a library.
+
+ 4. You may copy and distribute the Library (or a portion or
+derivative of it, under Section 2) in object code or executable form
+under the terms of Sections 1 and 2 above provided that you accompany
+it with the complete corresponding machine-readable source code, which
+must be distributed under the terms of Sections 1 and 2 above on a
+medium customarily used for software interchange.
+
+ If distribution of object code is made by offering access to copy
+from a designated place, then offering equivalent access to copy the
+source code from the same place satisfies the requirement to
+distribute the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 5. A program that contains no derivative of any portion of the
+Library, but is designed to work with the Library by being compiled or
+linked with it, is called a "work that uses the Library". Such a
+work, in isolation, is not a derivative work of the Library, and
+therefore falls outside the scope of this License.
+
+ However, linking a "work that uses the Library" with the Library
+creates an executable that is a derivative of the Library (because it
+contains portions of the Library), rather than a "work that uses the
+library". The executable is therefore covered by this License.
+Section 6 states terms for distribution of such executables.
+
+ When a "work that uses the Library" uses material from a header file
+that is part of the Library, the object code for the work may be a
+derivative work of the Library even though the source code is not.
+Whether this is true is especially significant if the work can be
+linked without the Library, or if the work is itself a library. The
+threshold for this to be true is not precisely defined by law.
+
+ If such an object file uses only numerical parameters, data
+structure layouts and accessors, and small macros and small inline
+functions (ten lines or less in length), then the use of the object
+file is unrestricted, regardless of whether it is legally a derivative
+work. (Executables containing this object code plus portions of the
+Library will still fall under Section 6.)
+
+ Otherwise, if the work is a derivative of the Library, you may
+distribute the object code for the work under the terms of Section 6.
+Any executables containing that work also fall under Section 6,
+whether or not they are linked directly with the Library itself.
+
+ 6. As an exception to the Sections above, you may also combine or
+link a "work that uses the Library" with the Library to produce a
+work containing portions of the Library, and distribute that work
+under terms of your choice, provided that the terms permit
+modification of the work for the customer's own use and reverse
+engineering for debugging such modifications.
+
+ You must give prominent notice with each copy of the work that the
+Library is used in it and that the Library and its use are covered by
+this License. You must supply a copy of this License. If the work
+during execution displays copyright notices, you must include the
+copyright notice for the Library among them, as well as a reference
+directing the user to the copy of this License. Also, you must do one
+of these things:
+
+ a) Accompany the work with the complete corresponding
+ machine-readable source code for the Library including whatever
+ changes were used in the work (which must be distributed under
+ Sections 1 and 2 above); and, if the work is an executable linked
+ with the Library, with the complete machine-readable "work that
+ uses the Library", as object code and/or source code, so that the
+ user can modify the Library and then relink to produce a modified
+ executable containing the modified Library. (It is understood
+ that the user who changes the contents of definitions files in the
+ Library will not necessarily be able to recompile the application
+ to use the modified definitions.)
+
+ b) Use a suitable shared library mechanism for linking with the
+ Library. A suitable mechanism is one that (1) uses at run time a
+ copy of the library already present on the user's computer system,
+ rather than copying library functions into the executable, and (2)
+ will operate properly with a modified version of the library, if
+ the user installs one, as long as the modified version is
+ interface-compatible with the version that the work was made with.
+
+ c) Accompany the work with a written offer, valid for at
+ least three years, to give the same user the materials
+ specified in Subsection 6a, above, for a charge no more
+ than the cost of performing this distribution.
+
+ d) If distribution of the work is made by offering access to copy
+ from a designated place, offer equivalent access to copy the above
+ specified materials from the same place.
+
+ e) Verify that the user has already received a copy of these
+ materials or that you have already sent this user a copy.
+
+ For an executable, the required form of the "work that uses the
+Library" must include any data and utility programs needed for
+reproducing the executable from it. However, as a special exception,
+the materials to be distributed need not include anything that is
+normally distributed (in either source or binary form) with the major
+components (compiler, kernel, and so on) of the operating system on
+which the executable runs, unless that component itself accompanies
+the executable.
+
+ It may happen that this requirement contradicts the license
+restrictions of other proprietary libraries that do not normally
+accompany the operating system. Such a contradiction means you cannot
+use both them and the Library together in an executable that you
+distribute.
+
+ 7. You may place library facilities that are a work based on the
+Library side-by-side in a single library together with other library
+facilities not covered by this License, and distribute such a combined
+library, provided that the separate distribution of the work based on
+the Library and of the other library facilities is otherwise
+permitted, and provided that you do these two things:
+
+ a) Accompany the combined library with a copy of the same work
+ based on the Library, uncombined with any other library
+ facilities. This must be distributed under the terms of the
+ Sections above.
+
+ b) Give prominent notice with the combined library of the fact
+ that part of it is a work based on the Library, and explaining
+ where to find the accompanying uncombined form of the same work.
+
+ 8. You may not copy, modify, sublicense, link with, or distribute
+the Library except as expressly provided under this License. Any
+attempt otherwise to copy, modify, sublicense, link with, or
+distribute the Library is void, and will automatically terminate your
+rights under this License. However, parties who have received copies,
+or rights, from you under this License will not have their licenses
+terminated so long as such parties remain in full compliance.
+
+ 9. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Library or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Library (or any work based on the
+Library), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Library or works based on it.
+
+ 10. Each time you redistribute the Library (or any work based on the
+Library), the recipient automatically receives a license from the
+original licensor to copy, distribute, link with or modify the Library
+subject to these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties with
+this License.
+
+ 11. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Library at all. For example, if a patent
+license would not permit royalty-free redistribution of the Library by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Library.
+
+If any portion of this section is held invalid or unenforceable under any
+particular circumstance, the balance of the section is intended to apply,
+and the section as a whole is intended to apply in other circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 12. If the distribution and/or use of the Library is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Library under this License may add
+an explicit geographical distribution limitation excluding those countries,
+so that distribution is permitted only in or among countries not thus
+excluded. In such case, this License incorporates the limitation as if
+written in the body of this License.
+
+ 13. The Free Software Foundation may publish revised and/or new
+versions of the Lesser General Public License from time to time.
+Such new versions will be similar in spirit to the present version,
+but may differ in detail to address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Library
+specifies a version number of this License which applies to it and
+"any later version", you have the option of following the terms and
+conditions either of that version or of any later version published by
+the Free Software Foundation. If the Library does not specify a
+license version number, you may choose any version ever published by
+the Free Software Foundation.
+
+ 14. If you wish to incorporate parts of the Library into other free
+programs whose distribution conditions are incompatible with these,
+write to the author to ask for permission. For software which is
+copyrighted by the Free Software Foundation, write to the Free
+Software Foundation; we sometimes make exceptions for this. Our
+decision will be guided by the two goals of preserving the free status
+of all derivatives of our free software and of promoting the sharing
+and reuse of software generally.
+
+ NO WARRANTY
+
+ 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
+WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
+EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
+OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
+KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
+LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
+THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
+WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
+AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
+FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
+CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
+LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
+RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
+FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
+SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Libraries
+
+ If you develop a new library, and you want it to be of the greatest
+possible use to the public, we recommend making it free software that
+everyone can redistribute and change. You can do so by permitting
+redistribution under these terms (or, alternatively, under the terms of the
+ordinary General Public License).
+
+ To apply these terms, attach the following notices to the library. It is
+safest to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least the
+"copyright" line and a pointer to where the full notice is found.
+
+
+ Copyright (C)
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+
+Also add information on how to contact you by electronic and paper mail.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the library, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the
+ library `Frob' (a library for tweaking knobs) written by James Random Hacker.
+
+ , 1 April 1990
+ Ty Coon, President of Vice
+
+That's all there is to it!
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
index 5f3ca7a..9d9a99f 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1,20 +1,122 @@
-
- 4.0.0
+
+
+
+ 4.0.0
- org.ow2.petals
- petals-esb-deployer
- 0.0.1-SNAPSHOT
- jar
+
+ org.ow2.petals
+ petals-client-tools-parent
+ 1.1.1-SNAPSHOT
+
- petals-esb-deployer
- https://doc.petalslink.com/display/petalscomponents/Petals+ESB+Deployer+1.0.0
+ org.ow2.petals
+ petals-esb-deployer
+ 0.0.1-SNAPSHOT
+ jar
-
- UTF-8
-
+ petals-esb-deployer
+ https://doc.petalslink.com/display/petalscomponents/Petals+ESB+Deployer+1.0.0
-
-
+
+
+ org.ow2.petals
+ petals-admin-api
+ 2.1.1-SNAPSHOT
+
+
+
+ junit
+ junit
+ test
+
+
+
+ org.ow2.petals
+ petals-admin-mock
+ 2.1.1-SNAPSHOT
+ test
+
+
+
+ org.ow2.petals
+ petals-jbi-descriptor
+ 2.4.0
+
+
+
+
+
+
+
+
+
+ commons-io
+ commons-io
+ 2.6
+
+
+
+
+
+ org.jvnet.jaxb2_commons
+ jaxb2-basics-runtime
+ 0.11.1
+
+
+
+
+
+
+ org.jvnet.jaxb2.maven2
+ maven-jaxb2-plugin
+
+ ${basedir}/src/main/resources/
+
+ topology-model.xsd
+ component-repository.xsd
+ service-unit-model.xsd
+ bus-model.xsd
+ model.xsd
+
+
+ binding.xjb
+
+
+
+
+
diff --git a/src/main/java/org/ow2/petals/deployer/runtimemodel/RuntimeComponent.java b/src/main/java/org/ow2/petals/deployer/runtimemodel/RuntimeComponent.java
new file mode 100644
index 0000000..c8fc2a5
--- /dev/null
+++ b/src/main/java/org/ow2/petals/deployer/runtimemodel/RuntimeComponent.java
@@ -0,0 +1,62 @@
+/**
+ * Copyright (c) 2018-2019 Linagora
+ *
+ * This program/library is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * This program/library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program/library; If not, see http://www.gnu.org/licenses/
+ * for the GNU Lesser General Public License version 2.1.
+ */
+
+package org.ow2.petals.deployer.runtimemodel;
+
+import java.net.URL;
+
+public class RuntimeComponent {
+ private final String id;
+
+ private URL url;
+
+ public RuntimeComponent(final String id) {
+ this.id = id;
+ }
+
+ public RuntimeComponent(final String id, final URL url) {
+ this(id);
+ this.url = url;
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public URL getUrl() {
+ return url;
+ }
+
+ public void setUrl(final URL url) {
+ this.url = url;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (!(obj instanceof RuntimeComponent)) {
+ return false;
+ }
+
+ return id.equals(((RuntimeComponent) obj).id);
+ }
+
+ @Override
+ public int hashCode() {
+ return id.hashCode();
+ }
+}
diff --git a/src/main/java/org/ow2/petals/deployer/runtimemodel/RuntimeContainer.java b/src/main/java/org/ow2/petals/deployer/runtimemodel/RuntimeContainer.java
new file mode 100644
index 0000000..4d10778
--- /dev/null
+++ b/src/main/java/org/ow2/petals/deployer/runtimemodel/RuntimeContainer.java
@@ -0,0 +1,117 @@
+/**
+ * Copyright (c) 2018-2019 Linagora
+ *
+ * This program/library is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * This program/library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program/library; If not, see http://www.gnu.org/licenses/
+ * for the GNU Lesser General Public License version 2.1.
+ */
+
+package org.ow2.petals.deployer.runtimemodel;
+
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.ow2.petals.deployer.runtimemodel.RuntimeModel.RuntimeModelException;
+
+public class RuntimeContainer {
+
+ private final String id;
+
+ private int port;
+
+ private String user;
+
+ private String password;
+
+ private String hostname;
+
+ private Map serviceUnits = new HashMap();
+
+ private Map components = new HashMap();
+
+ public RuntimeContainer(final String id, final int port, final String user, final String password,
+ final String hostname) {
+ this.id = id;
+ this.port = port;
+ this.user = user;
+ this.password = password;
+ this.hostname = hostname;
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public int getPort() {
+ return port;
+ }
+
+ public String getUser() {
+ return user;
+ }
+
+ public String getPassword() {
+ return password;
+ }
+
+ public String getHostname() {
+ return hostname;
+ }
+
+ public void setHostname(final String hostname) {
+ this.hostname = hostname;
+ }
+
+ public RuntimeServiceUnit getServiceUnit(final String id) {
+ return serviceUnits.get(id);
+ }
+
+ public void addServiceUnit(final RuntimeServiceUnit serviceUnit) throws RuntimeModelException {
+ if (serviceUnits.put(serviceUnit.getId(), serviceUnit) != null) {
+ throw new RuntimeModelException("Service unit " + serviceUnit.getId() + " is already in the list");
+ }
+ }
+
+ public Collection getServiceUnits() {
+ return serviceUnits.values();
+ }
+
+ public void addComponent(final RuntimeComponent component) throws RuntimeModelException {
+ if (components.put(component.getId(), component) != null) {
+ throw new RuntimeModelException("Component " + component.getId() + " is already in the list");
+ }
+ }
+
+ public RuntimeComponent getComponent(final String id) {
+ return components.get(id);
+ }
+
+ public Collection getComponents() {
+ return components.values();
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (!(obj instanceof RuntimeContainer)) {
+ return false;
+ }
+
+ return id.equals(((RuntimeContainer) obj).id);
+ }
+
+ @Override
+ public int hashCode() {
+ return id.hashCode();
+ }
+}
diff --git a/src/main/java/org/ow2/petals/deployer/runtimemodel/RuntimeModel.java b/src/main/java/org/ow2/petals/deployer/runtimemodel/RuntimeModel.java
new file mode 100644
index 0000000..da9c02e
--- /dev/null
+++ b/src/main/java/org/ow2/petals/deployer/runtimemodel/RuntimeModel.java
@@ -0,0 +1,50 @@
+/**
+ * Copyright (c) 2018-2019 Linagora
+ *
+ * This program/library is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * This program/library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program/library; If not, see http://www.gnu.org/licenses/
+ * for the GNU Lesser General Public License version 2.1.
+ */
+
+package org.ow2.petals.deployer.runtimemodel;
+
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
+
+public class RuntimeModel {
+
+ private Map containers = new HashMap();
+
+ public void addContainer(final RuntimeContainer container) throws RuntimeModelException {
+ if (containers.put(container.getId(), container) != null) {
+ throw new RuntimeModelException("Container " + container.getId() + " is already in the list");
+ }
+ }
+
+ public RuntimeContainer getContainer(final String id) {
+ return containers.get(id);
+ }
+
+ public Collection getContainers() {
+ return containers.values();
+ }
+
+ public static class RuntimeModelException extends Exception {
+ private static final long serialVersionUID = -4775138643228668670L;
+
+ public RuntimeModelException(String message) {
+ super(message);
+ }
+ }
+}
diff --git a/src/main/java/org/ow2/petals/deployer/runtimemodel/RuntimeServiceUnit.java b/src/main/java/org/ow2/petals/deployer/runtimemodel/RuntimeServiceUnit.java
new file mode 100644
index 0000000..1723ea2
--- /dev/null
+++ b/src/main/java/org/ow2/petals/deployer/runtimemodel/RuntimeServiceUnit.java
@@ -0,0 +1,63 @@
+/**
+ * Copyright (c) 2018-2019 Linagora
+ *
+ * This program/library is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * This program/library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program/library; If not, see http://www.gnu.org/licenses/
+ * for the GNU Lesser General Public License version 2.1.
+ */
+
+package org.ow2.petals.deployer.runtimemodel;
+
+import java.net.URL;
+
+public class RuntimeServiceUnit {
+
+ private final String id;
+
+ private URL url;
+
+ public RuntimeServiceUnit(final String id) {
+ this.id = id;
+ }
+
+ public RuntimeServiceUnit(final String id, final URL url) {
+ this(id);
+ this.url = url;
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public URL getUrl() {
+ return url;
+ }
+
+ public void setUrl(final URL url) {
+ this.url = url;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (!(obj instanceof RuntimeServiceUnit)) {
+ return false;
+ }
+
+ return id.equals(((RuntimeServiceUnit) obj).id);
+ }
+
+ @Override
+ public int hashCode() {
+ return id.hashCode();
+ }
+}
diff --git a/src/main/java/org/ow2/petals/deployer/utils/ModelComparator.java b/src/main/java/org/ow2/petals/deployer/utils/ModelComparator.java
new file mode 100644
index 0000000..976b16a
--- /dev/null
+++ b/src/main/java/org/ow2/petals/deployer/utils/ModelComparator.java
@@ -0,0 +1,233 @@
+/**
+ * Copyright (c) 2018-2019 Linagora
+ *
+ * This program/library is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * This program/library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program/library; If not, see http://www.gnu.org/licenses/
+ * for the GNU Lesser General Public License version 2.1.
+ */
+
+package org.ow2.petals.deployer.utils;
+
+import java.util.Collection;
+
+import org.ow2.petals.deployer.runtimemodel.RuntimeComponent;
+import org.ow2.petals.deployer.runtimemodel.RuntimeContainer;
+import org.ow2.petals.deployer.runtimemodel.RuntimeModel;
+import org.ow2.petals.deployer.runtimemodel.RuntimeServiceUnit;
+
+public class ModelComparator {
+ public boolean compareRuntimeModels(final RuntimeModel m1, final RuntimeModel m2) {
+ return compareRuntimeContainerMaps(m1, m2);
+ }
+
+ private boolean compareRuntimeComponentMaps(RuntimeContainer cont1, RuntimeContainer cont2) {
+ Collection compList1 = cont1.getComponents();
+ Collection compList2 = cont2.getComponents();
+
+ for (RuntimeComponent comp1 : compList1) {
+ RuntimeComponent comp2 = cont1.getComponent(comp1.getId());
+ if (comp2 == null || !compareRuntimeComponents(comp1, comp2)) {
+ return false;
+ }
+ }
+
+ for (RuntimeComponent comp2 : compList2) {
+ if (cont2.getComponent(comp2.getId()) == null) {
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ private boolean compareRuntimeContainerMaps(RuntimeModel m1, RuntimeModel m2) {
+ Collection contList1 = m1.getContainers();
+ Collection contList2 = m2.getContainers();
+
+ for (RuntimeContainer cont1 : contList1) {
+ RuntimeContainer cont2 = m1.getContainer(cont1.getId());
+ if (cont2 == null || !compareRuntimeContainers(cont1, cont2)) {
+ return false;
+ }
+ }
+
+ for (RuntimeContainer cont2 : contList2) {
+ if (m2.getContainer(cont2.getId()) == null) {
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ private boolean compareRuntimeContainers(RuntimeContainer cont1, RuntimeContainer cont2) {
+ return cont1.getId().equals(cont2.getId()) && cont1.getPort() == cont2.getPort()
+ && cont1.getUser().equals(cont2.getUser()) && cont1.getPassword().equals(cont2.getPassword())
+ && cont1.getHostname().equals(cont2.getHostname()) && compareRuntimeServiceUnitMaps(cont1, cont2)
+ && compareRuntimeComponentMaps(cont1, cont2);
+ }
+
+ private boolean compareRuntimeServiceUnitMaps(RuntimeContainer cont1, RuntimeContainer cont2) {
+ Collection suList1 = cont1.getServiceUnits();
+ Collection suList2 = cont2.getServiceUnits();
+
+ for (RuntimeServiceUnit su1 : suList1) {
+ RuntimeServiceUnit su2 = cont1.getServiceUnit(su1.getId());
+ if (su2 == null || !compareRuntimeServiceUnits(su1, su2)) {
+ return false;
+ }
+ }
+
+ for (RuntimeServiceUnit su2 : suList2) {
+ if (cont2.getServiceUnit(su2.getId()) == null) {
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ private boolean compareRuntimeServiceUnits(RuntimeServiceUnit su1, RuntimeServiceUnit su2) {
+ return su1.getId().equals(su2.getId());
+ }
+
+ private boolean compareRuntimeComponents(RuntimeComponent comp1, RuntimeComponent comp2) {
+ return comp1.getId().equals(comp2.getId());
+ }
+
+// public boolean compareModels(final Model m1, final Model m2) {
+// Bus bus1 = m1.getBusModel().getBuses().get(0);
+// Bus bus2 = m2.getBusModel().getBuses().get(0);
+// ContainerInstance contInst1 = bus1.getTopologyInstance().getContainerInstances().get(0);
+// ContainerInstance contInst2 = bus2.getTopologyInstance().getContainerInstances().get(0);
+//
+// if (!compareContainerInstances(contInst1, contInst2)) {
+// return false;
+// }
+//
+// return true;
+// }
+//
+// public boolean compareServiceUnitInstanceLists(final List suInstances1,
+// final List suInstances2) {
+//
+// if (suInstances1.size() != suInstances2.size()) {
+// return false;
+// }
+//
+// // Check unicity and build map of suInstances1
+// Map suInstById1 = new HashMap();
+// for (ServiceUnitInstance suInst : suInstances1) {
+// String suId = suInst.getReference();
+// if (suInstById1.containsKey(suId)) {
+// return false;
+// }
+// suInstById1.put(suId, suInst);
+// }
+//
+// // Check unicity of suInstances2 and compare its elements with suInstances1
+// Set suInstIds = new HashSet();
+// for (ServiceUnitInstance suInst : suInstances2) {
+// String suId = suInst.getReference();
+// if (!suInstIds.add(suId) || !compareServiceUnitInstances(suInst, suInstById1.get(suId))) {
+// return false;
+// }
+// }
+//
+// return true;
+// }
+//
+// public boolean compareComponentInstanceLists(final List compInstances1,
+// final List compInstances2) {
+//
+// if (compInstances1.size() != compInstances2.size()) {
+// return false;
+// }
+//
+// // Check unicity and build map of compInstances1
+// Map compInstById1 = new HashMap();
+// for (ComponentInstance compInst : compInstances1) {
+// String compInstId = compInst.getReference();
+// if (compInstById1.containsKey(compInstId)) {
+// return false;
+// }
+// compInstById1.put(compInstId, compInst);
+// }
+//
+// // Check unicity of compInstances2 and compare its elements with compInstances1
+// Set compInstIds = new HashSet();
+// for (ComponentInstance compInst : compInstances2) {
+// String compInstId = compInst.getReference();
+// if (!compInstIds.add(compInstId) || !compareComponentsInstances(compInst, compInstById1.get(compInstId))) {
+// return false;
+// }
+// }
+//
+// return true;
+// }
+//
+// /**
+// * m1 and m2 must be both instances of {@link ProvisionedMachine}
+// *
+// * @param m1
+// * @param m2
+// * @return false if m1 and m2 are different
+// */
+// public boolean compareMachines(Machine m1, Machine m2) {
+// return m1 instanceof ProvisionedMachine && m2 instanceof ProvisionedMachine
+// && ((ProvisionedMachine) m1).getHostname().equals(((ProvisionedMachine) m2).getHostname());
+// }
+//
+// /**
+// * We only compare container instances, their getters will fetch data from their reference {@link Container}.
+// *
+// * @param ci1
+// * @param ci2
+// * @return false if ci1 and ci2 are different
+// */
+// public boolean compareContainerInstances(final ContainerInstance ci1, final ContainerInstance ci2) {
+// return ci1.getReference().equals(ci2.getReference()) && ci1.getJmxUser().equals(ci2.getJmxUser())
+// && ci1.getJmxPort().equals(ci2.getJmxPort()) && ci1.getJmxPassword().equals(ci2.getJmxPassword())
+// && compareServiceUnitInstanceLists(ci1.getServiceUnitInstances(), ci2.getServiceUnitInstances())
+// && compareComponentInstanceLists(ci1.getComponentInstances(), ci2.getComponentInstances());
+// }
+//
+// public boolean compareServiceUnitInstances(final ServiceUnitInstance sui1, final ServiceUnitInstance sui2) {
+// return sui1.getContainerInstanceReference().equals(sui2.getContainerInstanceReference())
+// && sui1.getReference().equals(sui2.getReference());
+// }
+//
+// /**
+// * @param su1
+// * @param su2
+// * @return false if su1 and su2 are different
+// */
+// public boolean compareServiceUnits(final ServiceUnit su1, final ServiceUnit su2) {
+// return su1.getId().equals(su2.getId()) && su1.getTargetComponent().equals(su2.getTargetComponent());
+// }
+//
+// public boolean compareComponentsInstances(final ComponentInstance ci1, final ComponentInstance ci2) {
+// return ci1.getReference().equals(ci2.getReference()) && ci1.getReference().equals(ci2.getReference());
+// }
+//
+// /**
+// * The urls are not compared, because we cannot set them when exporting model from a running Petals.
+// *
+// * @param c1
+// * @param c2
+// * @return false if c1 and c2 are different
+// */
+// public boolean compareComponents(final Component c1, final Component c2) {
+// return c1.getId().equals(c2.getId());
+// }
+}
diff --git a/src/main/java/org/ow2/petals/deployer/utils/ModelConverter.java b/src/main/java/org/ow2/petals/deployer/utils/ModelConverter.java
new file mode 100644
index 0000000..ef8ea47
--- /dev/null
+++ b/src/main/java/org/ow2/petals/deployer/utils/ModelConverter.java
@@ -0,0 +1,99 @@
+/**
+ * Copyright (c) 2018-2019 Linagora
+ *
+ * This program/library is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * This program/library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program/library; If not, see http://www.gnu.org/licenses/
+ * for the GNU Lesser General Public License version 2.1.
+ */
+
+package org.ow2.petals.deployer.utils;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.ow2.petals.deployer.model.bus.xml._1.BusModel;
+import org.ow2.petals.deployer.model.bus.xml._1.ComponentInstance;
+import org.ow2.petals.deployer.model.bus.xml._1.ContainerInstance;
+import org.ow2.petals.deployer.model.bus.xml._1.ProvisionedMachine;
+import org.ow2.petals.deployer.model.bus.xml._1.ServiceUnitInstance;
+import org.ow2.petals.deployer.model.component_repository.xml._1.Component;
+import org.ow2.petals.deployer.model.component_repository.xml._1.ComponentRepository;
+import org.ow2.petals.deployer.model.service_unit.xml._1.ServiceUnit;
+import org.ow2.petals.deployer.model.service_unit.xml._1.ServiceUnitModel;
+import org.ow2.petals.deployer.model.topology.xml._1.Container;
+import org.ow2.petals.deployer.model.topology.xml._1.TopologyModel;
+import org.ow2.petals.deployer.model.xml._1.Model;
+import org.ow2.petals.deployer.runtimemodel.RuntimeComponent;
+import org.ow2.petals.deployer.runtimemodel.RuntimeContainer;
+import org.ow2.petals.deployer.runtimemodel.RuntimeModel;
+import org.ow2.petals.deployer.runtimemodel.RuntimeModel.RuntimeModelException;
+import org.ow2.petals.deployer.runtimemodel.RuntimeServiceUnit;
+
+public class ModelConverter {
+ public RuntimeModel convertModelToRuntimeModel(Model model) throws MalformedURLException, RuntimeModelException {
+ RuntimeModel runtimeModel = new RuntimeModel();
+
+ TopologyModel topoModel = model.getTopologyModel();
+
+ Container cont = topoModel.getTopology().get(0).getContainer().get(0);
+
+ BusModel busModel = model.getBusModel();
+
+ ContainerInstance contInst = busModel.getBus().get(0).getContainerInstance().get(0);
+
+ String contId = cont.getId();
+ String hostname = ((ProvisionedMachine) busModel.getMachine().get(0)).getHostname();
+ Integer contPort = contInst.getJmxPort();
+ if (contPort == null) {
+ contPort = cont.getDefaultJmxPort();
+ }
+ String contUser = contInst.getJmxUser();
+ if (contUser == null) {
+ contUser = cont.getDefaultJmxUser();
+ }
+ String contPassword = contInst.getJmxPassword();
+ if (contPassword == null) {
+ contPassword = cont.getDefaultJmxPassword();
+ }
+
+ RuntimeContainer runtimeCont = new RuntimeContainer(contId, contPort, contUser, contPassword, hostname);
+ runtimeModel.addContainer(runtimeCont);
+
+ ComponentRepository compRepo = model.getComponentRepository();
+ Map compById = new HashMap();
+ for (Component comp : compRepo.getComponent()) {
+ compById.put(comp.getId(), comp);
+ }
+ for (ComponentInstance compInst : contInst.getComponentInstance()) {
+ String compId = compInst.getRef();
+ Component compRef = compById.get(compId);
+ runtimeCont.addComponent(new RuntimeComponent(compId, new URL(compRef.getUrl())));
+ }
+
+ ServiceUnitModel suModel = model.getServiceUnitModel();
+
+ Map suById = new HashMap();
+ for (ServiceUnit su : suModel.getServiceUnit()) {
+ suById.put(su.getId(), su);
+ }
+ for (ServiceUnitInstance suInst : contInst.getServiceUnitInstance()) {
+ String suId = suInst.getRef();
+ ServiceUnit suRef = suById.get(suId);
+ runtimeCont.addServiceUnit(new RuntimeServiceUnit(suId, new URL(suRef.getUrl())));
+ }
+
+ return runtimeModel;
+ }
+}
diff --git a/src/main/java/org/ow2/petals/deployer/utils/ModelDeployerException.java b/src/main/java/org/ow2/petals/deployer/utils/ModelDeployerException.java
new file mode 100644
index 0000000..cfb63e1
--- /dev/null
+++ b/src/main/java/org/ow2/petals/deployer/utils/ModelDeployerException.java
@@ -0,0 +1,28 @@
+/**
+ * Copyright (c) 2018-2019 Linagora
+ *
+ * This program/library is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * This program/library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program/library; If not, see http://www.gnu.org/licenses/
+ * for the GNU Lesser General Public License version 2.1.
+ */
+
+package org.ow2.petals.deployer.utils;
+
+public class ModelDeployerException extends Exception {
+
+ private static final long serialVersionUID = -3352449083809006549L;
+
+ public ModelDeployerException(String message) {
+ super(message);
+ }
+}
diff --git a/src/main/java/org/ow2/petals/deployer/utils/ModelExporter.java b/src/main/java/org/ow2/petals/deployer/utils/ModelExporter.java
new file mode 100644
index 0000000..bec2237
--- /dev/null
+++ b/src/main/java/org/ow2/petals/deployer/utils/ModelExporter.java
@@ -0,0 +1,95 @@
+/**
+ * Copyright (c) 2018-2019 Linagora
+ *
+ * This program/library is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * This program/library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program/library; If not, see http://www.gnu.org/licenses/
+ * for the GNU Lesser General Public License version 2.1.
+ */
+
+package org.ow2.petals.deployer.utils;
+
+import java.util.logging.Logger;
+
+import org.ow2.petals.admin.api.ArtifactAdministration;
+import org.ow2.petals.admin.api.ContainerAdministration;
+import org.ow2.petals.admin.api.PetalsAdministration;
+import org.ow2.petals.admin.api.PetalsAdministrationFactory;
+import org.ow2.petals.admin.api.artifact.Artifact;
+import org.ow2.petals.admin.api.exception.ArtifactAdministrationException;
+import org.ow2.petals.admin.api.exception.ContainerAdministrationException;
+import org.ow2.petals.admin.api.exception.DuplicatedServiceException;
+import org.ow2.petals.admin.api.exception.MissingServiceException;
+import org.ow2.petals.deployer.runtimemodel.RuntimeComponent;
+import org.ow2.petals.deployer.runtimemodel.RuntimeContainer;
+import org.ow2.petals.deployer.runtimemodel.RuntimeModel;
+import org.ow2.petals.deployer.runtimemodel.RuntimeModel.RuntimeModelException;
+import org.ow2.petals.deployer.runtimemodel.RuntimeServiceUnit;
+import org.ow2.petals.jbi.descriptor.JBIDescriptorException;
+
+public class ModelExporter {
+
+ private static final Logger LOG = Logger.getLogger(ModelExporter.class.getName());
+
+ private PetalsAdministration petalsAdmin;
+
+ private ContainerAdministration containerAdmin;
+
+ private ArtifactAdministration artifactAdmin;
+
+ public ModelExporter() throws DuplicatedServiceException, MissingServiceException, JBIDescriptorException {
+ this(PetalsAdministrationFactory.getInstance().newPetalsAdministrationAPI());
+ }
+
+ public ModelExporter(PetalsAdministration petalsAdmin) {
+ this.petalsAdmin = petalsAdmin;
+ containerAdmin = petalsAdmin.newContainerAdministration();
+ artifactAdmin = petalsAdmin.newArtifactAdministration();
+ }
+
+ public RuntimeModel exportRuntimeModel(final String hostname, final int port, final String user,
+ final String password)
+ throws RuntimeModelException, ArtifactAdministrationException, ContainerAdministrationException {
+ petalsAdmin.connect(hostname, port, user, password);
+
+ RuntimeModel model = new RuntimeModel();
+
+ RuntimeContainer cont = new RuntimeContainer(petalsAdmin.newContainerAdministration().getTopology(null, false)
+ .getContainers().get(0).getContainerName(), port, user, password, hostname);
+ model.addContainer(cont);
+
+ for (Artifact artifact : artifactAdmin.listArtifacts()) {
+ switch (artifact.getType()) {
+ case "BC":
+ case "SE":
+ cont.addComponent(
+ new RuntimeComponent(((org.ow2.petals.admin.api.artifact.Component) artifact).getName()));
+ break;
+ case "SU":
+ cont.addServiceUnit(new RuntimeServiceUnit(
+ ((org.ow2.petals.admin.api.artifact.ServiceUnit) artifact).getName()));
+ // TODO what about targetComponent
+ break;
+ case "SA":
+ // already get service units in "SU" case
+ break;
+ case "SL":
+ throw new UnsupportedOperationException(
+ "Export model with shared libraries is not implemented yet");
+ default:
+ LOG.warning("Unknown artifact type " + artifact.getType());
+ }
+ }
+
+ return model;
+ }
+}
diff --git a/src/main/java/org/ow2/petals/deployer/utils/ModelValidationException.java b/src/main/java/org/ow2/petals/deployer/utils/ModelValidationException.java
new file mode 100644
index 0000000..f9b4ccf
--- /dev/null
+++ b/src/main/java/org/ow2/petals/deployer/utils/ModelValidationException.java
@@ -0,0 +1,27 @@
+/**
+ * Copyright (c) 2018-2019 Linagora
+ *
+ * This program/library is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * This program/library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program/library; If not, see http://www.gnu.org/licenses/
+ * for the GNU Lesser General Public License version 2.1.
+ */
+
+package org.ow2.petals.deployer.utils;
+
+public class ModelValidationException extends Exception {
+ private static final long serialVersionUID = 5871650877543503924L;
+
+ public ModelValidationException(String message) {
+ super(message);
+ }
+}
diff --git a/src/main/java/org/ow2/petals/deployer/utils/ModelValidator.java b/src/main/java/org/ow2/petals/deployer/utils/ModelValidator.java
new file mode 100644
index 0000000..1fde404
--- /dev/null
+++ b/src/main/java/org/ow2/petals/deployer/utils/ModelValidator.java
@@ -0,0 +1,51 @@
+/**
+ * Copyright (c) 2018-2019 Linagora
+ *
+ * This program/library is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * This program/library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program/library; If not, see http://www.gnu.org/licenses/
+ * for the GNU Lesser General Public License version 2.1.
+ */
+
+package org.ow2.petals.deployer.utils;
+
+public class ModelValidator {
+
+ // public void validateServiceUnitModel(ServiceUnitModel model) throws ModelValidationException {
+ //
+ // List sus = model.getServiceUnits();
+ // if (sus.size() < 1) {
+ // throw new ModelValidationException("ServiceUnitModel must have 1 ServiceUnit minimum");
+ // }
+ //
+ // HashSet suIds = new HashSet();
+ // Map placeholders = new HashMap();
+ // for (ServiceUnit su : sus) {
+ // for (Map.Entry suPh : su.getPlaceholders().entrySet()) {
+ // if (placeholders.containsKey(suPh.getKey())) {
+ // String phDefaultValue = placeholders.get(suPh.getKey());
+ // if (suPh.getValue() == null && phDefaultValue != null
+ // || suPh.getValue() != null && !suPh.getValue().equals(phDefaultValue)) {
+ // throw new ModelValidationException("Placeholder with key " + suPh.getKey()
+ // + " is used on different ServiceUnit but its defaultValue differs.");
+ // }
+ // } else {
+ // placeholders.put(suPh.getKey(), suPh.getValue());
+ // }
+ //
+ // }
+ // if (!suIds.add(su.getId())) {
+ // throw new ModelValidationException("ServiceUnit id " + su.getId() + " is not unique");
+ // }
+ // }
+ // }
+}
diff --git a/src/main/java/org/ow2/petals/deployer/utils/RuntimeModelDeployer.java b/src/main/java/org/ow2/petals/deployer/utils/RuntimeModelDeployer.java
new file mode 100644
index 0000000..e3a3cad
--- /dev/null
+++ b/src/main/java/org/ow2/petals/deployer/utils/RuntimeModelDeployer.java
@@ -0,0 +1,171 @@
+/**
+ * Copyright (c) 2018-2019 Linagora
+ *
+ * This program/library is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * This program/library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program/library; If not, see http://www.gnu.org/licenses/
+ * for the GNU Lesser General Public License version 2.1.
+ */
+
+package org.ow2.petals.deployer.utils;
+
+import java.io.File;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.logging.Logger;
+
+import org.apache.commons.io.FileUtils;
+import org.ow2.petals.admin.api.PetalsAdministration;
+import org.ow2.petals.admin.api.PetalsAdministrationFactory;
+import org.ow2.petals.admin.api.artifact.Component.ComponentType;
+import org.ow2.petals.admin.api.artifact.lifecycle.ArtifactLifecycleFactory;
+import org.ow2.petals.admin.api.artifact.lifecycle.ComponentLifecycle;
+import org.ow2.petals.admin.api.artifact.lifecycle.ServiceAssemblyLifecycle;
+import org.ow2.petals.admin.api.exception.ArtifactAdministrationException;
+import org.ow2.petals.admin.api.exception.ArtifactDeployedException;
+import org.ow2.petals.admin.api.exception.ArtifactNotDeployedException;
+import org.ow2.petals.admin.api.exception.ArtifactNotFoundException;
+import org.ow2.petals.admin.api.exception.ArtifactStartedException;
+import org.ow2.petals.admin.api.exception.ConnectionFailedException;
+import org.ow2.petals.admin.api.exception.ContainerAdministrationException;
+import org.ow2.petals.admin.api.exception.DuplicatedServiceException;
+import org.ow2.petals.admin.api.exception.MissingServiceException;
+import org.ow2.petals.deployer.runtimemodel.RuntimeComponent;
+import org.ow2.petals.deployer.runtimemodel.RuntimeContainer;
+import org.ow2.petals.deployer.runtimemodel.RuntimeModel;
+import org.ow2.petals.deployer.runtimemodel.RuntimeServiceUnit;
+import org.ow2.petals.jbi.descriptor.JBIDescriptorException;
+import org.ow2.petals.jbi.descriptor.original.JBIDescriptorBuilder;
+import org.ow2.petals.jbi.descriptor.original.generated.Jbi;
+import org.ow2.petals.jbi.descriptor.original.generated.ServiceAssembly;
+
+public class RuntimeModelDeployer {
+
+ private static final Logger LOG = Logger.getLogger(RuntimeModelDeployer.class.getName());
+
+ private PetalsAdministration petalsAdmin;
+
+ private ArtifactLifecycleFactory artifactLifecycleFactory;
+
+ private JBIDescriptorBuilder jdb;
+
+ private HashSet deployedComponents = new HashSet();
+
+ private HashSet deployedServiceUnits = new HashSet();
+
+ public RuntimeModelDeployer() throws DuplicatedServiceException, MissingServiceException, JBIDescriptorException {
+ this(PetalsAdministrationFactory.getInstance().newPetalsAdministrationAPI(), null,
+ JBIDescriptorBuilder.getInstance());
+
+ }
+
+ public RuntimeModelDeployer(PetalsAdministration petalsAdmin, ArtifactLifecycleFactory artifactLifecycleFactory,
+ JBIDescriptorBuilder jdb) {
+ this.petalsAdmin = petalsAdmin;
+ this.artifactLifecycleFactory = artifactLifecycleFactory != null ? artifactLifecycleFactory
+ : petalsAdmin.newArtifactLifecycleFactory();
+ this.jdb = jdb;
+ }
+
+ public void deployRuntimeModel(RuntimeModel model)
+ throws ConnectionFailedException, ContainerAdministrationException, ArtifactStartedException,
+ ArtifactNotDeployedException, ArtifactNotFoundException, IOException, JBIDescriptorException,
+ ArtifactAdministrationException, ModelDeployerException {
+ RuntimeContainer container = model.getContainers().iterator().next();
+ Collection serviceUnits = container.getServiceUnits();
+
+ LOG.fine("Deploying model (" + serviceUnits.size() + " service units)");
+
+ String hostname = container.getHostname();
+ int port = container.getPort();
+ String user = container.getUser();
+ String password = container.getPassword();
+
+ petalsAdmin.connect(hostname, port, user, password);
+
+ for (RuntimeServiceUnit serviceUnit : serviceUnits) {
+ deployRuntimeServiceUnit(serviceUnit, model);
+ }
+
+ LOG.fine("Model deployed");
+ }
+
+ private void deployRuntimeServiceUnit(RuntimeServiceUnit serviceUnit, RuntimeModel model)
+ throws IOException, JBIDescriptorException, ArtifactStartedException, ArtifactNotDeployedException,
+ ArtifactNotFoundException, ArtifactAdministrationException, ModelDeployerException {
+ String suId = serviceUnit.getId();
+ File suFile = Files.createTempFile(suId, ".zip").toFile();
+ FileUtils.copyURLToFile(serviceUnit.getUrl(), suFile);
+ Jbi jbi = jdb.buildJavaJBIDescriptorFromArchive(suFile);
+ ServiceAssembly jbiSa = jbi.getServiceAssembly();
+
+ if (!deployedServiceUnits.contains(suId)) {
+ LOG.fine("Deploying service assembly");
+ for (org.ow2.petals.jbi.descriptor.original.generated.ServiceUnit jbiSu : jbiSa.getServiceUnit()) {
+ String compName = jbiSu.getTarget().getComponentName();
+ if (!deployedComponents.contains(compName)) {
+ RuntimeComponent component = model.getContainers().iterator().next().getComponent(compName);
+ if (component == null) {
+ throw new ModelDeployerException("Component " + compName + " (needed by service unit "
+ + jbiSu.getIdentification().getName() + ") not found");
+ }
+ deployRuntimeComponent(component);
+ deployedComponents.add(compName);
+ }
+ }
+ ServiceAssemblyLifecycle saLifecycle = artifactLifecycleFactory.createServiceAssemblyLifecycle(
+ new org.ow2.petals.admin.api.artifact.ServiceAssembly(jbiSa.getIdentification().getName()));
+ saLifecycle.deploy(suFile.toURI().toURL());
+ saLifecycle.start();
+ for (org.ow2.petals.jbi.descriptor.original.generated.ServiceUnit jbiSu : jbiSa.getServiceUnit()) {
+ String suName = jbiSu.getIdentification().getName();
+ if (!deployedServiceUnits.contains(suName)) {
+ deployedServiceUnits.add(suName);
+ LOG.fine("Service unit " + suName + " deployed and started");
+ } else {
+ throw new ModelDeployerException("Service unit " + suName + " already deployed");
+ }
+ }
+ }
+ }
+
+ private void deployRuntimeComponent(RuntimeComponent component)
+ throws IOException, JBIDescriptorException, ArtifactDeployedException, ArtifactAdministrationException {
+ String compId = component.getId();
+ File compFile = Files.createTempFile(compId, "zip").toFile();
+ FileUtils.copyURLToFile(component.getUrl(), compFile);
+ Jbi jbi = jdb.buildJavaJBIDescriptorFromArchive(compFile);
+
+ LOG.fine("Deploying component " + component.getId());
+ ComponentLifecycle compLifecycle = artifactLifecycleFactory
+ .createComponentLifecycle(new org.ow2.petals.admin.api.artifact.Component(compId,
+ convertComponentType(jbi.getComponent().getType())));
+
+ compLifecycle.deploy(compFile.toURI().toURL());
+ compLifecycle.start();
+ LOG.fine("Component " + compId + " deployed and started");
+ }
+
+ public ComponentType convertComponentType(
+ final org.ow2.petals.jbi.descriptor.original.generated.ComponentType jbiType) {
+ switch (jbiType) {
+ case BINDING_COMPONENT:
+ return ComponentType.BC;
+ case SERVICE_ENGINE:
+ return ComponentType.SE;
+ default:
+ return null;
+ }
+ }
+}
diff --git a/src/main/java/org/ow2/petals/deploymentmodel/busmodel/Bus.java b/src/main/java/org/ow2/petals/deploymentmodel/busmodel/Bus.java
deleted file mode 100644
index 0ba5f4a..0000000
--- a/src/main/java/org/ow2/petals/deploymentmodel/busmodel/Bus.java
+++ /dev/null
@@ -1,49 +0,0 @@
-package org.ow2.petals.deploymentmodel.busmodel;
-
-import java.util.List;
-
-/**
- * Class for Petals ESB bus to deploy
- *
- * @author alagane
- */
-public class Bus {
- /**
- * The service unit instances to deploy
- */
- private List serviceUnitInstances;
-
- /**
- * The component instances required by a service unit
- */
- private List componentInstances;
-
- /**
- * The topology instance associated to a topology defined in {@link org.ow2.petals.deploymentmodel.topologymodel.TopologyModel}.
- */
- private TopologyInstance topologyInstance;
-
- public List getServiceUnitInstances() {
- return serviceUnitInstances;
- }
-
- public void setServiceUnitInstances(final List serviceUnitInstances) {
- this.serviceUnitInstances = serviceUnitInstances;
- }
-
- public List getComponentInstances() {
- return componentInstances;
- }
-
- public void setComponentInstances(final List componentInstances) {
- this.componentInstances = componentInstances;
- }
-
- public TopologyInstance getTopologyInstance() {
- return topologyInstance;
- }
-
- public void setTopologyInstance(final TopologyInstance topologyInstance) {
- this.topologyInstance = topologyInstance;
- }
-}
diff --git a/src/main/java/org/ow2/petals/deploymentmodel/busmodel/BusModel.java b/src/main/java/org/ow2/petals/deploymentmodel/busmodel/BusModel.java
deleted file mode 100644
index 5fc91ce..0000000
--- a/src/main/java/org/ow2/petals/deploymentmodel/busmodel/BusModel.java
+++ /dev/null
@@ -1,58 +0,0 @@
-package org.ow2.petals.deploymentmodel.busmodel;
-
-import java.util.List;
-import java.util.Map;
-
-/**
- * This model defines your Petals ESB bus placing Petals ESB components on their containers:
- *
- * - service-unit on its Petals ESB container
- * - Petals ESB container on its machine
- * - Petals ESB Hazelcast Registry member on its machine.
- *
- * This model will be mainly written by the Petals ESB bus architect in agreement with operators.
- *
- * @author alagane
- */
-public class BusModel {
- /**
- * The list of Petals ESB busses to deploy.
- */
- private List buses;
-
- /**
- * The map of placeholder values required by all of the service units. The key of the map is the key of the
- * placeholder, and the value of the map is the value of the placeholder. Only keys declared in service unit models
- * can be used, and every key declared without a default value must have a value assigned in this map.
- */
- private Map placeholderValues;
-
- /**
- * The machines on which parts of a Petals ESB bus will be running.
- */
- private List machines;
-
- public List getBuses() {
- return buses;
- }
-
- public void setBuses(final List buses) {
- this.buses = buses;
- }
-
- public Map getPlaceholderValues() {
- return placeholderValues;
- }
-
- public void setPlaceholderValues(final Map placeholderValues) {
- this.placeholderValues = placeholderValues;
- }
-
- public List getMachines() {
- return machines;
- }
-
- public void setMachines(final List machines) {
- this.machines = machines;
- }
-}
diff --git a/src/main/java/org/ow2/petals/deploymentmodel/busmodel/ComponentInstance.java b/src/main/java/org/ow2/petals/deploymentmodel/busmodel/ComponentInstance.java
deleted file mode 100644
index 448bcae..0000000
--- a/src/main/java/org/ow2/petals/deploymentmodel/busmodel/ComponentInstance.java
+++ /dev/null
@@ -1,66 +0,0 @@
-package org.ow2.petals.deploymentmodel.busmodel;
-
-import java.util.List;
-import java.util.Map;
-
-import org.ow2.petals.deploymentmodel.componentrepository.Component;
-import org.ow2.petals.deploymentmodel.componentrepository.SharedLibrary;
-
-/**
- * Class describing an instance of a component defined in
- * {@link org.ow2.petals.deploymentmodel.componentrepository.ComponentRepository}.
- *
- * @author alagane
- */
-public class ComponentInstance {
- private String id;
-
- /**
- * Reference to a component from {@link org.ow2.petals.deploymentmodel.componentrepository.ComponentRepository}.
- */
- private Component reference;
-
- /**
- * The map of parameter values required by all of the service units. The key of the map is the name of the
- * parameter, and the value of the map is the value of the parameter. Only names declared in reference component can
- * be used, and every name declared without a default value must have a value assigned in this map.
- */
- private Map placeholderValues;
-
- /**
- * List of shared libraries in addition to these of the referenced component.
- */
- private List sharedLibraryReferences;
-
- public String getId() {
- return id;
- }
-
- public void setId(final String id) {
- this.id = id;
- }
-
- public Component getReference() {
- return reference;
- }
-
- public void setReference(final Component reference) {
- this.reference = reference;
- }
-
- public Map getPlaceholderValues() {
- return placeholderValues;
- }
-
- public void setPlaceholderValues(final Map placeholderValues) {
- this.placeholderValues = placeholderValues;
- }
-
- public List getSharedLibraryReferences() {
- return sharedLibraryReferences;
- }
-
- public void setSharedLibraryReferences(final List sharedLibraryReferences) {
- this.sharedLibraryReferences = sharedLibraryReferences;
- }
-}
diff --git a/src/main/java/org/ow2/petals/deploymentmodel/busmodel/ContainerInstance.java b/src/main/java/org/ow2/petals/deploymentmodel/busmodel/ContainerInstance.java
deleted file mode 100644
index e5fbfc7..0000000
--- a/src/main/java/org/ow2/petals/deploymentmodel/busmodel/ContainerInstance.java
+++ /dev/null
@@ -1,79 +0,0 @@
-package org.ow2.petals.deploymentmodel.busmodel;
-
-import org.ow2.petals.deploymentmodel.topologymodel.Container;
-
-/**
- * Class describing an instance of a container defined in
- * {@link org.ow2.petals.deploymentmodel.topologymodel.TopologyModel}.
- *
- * @author alagane
- */
-public class ContainerInstance {
- /**
- * Reference to a container from {@link org.ow2.petals.deploymentmodel.topologymodel.TopologyModel}.
- */
- private Container reference;
-
- /**
- * JMX port of the current Petals ESB container. A deployment property can be used. Each container (from topology
- * model) without a default JMX port must have one defined in this model.
- */
- private int jmxPort;
-
- /**
- * JMX username of the current Petals ESB container. A deployment property can be used. Each container (from
- * topology model) without a default JMX username must have one defined in this model.
- */
- private String jmxUser;
-
- /**
- * JMX password of the current Petals ESB container. A deployment property can be used. Each container (from
- * topology model) without a default JMX password must have one defined in this model.
- */
- private String jmxPassword;
-
- /**
- * The reference of the machine on which the container is running.
- */
- private Machine machineReference;
-
- public Container getReference() {
- return reference;
- }
-
- public void setReference(final Container reference) {
- this.reference = reference;
- }
-
- public int getJmxPort() {
- return jmxPort;
- }
-
- public void setJmxPort(final int jmxPort) {
- this.jmxPort = jmxPort;
- }
-
- public String getJmxUser() {
- return jmxUser;
- }
-
- public void setJmxUser(final String jmxUser) {
- this.jmxUser = jmxUser;
- }
-
- public String getJmxPassword() {
- return jmxPassword;
- }
-
- public void setJmxPassword(final String jmxPassword) {
- this.jmxPassword = jmxPassword;
- }
-
- public Machine getMachineReference() {
- return machineReference;
- }
-
- public void setMachineReference(final Machine machineReference) {
- this.machineReference = machineReference;
- }
-}
diff --git a/src/main/java/org/ow2/petals/deploymentmodel/busmodel/HazelcastRegistryInstance.java b/src/main/java/org/ow2/petals/deploymentmodel/busmodel/HazelcastRegistryInstance.java
deleted file mode 100644
index 76b361f..0000000
--- a/src/main/java/org/ow2/petals/deploymentmodel/busmodel/HazelcastRegistryInstance.java
+++ /dev/null
@@ -1,67 +0,0 @@
-package org.ow2.petals.deploymentmodel.busmodel;
-
-import java.util.List;
-
-import org.ow2.petals.deploymentmodel.topologymodel.HazelcastRegistry;
-
-/**
- * Class describing an Hazelcast Registry instance of a Petals ESB bus.
- *
- * @author alagane
- */
-public class HazelcastRegistryInstance extends RegistryInstance {
- /**
- * The reference of the Petals ESB Hazelcast Registry in
- * {@link org.ow2.petals.deploymentmodel.topologymodel.TopologyModel}.
- */
- private HazelcastRegistry reference;
-
- /**
- * Name identifying the Petals ESB Hazelcast Registry instance inside the Hazelcast cluster. A deployment property
- * can be used. Optional, if not set, the value defined by the referenced HazelcastRegistry will be used.
- */
- private String groupName;
-
- /**
- * Password identifying the Petals ESB Hazelcast Registry instance inside the Hazelcast cluster. A deployment
- * property can be used. Optional, if not set, the value defined by the referenced HazelcastRegistry will be used.
- */
- private String groupPassword;
-
- /**
- * List of member instances composing the current Petals ESB Hazelcast Registry instance.
- */
- private List memberInstances;
-
- public HazelcastRegistry getReference() {
- return reference;
- }
-
- public void setReference(final HazelcastRegistry reference) {
- this.reference = reference;
- }
-
- public String getGroupName() {
- return groupName;
- }
-
- public void setGroupName(final String groupName) {
- this.groupName = groupName;
- }
-
- public String getGroupPassword() {
- return groupPassword;
- }
-
- public void setGroupPassword(final String groupPassword) {
- this.groupPassword = groupPassword;
- }
-
- public List getMemberInstances() {
- return memberInstances;
- }
-
- public void setMemberInstances(final List memberInstances) {
- this.memberInstances = memberInstances;
- }
-}
diff --git a/src/main/java/org/ow2/petals/deploymentmodel/busmodel/HazelcastRegistryMemberInstance.java b/src/main/java/org/ow2/petals/deploymentmodel/busmodel/HazelcastRegistryMemberInstance.java
deleted file mode 100644
index 2363343..0000000
--- a/src/main/java/org/ow2/petals/deploymentmodel/busmodel/HazelcastRegistryMemberInstance.java
+++ /dev/null
@@ -1,51 +0,0 @@
-package org.ow2.petals.deploymentmodel.busmodel;
-
-import org.ow2.petals.deploymentmodel.topologymodel.HazelcastRegistryMember;
-
-/**
- * Class describing a member of a Petals ESB Hazelcast Registry instance.
- *
- * @author alagane
- */
-public class HazelcastRegistryMemberInstance {
- /**
- * The reference of the member of the Petals ESB Hazelcast Registry in
- * {@link org.ow2.petals.deploymentmodel.topologymodel.TopologyModel}.
- */
- private HazelcastRegistryMember reference;
-
- /**
- * The communication port of the member instance. A deployment property can be used. Optional, if not set, the value
- * defined by the referenced {@link HazelcastRegistryMember} will be used.
- */
- private String port;
-
- /**
- * The reference of the machine on which the current Petals ESB Hazelcast Registry is running.
- */
- private Machine machineReference;
-
- public HazelcastRegistryMember getReference() {
- return reference;
- }
-
- public void setReference(final HazelcastRegistryMember reference) {
- this.reference = reference;
- }
-
- public String getPort() {
- return port;
- }
-
- public void setPort(final String port) {
- this.port = port;
- }
-
- public Machine getMachineReference() {
- return machineReference;
- }
-
- public void setMachineReference(final Machine machineReference) {
- this.machineReference = machineReference;
- }
-}
diff --git a/src/main/java/org/ow2/petals/deploymentmodel/busmodel/Machine.java b/src/main/java/org/ow2/petals/deploymentmodel/busmodel/Machine.java
deleted file mode 100644
index 9e1dd6b..0000000
--- a/src/main/java/org/ow2/petals/deploymentmodel/busmodel/Machine.java
+++ /dev/null
@@ -1,21 +0,0 @@
-package org.ow2.petals.deploymentmodel.busmodel;
-
-/**
- * Superclass for different types of machines on which Petals ESB buses or Hazelcast registry members will be running.
- *
- * @author alagane
- */
-public abstract class Machine {
- /**
- * Identifier of the machine.
- */
- private String id;
-
- public String getId() {
- return id;
- }
-
- public void setId(final String id) {
- this.id = id;
- }
-}
diff --git a/src/main/java/org/ow2/petals/deploymentmodel/busmodel/ProvisionedMachine.java b/src/main/java/org/ow2/petals/deploymentmodel/busmodel/ProvisionedMachine.java
deleted file mode 100644
index 847cd17..0000000
--- a/src/main/java/org/ow2/petals/deploymentmodel/busmodel/ProvisionedMachine.java
+++ /dev/null
@@ -1,21 +0,0 @@
-package org.ow2.petals.deploymentmodel.busmodel;
-
-/**
- * Class describing physical or virtual machine.
- *
- * @author alagane
- */
-public class ProvisionedMachine extends Machine {
- /**
- * Hostname, IP address or deployment property name of the provisioned machine.
- */
- private String hostname;
-
- public String getHostname() {
- return hostname;
- }
-
- public void setHostname(final String hostname) {
- this.hostname = hostname;
- }
-}
diff --git a/src/main/java/org/ow2/petals/deploymentmodel/busmodel/RegistryInstance.java b/src/main/java/org/ow2/petals/deploymentmodel/busmodel/RegistryInstance.java
deleted file mode 100644
index 12c173c..0000000
--- a/src/main/java/org/ow2/petals/deploymentmodel/busmodel/RegistryInstance.java
+++ /dev/null
@@ -1,9 +0,0 @@
-package org.ow2.petals.deploymentmodel.busmodel;
-
-/**
- * Superclass for different types of registry instances.
- *
- * @author alagane
- */
-public abstract class RegistryInstance {
-}
diff --git a/src/main/java/org/ow2/petals/deploymentmodel/busmodel/ServiceUnitInstance.java b/src/main/java/org/ow2/petals/deploymentmodel/busmodel/ServiceUnitInstance.java
deleted file mode 100644
index 4ea8932..0000000
--- a/src/main/java/org/ow2/petals/deploymentmodel/busmodel/ServiceUnitInstance.java
+++ /dev/null
@@ -1,38 +0,0 @@
-package org.ow2.petals.deploymentmodel.busmodel;
-
-import java.awt.Container;
-
-import org.ow2.petals.deploymentmodel.serviceunitmodel.ServiceUnit;
-
-/**
- * Class for instance of a service unit running on a Petals ESB container
- *
- * @author alagane
- */
-public class ServiceUnitInstance {
- /**
- * Reference to a service-unit of the service-units object model
- */
- private ServiceUnit reference;
-
- /**
- * Reference to a container of the topology object model
- */
- private Container containerReference;
-
- public ServiceUnit getReference() {
- return reference;
- }
-
- public void setReference(final ServiceUnit reference) {
- this.reference = reference;
- }
-
- public Container getContainerReference() {
- return containerReference;
- }
-
- public void setContainerReference(final Container containerReference) {
- this.containerReference = containerReference;
- }
-}
diff --git a/src/main/java/org/ow2/petals/deploymentmodel/busmodel/StandaloneRegistryInstance.java b/src/main/java/org/ow2/petals/deploymentmodel/busmodel/StandaloneRegistryInstance.java
deleted file mode 100644
index 0df120d..0000000
--- a/src/main/java/org/ow2/petals/deploymentmodel/busmodel/StandaloneRegistryInstance.java
+++ /dev/null
@@ -1,20 +0,0 @@
-package org.ow2.petals.deploymentmodel.busmodel;
-
-import org.ow2.petals.deploymentmodel.topologymodel.StandaloneRegistry;
-
-/**
- * Instance of {@link org.ow2.petals.deploymentmodel.topologymodel.StandaloneRegistry}.
- *
- * @author alagane
- */
-public class StandaloneRegistryInstance extends RegistryInstance {
- private StandaloneRegistry reference;
-
- public StandaloneRegistry getReference() {
- return reference;
- }
-
- public void setReference(final StandaloneRegistry reference) {
- this.reference = reference;
- }
-}
diff --git a/src/main/java/org/ow2/petals/deploymentmodel/busmodel/TopologyInstance.java b/src/main/java/org/ow2/petals/deploymentmodel/busmodel/TopologyInstance.java
deleted file mode 100644
index e166fa3..0000000
--- a/src/main/java/org/ow2/petals/deploymentmodel/busmodel/TopologyInstance.java
+++ /dev/null
@@ -1,65 +0,0 @@
-package org.ow2.petals.deploymentmodel.busmodel;
-
-import java.util.List;
-
-import org.ow2.petals.deploymentmodel.topologymodel.Topology;
-
-/**
- * Class describing an instance of a topology in {@link org.ow2.petals.deploymentmodel.busmodel.BusModel}.
- *
- * @author alagane
- */
-public class TopologyInstance {
- /**
- * The reference topology from {@link org.ow2.petals.deploymentmodel.topologymodel.TopologyModel}.
- */
- private Topology reference;
-
- /**
- * Domain name of the Petals ESB bus. A deployment property can be used. It must be set if no default value is set
- * in its reference topology.
- */
- private String domainName;
-
- /**
- * The instances of registry to use in Topology.
- */
- private RegistryInstance registryInstance;
-
- /**
- * The instances of Petals ESB containers forming the Petals ESB bus.
- */
- private List containerInstances;
-
- public Topology getReference() {
- return reference;
- }
-
- public void setReference(final Topology reference) {
- this.reference = reference;
- }
-
- public String getDomainName() {
- return domainName;
- }
-
- public void setDomainName(final String domainName) {
- this.domainName = domainName;
- }
-
- public RegistryInstance getRegistryInstance() {
- return registryInstance;
- }
-
- public void setRegistryInstance(final RegistryInstance registryInstance) {
- this.registryInstance = registryInstance;
- }
-
- public List getContainerInstances() {
- return containerInstances;
- }
-
- public void setContainerInstances(final List containerInstances) {
- this.containerInstances = containerInstances;
- }
-}
diff --git a/src/main/java/org/ow2/petals/deploymentmodel/componentrepository/Component.java b/src/main/java/org/ow2/petals/deploymentmodel/componentrepository/Component.java
deleted file mode 100644
index 31981e2..0000000
--- a/src/main/java/org/ow2/petals/deploymentmodel/componentrepository/Component.java
+++ /dev/null
@@ -1,67 +0,0 @@
-package org.ow2.petals.deploymentmodel.componentrepository;
-
-import java.net.URI;
-import java.util.List;
-import java.util.Map;
-
-/**
- * Class describing a component artifact.
- *
- * @author alagane
- */
-public class Component {
- /**
- * The identifier of this component in the model. Must be the same than the one defined in the JBI descriptor of the
- * component.
- */
- private String id;
-
- /**
- * The URL of the associated archive.
- */
- private URI url;
-
- /**
- * The map of parameters required by the component. The key of the map is the name of the parameter, and the value
- * of the map is the default value of the parameter. If there is no default value, the value must be null.
- */
- private Map parameters;
-
- /**
- * A set of shared library references that the component requires. They reference shared libraries defined in the
- * model by their id. Optional.
- */
- private List sharedLibraryReferences;
-
- public String getId() {
- return id;
- }
-
- public void setId(final String id) {
- this.id = id;
- }
-
- public URI getUrl() {
- return url;
- }
-
- public void setUrl(final URI url) {
- this.url = url;
- }
-
- public Map getParameters() {
- return parameters;
- }
-
- public void setParameters(final Map parameters) {
- this.parameters = parameters;
- }
-
- public List getSharedLibraryReferences() {
- return sharedLibraryReferences;
- }
-
- public void setSharedLibraryReferences(final List sharedLibraryReferences) {
- this.sharedLibraryReferences = sharedLibraryReferences;
- }
-}
diff --git a/src/main/java/org/ow2/petals/deploymentmodel/componentrepository/ComponentRepository.java b/src/main/java/org/ow2/petals/deploymentmodel/componentrepository/ComponentRepository.java
deleted file mode 100644
index eefa775..0000000
--- a/src/main/java/org/ow2/petals/deploymentmodel/componentrepository/ComponentRepository.java
+++ /dev/null
@@ -1,39 +0,0 @@
-package org.ow2.petals.deploymentmodel.componentrepository;
-
-import java.util.List;
-
-/**
- * This model defines a set of binding components, service engines and shared libraries that can be used to perform the
- * deployment of a Petals ESB bus. Such models are included in Petals ESB distribution packs, and you can write your
- * own.
- *
- * @author alagane
- */
-public class ComponentRepository {
- /**
- * The list of components objects of this repository. Their id must be unique for all component repository models.
- */
- private List components;
-
- /**
- * The list of shared libraries of this repository. Optional. Their couple of id and version must be unique in the
- * model.
- */
- private List sharedLibraries;
-
- public List getComponents() {
- return components;
- }
-
- public void setComponents(final List components) {
- this.components = components;
- }
-
- public List getSharedLibraries() {
- return sharedLibraries;
- }
-
- public void setSharedLibraries(final List sharedLibraries) {
- this.sharedLibraries = sharedLibraries;
- }
-}
diff --git a/src/main/java/org/ow2/petals/deploymentmodel/componentrepository/SharedLibrary.java b/src/main/java/org/ow2/petals/deploymentmodel/componentrepository/SharedLibrary.java
deleted file mode 100644
index c508d18..0000000
--- a/src/main/java/org/ow2/petals/deploymentmodel/componentrepository/SharedLibrary.java
+++ /dev/null
@@ -1,51 +0,0 @@
-package org.ow2.petals.deploymentmodel.componentrepository;
-
-import java.net.URI;
-
-/**
- * Class describing a shared library of this repository.
- *
- * @author alagane
- */
-public class SharedLibrary {
- /**
- * The identifier of this shared library in the model. Must be the same than the one defined in the JBI descriptor
- * of the shared library.
- */
- private String id;
-
- /**
- * The version of this shared library in the model. Must be the same than the one defined in the JBI descriptor of
- * the shared library.
- */
- private String version;
-
- /**
- * The URL of the associated archive.
- */
- private URI url;
-
- public String getId() {
- return id;
- }
-
- public void setId(final String id) {
- this.id = id;
- }
-
- public String getVersion() {
- return version;
- }
-
- public void setVersion(final String version) {
- this.version = version;
- }
-
- public URI getUrl() {
- return url;
- }
-
- public void setUrl(final URI url) {
- this.url = url;
- }
-}
diff --git a/src/main/java/org/ow2/petals/deploymentmodel/serviceunitmodel/ServiceUnit.java b/src/main/java/org/ow2/petals/deploymentmodel/serviceunitmodel/ServiceUnit.java
deleted file mode 100644
index 99c1d1a..0000000
--- a/src/main/java/org/ow2/petals/deploymentmodel/serviceunitmodel/ServiceUnit.java
+++ /dev/null
@@ -1,67 +0,0 @@
-package org.ow2.petals.deploymentmodel.serviceunitmodel;
-
-import java.net.URI;
-import java.util.Map;
-
-import org.ow2.petals.deploymentmodel.busmodel.ComponentInstance;
-
-/**
- * Class describing a service unit to deploy.
- *
- * @author alagane
- */
-public class ServiceUnit {
- /**
- * The unique identifier of this service unit in the model. Can be different from the service unit name.
- */
- private String id;
-
- /**
- * The URL of the associated archive that can be a service assembly or a deployable service unit.
- */
- private URI url;
-
- /**
- * The map of placeholder required by the service unit. The key of the map is the key of the placeholder, and the
- * value of the map is the default value of the placeholder. If there is no default value, the value must be null.
- */
- private Map placeholders;
-
- /**
- * The identifier of the component instance on which this service unit must be deployed. Optional for deployable
- * service unit and service unit embedded in a service assembly, required for other service units.
- */
- private ComponentInstance componentInstanceId;
-
- public String getId() {
- return id;
- }
-
- public void setId(final String id) {
- this.id = id;
- }
-
- public URI getUrl() {
- return url;
- }
-
- public void setUrl(final URI url) {
- this.url = url;
- }
-
- public ComponentInstance getComponentInstanceId() {
- return componentInstanceId;
- }
-
- public void setComponentInstanceId(final ComponentInstance componentInstanceId) {
- this.componentInstanceId = componentInstanceId;
- }
-
- public Map getPlaceholders() {
- return placeholders;
- }
-
- public void setPlaceholders(final Map placeholders) {
- this.placeholders = placeholders;
- }
-}
diff --git a/src/main/java/org/ow2/petals/deploymentmodel/serviceunitmodel/ServiceUnitModel.java b/src/main/java/org/ow2/petals/deploymentmodel/serviceunitmodel/ServiceUnitModel.java
deleted file mode 100644
index 3a3238c..0000000
--- a/src/main/java/org/ow2/petals/deploymentmodel/serviceunitmodel/ServiceUnitModel.java
+++ /dev/null
@@ -1,25 +0,0 @@
-package org.ow2.petals.deploymentmodel.serviceunitmodel;
-
-import java.util.List;
-
-/**
- * This model defines a set of service units to deploy on your Petals ESB bus. This model will be mainly written by
- * development teams because they have the knowledge of service units to deploy.
- *
- * @author alagane
- */
-public class ServiceUnitModel {
- /**
- * The list of service units to deploy. Their id must be unique in the model. There must be at least one service
- * unit in the model.
- */
- private List serviceUnits;
-
- public List getServiceUnits() {
- return serviceUnits;
- }
-
- public void setServiceUnits(final List serviceUnits) {
- this.serviceUnits = serviceUnits;
- }
-}
diff --git a/src/main/java/org/ow2/petals/deploymentmodel/topologymodel/Container.java b/src/main/java/org/ow2/petals/deploymentmodel/topologymodel/Container.java
deleted file mode 100644
index 2f4da29..0000000
--- a/src/main/java/org/ow2/petals/deploymentmodel/topologymodel/Container.java
+++ /dev/null
@@ -1,61 +0,0 @@
-package org.ow2.petals.deploymentmodel.topologymodel;
-
-/**
- * Class for Petals ESB containers members of a topology.
- */
-public class Container {
- /**
- * Identifier of the Petals ESB container as used as name in the file topology.xml.
- */
- private String id;
-
- /**
- * Default JMX port value. A deployment property can be used. Optional, if not set, the internal default value 7700
- * will be used.
- */
- private int defaultJmxPort;
-
- /**
- * Default JMX username value. A deployment property can be used. Optional, if not set, the internal default value
- * 'petals' will be used.
- */
- private String defaultJmxUser;
-
- /**
- * Default JMX password value. A deployment property can be used. Optional, if not set, the internal default value
- * 'petals' will be used.
- */
- private String defaultJmxPassword;
-
- public String getId() {
- return id;
- }
-
- public void setId(final String id) {
- this.id = id;
- }
-
- public int getDefaultJmxPort() {
- return defaultJmxPort;
- }
-
- public void setDefaultJmxPort(final int defaultJmxPort) {
- this.defaultJmxPort = defaultJmxPort;
- }
-
- public String getDefaultJmxUser() {
- return defaultJmxUser;
- }
-
- public void setDefaultJmxUser(final String defaultJmxUser) {
- this.defaultJmxUser = defaultJmxUser;
- }
-
- public String getDefaultJmxPassword() {
- return defaultJmxPassword;
- }
-
- public void setDefaultJmxPassword(final String defaultJmxPassword) {
- this.defaultJmxPassword = defaultJmxPassword;
- }
-}
diff --git a/src/main/java/org/ow2/petals/deploymentmodel/topologymodel/HazelcastRegistry.java b/src/main/java/org/ow2/petals/deploymentmodel/topologymodel/HazelcastRegistry.java
deleted file mode 100644
index 358aa66..0000000
--- a/src/main/java/org/ow2/petals/deploymentmodel/topologymodel/HazelcastRegistry.java
+++ /dev/null
@@ -1,51 +0,0 @@
-package org.ow2.petals.deploymentmodel.topologymodel;
-
-import java.util.List;
-
-/**
- * Default implementation for a distributed topology.
- *
- * @author alagane
- */
-public class HazelcastRegistry extends Registry {
- /**
- * Default group name value. A deployment property can be used. Optional, if not set, the internal default value
- * 'default-sample' will be used.
- */
- private String defaultGroupName;
-
- /**
- * Default password value. A deployment property can be used. Optional, if not set, the internal default value
- * 's3cr3t' will be used.
- */
- private String defaultGroupPassword;
-
- /**
- * The members of the Hazelcast registry.
- */
- private List members;
-
- public String getDefaultGroupName() {
- return defaultGroupName;
- }
-
- public void setDefaultGroupName(final String defaultGroupName) {
- this.defaultGroupName = defaultGroupName;
- }
-
- public String getDefaultGroupPassword() {
- return defaultGroupPassword;
- }
-
- public void setDefaultGroupPassword(final String defaultGroupPassword) {
- this.defaultGroupPassword = defaultGroupPassword;
- }
-
- public List getMembers() {
- return members;
- }
-
- public void setMembers(final List members) {
- this.members = members;
- }
-}
diff --git a/src/main/java/org/ow2/petals/deploymentmodel/topologymodel/HazelcastRegistryMember.java b/src/main/java/org/ow2/petals/deploymentmodel/topologymodel/HazelcastRegistryMember.java
deleted file mode 100644
index d9b671b..0000000
--- a/src/main/java/org/ow2/petals/deploymentmodel/topologymodel/HazelcastRegistryMember.java
+++ /dev/null
@@ -1,35 +0,0 @@
-package org.ow2.petals.deploymentmodel.topologymodel;
-
-/**
- * Class describing members of the Petals ESB Hazelcast Registry.
- *
- * @author alagane
- */
-public class HazelcastRegistryMember {
- /**
- * Identifier used as name in the file cluster.xml.
- */
- private String id;
-
- /**
- * Default communication port value. A deployment property can be used. Optional, if not set, the internal default
- * value '7900' will be used.
- */
- private String defaultPort;
-
- public String getId() {
- return id;
- }
-
- public void setId(final String id) {
- this.id = id;
- }
-
- public String getDefaultPort() {
- return defaultPort;
- }
-
- public void setDefaultPort(final String defaultPort) {
- this.defaultPort = defaultPort;
- }
-}
diff --git a/src/main/java/org/ow2/petals/deploymentmodel/topologymodel/Registry.java b/src/main/java/org/ow2/petals/deploymentmodel/topologymodel/Registry.java
deleted file mode 100644
index 34fc2aa..0000000
--- a/src/main/java/org/ow2/petals/deploymentmodel/topologymodel/Registry.java
+++ /dev/null
@@ -1,21 +0,0 @@
-package org.ow2.petals.deploymentmodel.topologymodel;
-
-/**
- * Superclass for registry types.
- *
- * @author alagane
- */
-public abstract class Registry {
- /**
- * Used to identify the registry across the model. It must be unique in the model.
- */
- private String id;
-
- public String getId() {
- return id;
- }
-
- public void setId(final String id) {
- this.id = id;
- }
-}
diff --git a/src/main/java/org/ow2/petals/deploymentmodel/topologymodel/StandaloneRegistry.java b/src/main/java/org/ow2/petals/deploymentmodel/topologymodel/StandaloneRegistry.java
deleted file mode 100644
index f508e74..0000000
--- a/src/main/java/org/ow2/petals/deploymentmodel/topologymodel/StandaloneRegistry.java
+++ /dev/null
@@ -1,9 +0,0 @@
-package org.ow2.petals.deploymentmodel.topologymodel;
-
-/**
- * Default implementation for a standalone topology. Cannot be used for a distributed topology.
- *
- * @author alagane
- */
-public class StandaloneRegistry extends Registry {
-}
diff --git a/src/main/java/org/ow2/petals/deploymentmodel/topologymodel/Topology.java b/src/main/java/org/ow2/petals/deploymentmodel/topologymodel/Topology.java
deleted file mode 100644
index 3db3d4e..0000000
--- a/src/main/java/org/ow2/petals/deploymentmodel/topologymodel/Topology.java
+++ /dev/null
@@ -1,60 +0,0 @@
-package org.ow2.petals.deploymentmodel.topologymodel;
-
-import java.util.List;
-
-/**
- * Class describing a topology of a Petals ESB bus.
- *
- * @author alagane
- */
-public class Topology {
- private String id;
-
- /**
- * Default domain name of the topology. Optional.
- */
- private String defaultDomainName;
-
- /**
- * Petals ESB containers of the topology. Their id must be unique in the topology. There must be at least one
- * container in the topology.
- */
- private List containers;
-
- /**
- * The registry used in the topology. Optional.
- */
- private Registry registry;
-
- public String getId() {
- return id;
- }
-
- public void setId(final String id) {
- this.id = id;
- }
-
- public String getDefaultDomainName() {
- return defaultDomainName;
- }
-
- public void setDefaultDomainName(final String defaultDomainName) {
- this.defaultDomainName = defaultDomainName;
- }
-
- public List getContainers() {
- return containers;
- }
-
- public void setContainers(final List containers) {
- this.containers = containers;
- }
-
- public Registry getRegistry() {
- return registry;
- }
-
- public void setRegistry(final Registry registry) {
- this.registry = registry;
- }
-}
diff --git a/src/main/java/org/ow2/petals/deploymentmodel/topologymodel/TopologyModel.java b/src/main/java/org/ow2/petals/deploymentmodel/topologymodel/TopologyModel.java
deleted file mode 100644
index d9707ba..0000000
--- a/src/main/java/org/ow2/petals/deploymentmodel/topologymodel/TopologyModel.java
+++ /dev/null
@@ -1,25 +0,0 @@
-package org.ow2.petals.deploymentmodel.topologymodel;
-
-import java.util.List;
-
-/**
- * This model defines a set of topologies, used by Petals ESB buses. This model will be mainly written by the Petals ESB
- * bus architect.
- *
- * @author alagane
- */
-public class TopologyModel {
- /**
- * The list of topologies in the model. Their id must be unique in the model. There must be at least one topology in
- * the model.
- */
- private List topologies;
-
- public List getTopologies() {
- return topologies;
- }
-
- public void setTopologies(final List topologies) {
- this.topologies = topologies;
- }
-}
diff --git a/src/main/resources/binding.xjb b/src/main/resources/binding.xjb
new file mode 100644
index 0000000..ff83e04
--- /dev/null
+++ b/src/main/resources/binding.xjb
@@ -0,0 +1,26 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/main/resources/bus-model.xsd b/src/main/resources/bus-model.xsd
new file mode 100644
index 0000000..c7fe27a
--- /dev/null
+++ b/src/main/resources/bus-model.xsd
@@ -0,0 +1,76 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/main/resources/component-repository.xsd b/src/main/resources/component-repository.xsd
new file mode 100644
index 0000000..c7f9d6a
--- /dev/null
+++ b/src/main/resources/component-repository.xsd
@@ -0,0 +1,35 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/main/resources/model.xml b/src/main/resources/model.xml
new file mode 100644
index 0000000..6813112
--- /dev/null
+++ b/src/main/resources/model.xml
@@ -0,0 +1,57 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ localhost
+
+
+
+
+ file:/tmp/6839685697696454072.tmp
+
+
+
+
+ file:/tmp/2043870207563112986.tmp
+
+
+ file:/tmp/1545590389019814551.tmp
+
+
+ file:/tmp/6395479656725654647.tmp
+
+
+
+
+
+
+
+
diff --git a/src/main/resources/model.xsd b/src/main/resources/model.xsd
new file mode 100644
index 0000000..f11a09d
--- /dev/null
+++ b/src/main/resources/model.xsd
@@ -0,0 +1,42 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/main/resources/service-unit-model.xsd b/src/main/resources/service-unit-model.xsd
new file mode 100644
index 0000000..1ff245e
--- /dev/null
+++ b/src/main/resources/service-unit-model.xsd
@@ -0,0 +1,34 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/main/resources/topology-model.xsd b/src/main/resources/topology-model.xsd
new file mode 100644
index 0000000..c49edc6
--- /dev/null
+++ b/src/main/resources/topology-model.xsd
@@ -0,0 +1,42 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/test/java/org/ow2/petals/deployer/utils/ParseModelTest.java b/src/test/java/org/ow2/petals/deployer/utils/ParseModelTest.java
new file mode 100644
index 0000000..00bfbd3
--- /dev/null
+++ b/src/test/java/org/ow2/petals/deployer/utils/ParseModelTest.java
@@ -0,0 +1,206 @@
+/**
+ * Copyright (c) 2018-2019 Linagora
+ *
+ * This program/library is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * This program/library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program/library; If not, see http://www.gnu.org/licenses/
+ * for the GNU Lesser General Public License version 2.1.
+ */
+
+package org.ow2.petals.deployer.utils;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.Marshaller;
+import javax.xml.bind.SchemaOutputResolver;
+import javax.xml.transform.Result;
+import javax.xml.transform.stream.StreamResult;
+
+import org.junit.Test;
+import org.ow2.petals.admin.topology.Container.State;
+import org.ow2.petals.deployer.model.bus.xml._1.Bus;
+import org.ow2.petals.deployer.model.bus.xml._1.BusModel;
+import org.ow2.petals.deployer.model.bus.xml._1.ComponentInstance;
+import org.ow2.petals.deployer.model.bus.xml._1.ContainerInstance;
+import org.ow2.petals.deployer.model.bus.xml._1.Machine;
+import org.ow2.petals.deployer.model.bus.xml._1.ProvisionedMachine;
+import org.ow2.petals.deployer.model.bus.xml._1.ServiceUnitInstance;
+import org.ow2.petals.deployer.model.component_repository.xml._1.Component;
+import org.ow2.petals.deployer.model.component_repository.xml._1.ComponentRepository;
+import org.ow2.petals.deployer.model.service_unit.xml._1.ServiceUnit;
+import org.ow2.petals.deployer.model.service_unit.xml._1.ServiceUnitModel;
+import org.ow2.petals.deployer.model.topology.xml._1.Container;
+import org.ow2.petals.deployer.model.topology.xml._1.Topology;
+import org.ow2.petals.deployer.model.topology.xml._1.TopologyModel;
+import org.ow2.petals.deployer.model.xml._1.Model;
+
+public class ParseModelTest {
+
+ final public static String CONTAINER_NAME = "sample-0";
+
+ final public static String CONTAINER_HOST = "localhost";
+
+ final public static int CONTAINER_JMX_PORT = 7700;
+
+ final public static String CONTAINER_USER = "petals";
+
+ final public static String CONTAINER_PWD = "petals";
+
+ final public static State CONTAINER_STATE = State.REACHABLE;
+
+ @Test
+ public void read() throws Exception {
+ // TODO Remove this class
+
+ Model model = new Model();
+
+ /* Component Repository */
+
+ ComponentRepository compRepo = new ComponentRepository();
+
+ List components = new ArrayList();
+
+ Component bcSoap = new Component();
+ bcSoap.setId("petals-bc-soap");
+ bcSoap.setUrl(
+ ZipUtils.createZipFromResourceDirectory("artifacts/petals-bc-soap-5.0.0").toURI().toURL().toString());
+ compRepo.getComponent().add(bcSoap);
+
+ /* Service Unit Model */
+
+ ServiceUnitModel suModel = new ServiceUnitModel();
+ List serviceUnits = suModel.getServiceUnit();
+
+ ServiceUnit suProv1 = new ServiceUnit();
+ suProv1.setId("su-SOAP-Hello_Service1-provide");
+ suProv1.setUrl(ZipUtils.createZipFromResourceDirectory("artifacts/sa-SOAP-Hello_Service1-provide").toURI()
+ .toURL().toString());
+ serviceUnits.add(suProv1);
+
+ ServiceUnit suProv2 = new ServiceUnit();
+ suProv2.setId("su-SOAP-Hello_Service2-provide");
+ suProv2.setUrl(ZipUtils.createZipFromResourceDirectory("artifacts/sa-SOAP-Hello_Service2-provide").toURI()
+ .toURL().toString());
+ serviceUnits.add(suProv2);
+
+ ServiceUnit suCons = new ServiceUnit();
+ suCons.setId("su-SOAP-Hello_PortType-consume");
+ suCons.setUrl(ZipUtils.createZipFromResourceDirectory("artifacts/sa-SOAP-Hello_PortType-consume").toURI()
+ .toURL().toString());
+ serviceUnits.add(suCons);
+
+ /* Topology Model */
+
+ TopologyModel topoModel = new TopologyModel();
+
+ List topologies = new ArrayList();
+
+ List containers = new ArrayList();
+
+ Topology topo = new Topology();
+ topo.setId("topo1");
+ topoModel.getTopology().add(topo);
+
+ Container cont = new Container();
+ cont.setId(CONTAINER_NAME);
+ cont.setDefaultJmxPort(CONTAINER_JMX_PORT);
+ cont.setDefaultJmxUser(CONTAINER_USER);
+ cont.setDefaultJmxPassword(CONTAINER_PWD);
+ topo.getContainer().add(cont);
+
+ /* Bus Model */
+
+ BusModel busModel = new BusModel();
+
+ List machines = busModel.getMachine();
+
+ ProvisionedMachine machine = new ProvisionedMachine();
+ machine.setId("main");
+ machine.setHostname("localhost");
+ machines.add(machine);
+
+ List buses = busModel.getBus();
+
+ Bus bus = new Bus();
+ bus.setTopologyRef(topo.getId());
+ buses.add(bus);
+
+ List contInstances = bus.getContainerInstance();
+
+ ContainerInstance contInst = new ContainerInstance();
+ contInst.setRef(cont.getId());
+ contInst.setMachineRef(machine.getId());
+ contInstances.add(contInst);
+
+ List compInstances = contInst.getComponentInstance();
+
+ ComponentInstance bcSoapInst = new ComponentInstance();
+ bcSoapInst.setRef(bcSoap.getId());
+ compInstances.add(bcSoapInst);
+
+ List suInstances = contInst.getServiceUnitInstance();
+
+ ServiceUnitInstance suInst = new ServiceUnitInstance();
+ suInst.setRef(suProv1.getId());
+ suInstances.add(suInst);
+
+ suInst = new ServiceUnitInstance();
+ suInst.setRef(suProv2.getId());
+ suInstances.add(suInst);
+
+ suInst = new ServiceUnitInstance();
+ suInst.setRef(suCons.getId());
+ suInstances.add(suInst);
+
+ File file = new File(Thread.currentThread().getContextClassLoader().getResource("model.xml").toURI());
+
+ JAXBContext jaxbContext = JAXBContext.newInstance(Model.class);
+
+ SchemaOutputResolver sor = new SchemaOutputResolver() {
+
+ @Override
+ public Result createOutput(String namespaceUri, String suggestedFileName) throws IOException {
+ // create new file
+ File file = new File("yolo");
+
+ // create stream result
+ StreamResult result = new StreamResult(file);
+
+ // set system id
+ result.setSystemId(file.toURI().toURL().toString());
+
+ // return result
+ return result;
+ }
+ };
+
+ // Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
+ //
+ // Model model = (Model) unmarshaller.unmarshal(file);
+ //
+ // jaxbContext.generateSchema(sor);
+
+ Marshaller marshaller = jaxbContext.createMarshaller();
+
+ marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
+
+ marshaller.marshal(model, file);
+
+ // Model unmarshalledModel = (Model) unmarshaller.unmarshal(file);
+
+ // assertEquals(model, unmarshalledModel);
+ }
+}
diff --git a/src/test/java/org/ow2/petals/deployer/utils/RuntimeModelComparatorTest.java b/src/test/java/org/ow2/petals/deployer/utils/RuntimeModelComparatorTest.java
new file mode 100644
index 0000000..33027f0
--- /dev/null
+++ b/src/test/java/org/ow2/petals/deployer/utils/RuntimeModelComparatorTest.java
@@ -0,0 +1,638 @@
+/**
+ * Copyright (c) 2018-2019 Linagora
+ *
+ * This program/library is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * This program/library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program/library; If not, see http://www.gnu.org/licenses/
+ * for the GNU Lesser General Public License version 2.1.
+ */
+
+package org.ow2.petals.deployer.utils;
+
+import org.junit.Before;
+
+public class RuntimeModelComparatorTest {
+
+ private ModelComparator comparator;
+
+ @Before
+ public void setupModelComparator() {
+ comparator = new ModelComparator();
+ }
+
+// @Test
+// public void compareComponentsWithDifferentIds() {
+// Component c1 = new Component();
+// c1.setId("comp1");
+//
+// Component c2 = new Component();
+// c2.setId("comp2");
+//
+// assertFalse(comparator.compareComponents(c1, c2));
+// assertFalse(comparator.compareComponents(c1, c2));
+// }
+//
+// @Test
+// public void compareComponents() {
+// Component c1 = new Component();
+// c1.setId("comp");
+//
+// Component c2 = new Component();
+// c2.setId("comp");
+//
+// assertTrue(comparator.compareComponents(c1, c2));
+// }
+//
+// @Test
+// public void compareComponentInstancesWithDifferentComponents() {
+// ModelComparator mockedComparator = spy(ModelComparator.class);
+// doReturn(false).when(mockedComparator).compareComponents(null, null);
+//
+// ComponentInstance ci1 = new ComponentInstance();
+// ci1.setReference("comp");
+//
+// ComponentInstance ci2 = new ComponentInstance();
+// ci2.setReference("comp");
+//
+// assertFalse(mockedComparator.compareComponentsInstances(ci1, ci2));
+// assertFalse(mockedComparator.compareComponentsInstances(ci2, ci1));
+// }
+//
+// @Test
+// public void compareComponentInstancesWithDifferentIds() {
+// ModelComparator mockedComparator = spy(ModelComparator.class);
+// doReturn(true).when(mockedComparator).compareComponents(null, null);
+//
+// ComponentInstance ci1 = new ComponentInstance();
+// ci1.setReference("comp1");
+//
+// ComponentInstance ci2 = new ComponentInstance();
+// ci2.setReference("comp2");
+//
+// assertFalse(mockedComparator.compareComponentsInstances(ci1, ci2));
+// assertFalse(mockedComparator.compareComponentsInstances(ci2, ci1));
+// }
+//
+// @Test
+// public void compareComponentInstances() {
+// ModelComparator mockedComparator = spy(ModelComparator.class);
+// doReturn(true).when(mockedComparator).compareComponents(null, null);
+//
+// ComponentInstance ci1 = new ComponentInstance();
+// ci1.setReference("comp");
+//
+// ComponentInstance ci2 = new ComponentInstance();
+// ci2.setReference("comp");
+//
+// assertTrue(mockedComparator.compareComponentsInstances(ci1, ci2));
+// assertTrue(mockedComparator.compareComponentsInstances(ci2, ci1));
+// }
+//
+// @Test
+// public void compareServiceUnitsWithDifferentIds() {
+// ServiceUnit su1 = new ServiceUnit();
+// su1.setId("su1");
+// su1.setTargetComponent("comp");
+//
+// ServiceUnit su2 = new ServiceUnit();
+// su2.setId("su2");
+// su2.setTargetComponent("comp");
+//
+// assertFalse(comparator.compareServiceUnits(su1, su2));
+// assertFalse(comparator.compareServiceUnits(su2, su1));
+// }
+//
+// @Test
+// public void compareServiceUnitsWithDifferentComponents() {
+//
+// ServiceUnit su1 = new ServiceUnit();
+// su1.setId("su");
+// su1.setTargetComponent("comp1");
+//
+// ServiceUnit su2 = new ServiceUnit();
+// su2.setId("su");
+// su2.setTargetComponent("comp2");
+//
+// assertFalse(comparator.compareServiceUnits(su1, su2));
+// assertFalse(comparator.compareServiceUnits(su2, su1));
+// }
+//
+// @Test
+// public void compareServiceUnits() {
+// ServiceUnit su1 = new ServiceUnit();
+// su1.setId("su");
+// su1.setTargetComponent("comp");
+//
+// ServiceUnit su2 = new ServiceUnit();
+// su2.setId("su");
+// su2.setTargetComponent("comp");
+//
+// assertTrue(comparator.compareServiceUnits(su1, su2));
+// assertTrue(comparator.compareServiceUnits(su2, su1));
+// }
+//
+// @Test
+// public void compareServiceUnitInstancesWithDifferentContainerInstances() {
+// ModelComparator mockedComparator = spy(ModelComparator.class);
+// doReturn(false).when(mockedComparator).compareContainerInstances(null, null);
+// doReturn(true).when(mockedComparator).compareServiceUnits(null, null);
+//
+// ServiceUnitInstance sui1 = new ServiceUnitInstance();
+//
+// ServiceUnitInstance sui2 = new ServiceUnitInstance();
+//
+// assertFalse(mockedComparator.compareServiceUnitInstances(sui1, sui2));
+// assertFalse(mockedComparator.compareServiceUnitInstances(sui2, sui1));
+// }
+//
+// @Test
+// public void compareServiceUnitInstancesWithDifferentServiceUnits() {
+// ModelComparator mockedComparator = spy(ModelComparator.class);
+// doReturn(true).when(mockedComparator).compareContainerInstances(null, null);
+// doReturn(false).when(mockedComparator).compareServiceUnits(null, null);
+//
+// ServiceUnitInstance sui1 = new ServiceUnitInstance();
+//
+// ServiceUnitInstance sui2 = new ServiceUnitInstance();
+//
+// assertFalse(mockedComparator.compareServiceUnitInstances(sui1, sui2));
+// assertFalse(mockedComparator.compareServiceUnitInstances(sui2, sui1));
+// }
+//
+// @Test
+// public void compareMachinesWithDifferentHostnames() {
+// ProvisionedMachine m1 = new ProvisionedMachine();
+// m1.setId("machine");
+// m1.setHostname("localhost");
+//
+// ProvisionedMachine m2 = new ProvisionedMachine();
+// m2.setId("machine");
+// m2.setHostname("1.2.3.4");
+//
+// assertFalse(comparator.compareMachines(m1, m2));
+// assertFalse(comparator.compareMachines(m2, m1));
+// }
+//
+// @Test
+// public void compareMachinesWithDifferentIds() {
+// ProvisionedMachine m1 = new ProvisionedMachine();
+// m1.setId("machine1");
+// m1.setHostname("localhost");
+//
+// ProvisionedMachine m2 = new ProvisionedMachine();
+// m2.setId("machine2");
+// m2.setHostname("localhost");
+//
+// assertTrue(comparator.compareMachines(m1, m2));
+// assertTrue(comparator.compareMachines(m2, m1));
+// }
+//
+// @Test
+// public void compareMachinesNotProvisioned() {
+// Machine m1 = new Machine() {
+// };
+//
+// ProvisionedMachine m2 = new ProvisionedMachine();
+// m2.setId("machine");
+// m2.setHostname("localhost");
+//
+// assertFalse(comparator.compareMachines(m1, m2));
+// assertFalse(comparator.compareMachines(m2, m1));
+// }
+//
+// @Test
+// public void compareMachines() {
+// ProvisionedMachine m1 = new ProvisionedMachine();
+// m1.setId("machine");
+// m1.setHostname("localhost");
+//
+// ProvisionedMachine m2 = new ProvisionedMachine();
+// m2.setId("machine");
+// m2.setHostname("localhost");
+//
+// assertTrue(comparator.compareMachines(m1, m2));
+// assertTrue(comparator.compareMachines(m2, m1));
+// }
+//
+// @Test
+// public void compareServiceUnitInstances() {
+// ModelComparator mockedComparator = spy(ModelComparator.class);
+// doReturn(true).when(mockedComparator).compareContainerInstances(null, null);
+// doReturn(true).when(mockedComparator).compareServiceUnits(null, null);
+//
+// ServiceUnitInstance sui1 = new ServiceUnitInstance();
+//
+// ServiceUnitInstance sui2 = new ServiceUnitInstance();
+//
+// assertTrue(mockedComparator.compareServiceUnitInstances(sui1, sui2));
+// assertTrue(mockedComparator.compareServiceUnitInstances(sui2, sui1));
+// }
+//
+// @Test
+// public void compareContainerInstancesWithDifferentIds() {
+// ModelComparator mockedComparator = spy(ModelComparator.class);
+// doReturn(true).when(mockedComparator).compareMachines(null, null);
+//
+// Container c1 = new Container();
+// c1.setId("cont1");
+// c1.setDefaultJmxUser("petals");
+// c1.setDefaultJmxPort(7700);
+// c1.setDefaultJmxPassword("password");
+//
+// ContainerInstance ci1 = new ContainerInstance();
+// ci1.setReference(c1.getId());
+//
+// Container c2 = new Container();
+// c2.setId("cont2");
+//
+// ContainerInstance ci2 = new ContainerInstance();
+// ci2.setReference(c2.getId());
+// ci2.setJmxUser("petals");
+// ci2.setJmxPort(7700);
+// ci2.setJmxPassword("password");
+//
+// assertFalse(mockedComparator.compareContainerInstances(ci1, ci2));
+// assertFalse(mockedComparator.compareContainerInstances(ci2, ci1));
+// }
+//
+// @Test
+// public void compareContainerInstancesWithDifferentMachines() {
+// ModelComparator mockedComparator = spy(ModelComparator.class);
+// doReturn(false).when(mockedComparator).compareMachines(null, null);
+//
+// Container c1 = new Container();
+// c1.setId("cont");
+// c1.setDefaultJmxUser("petals");
+// c1.setDefaultJmxPort(7700);
+// c1.setDefaultJmxPassword("password");
+//
+// ContainerInstance ci1 = new ContainerInstance();
+// ci1.setReference(c1.getId());
+//
+// Container c2 = new Container();
+// c2.setId("cont");
+//
+// ContainerInstance ci2 = new ContainerInstance();
+// ci2.setReference(c2.getId());
+// ci2.setJmxUser("petals");
+// ci2.setJmxPort(7700);
+// ci2.setJmxPassword("password");
+//
+// assertFalse(mockedComparator.compareContainerInstances(ci1, ci2));
+// assertFalse(mockedComparator.compareContainerInstances(ci2, ci1));
+// }
+//
+// @Test
+// public void compareContainerInstancesWithDifferentJmxUsers() {
+// ModelComparator mockedComparator = spy(ModelComparator.class);
+// doReturn(true).when(mockedComparator).compareMachines(null, null);
+//
+// Container c1 = new Container();
+// c1.setId("cont");
+// c1.setDefaultJmxUser("petals");
+// c1.setDefaultJmxPort(7700);
+// c1.setDefaultJmxPassword("password");
+//
+// ContainerInstance ci1 = new ContainerInstance();
+// ci1.setReference(c1.getId());
+//
+// Container c2 = new Container();
+// c2.setId("cont");
+//
+// ContainerInstance ci2 = new ContainerInstance();
+// ci2.setReference(c2.getId());
+// ci2.setJmxUser("user");
+// ci2.setJmxPort(7700);
+// ci2.setJmxPassword("password");
+//
+// assertFalse(mockedComparator.compareContainerInstances(ci1, ci2));
+// assertFalse(mockedComparator.compareContainerInstances(ci2, ci1));
+// }
+//
+// @Test
+// public void compareContainerInstancesWithDifferentJmxPorts() {
+// ModelComparator mockedComparator = spy(ModelComparator.class);
+// doReturn(true).when(mockedComparator).compareMachines(null, null);
+//
+// Container c1 = new Container();
+// c1.setId("cont");
+// c1.setDefaultJmxUser("petals");
+// c1.setDefaultJmxPort(80);
+// c1.setDefaultJmxPassword("password");
+//
+// ContainerInstance ci1 = new ContainerInstance();
+// ci1.setReference(c1.getId());
+//
+// Container c2 = new Container();
+// c2.setId("cont");
+//
+// ContainerInstance ci2 = new ContainerInstance();
+// ci2.setReference(c2.getId());
+// ci2.setJmxUser("petals");
+// ci2.setJmxPort(7700);
+// ci2.setJmxPassword("password");
+//
+// assertFalse(mockedComparator.compareContainerInstances(ci1, ci2));
+// assertFalse(mockedComparator.compareContainerInstances(ci2, ci1));
+// }
+//
+// @Test
+// public void compareContainerInstancesWithDifferentJmxPasswords() {
+// ModelComparator mockedComparator = spy(ModelComparator.class);
+// doReturn(true).when(mockedComparator).compareMachines(null, null);
+//
+// Container c1 = new Container();
+// c1.setId("cont");
+// c1.setDefaultJmxUser("petals");
+// c1.setDefaultJmxPort(7700);
+// c1.setDefaultJmxPassword("password");
+//
+// ContainerInstance ci1 = new ContainerInstance();
+// ci1.setReference(c1.getId());
+//
+// Container c2 = new Container();
+// c2.setId("cont");
+//
+// ContainerInstance ci2 = new ContainerInstance();
+// ci2.setReference(c2.getId());
+// ci2.setJmxUser("petals");
+// ci2.setJmxPort(7700);
+// ci2.setJmxPassword("azerty123");
+//
+// assertFalse(mockedComparator.compareContainerInstances(ci1, ci2));
+// assertFalse(mockedComparator.compareContainerInstances(ci2, ci1));
+// }
+//
+// @Test
+// public void compareContainerInstances() {
+// ModelComparator mockedComparator = spy(ModelComparator.class);
+// doReturn(true).when(mockedComparator).compareMachines(null, null);
+//
+// Container c1 = new Container();
+// c1.setId("cont");
+// c1.setDefaultJmxUser("petals");
+// c1.setDefaultJmxPort(7700);
+// c1.setDefaultJmxPassword("password");
+//
+// ContainerInstance ci1 = new ContainerInstance();
+// ci1.setReference(c1.getId());
+//
+// Container c2 = new Container();
+// c2.setId("cont");
+//
+// ContainerInstance ci2 = new ContainerInstance();
+// ci2.setReference(c2.getId());
+// ci2.setJmxUser("petals");
+// ci2.setJmxPort(7700);
+// ci2.setJmxPassword("password");
+//
+// assertTrue(mockedComparator.compareContainerInstances(ci1, ci2));
+// assertTrue(mockedComparator.compareContainerInstances(ci2, ci1));
+// }
+//
+// @Test
+// public void compareComponentInstanceListsWithDifferentSizes() {
+// List compInstances1 = new ArrayList<>();
+// compInstances1.add(null);
+//
+// List compInstances2 = new ArrayList<>();
+// compInstances2.add(null);
+// compInstances2.add(null);
+//
+// assertFalse(comparator.compareComponentInstanceLists(compInstances1, compInstances2));
+// assertFalse(comparator.compareComponentInstanceLists(compInstances2, compInstances1));
+// }
+//
+// @Test
+// public void compareComponentInstanceListsNotUnique() {
+// ComponentInstance ci1 = new ComponentInstance();
+// ci1.setReference("comp1");
+// ComponentInstance ci2 = new ComponentInstance();
+// ci2.setReference("comp2");
+//
+// ModelComparator mockedComparator = spy(ModelComparator.class);
+// doReturn(false).when(mockedComparator).compareComponentsInstances(ci1, ci2);
+// doReturn(false).when(mockedComparator).compareComponentsInstances(ci2, ci1);
+// doReturn(true).when(mockedComparator).compareComponentsInstances(ci1, ci1);
+// doReturn(true).when(mockedComparator).compareComponentsInstances(ci2, ci2);
+//
+// List compInstances1 = new ArrayList<>();
+// compInstances1.add(ci1);
+// compInstances1.add(ci1);
+//
+// List compInstances2 = new ArrayList<>();
+// compInstances2.add(ci1);
+// compInstances2.add(ci2);
+//
+// assertFalse(mockedComparator.compareComponentInstanceLists(compInstances1, compInstances2));
+// assertFalse(mockedComparator.compareComponentInstanceLists(compInstances2, compInstances1));
+// }
+//
+// @Test
+// public void compareComponentInstanceListsWithDifferentItems() {
+// ComponentInstance ci1 = new ComponentInstance();
+// ci1.setReference("comp");
+//
+// ModelComparator mockedComparator = spy(ModelComparator.class);
+// doReturn(false).when(mockedComparator).compareComponentsInstances(ci1, ci1);
+//
+// List compInstances1 = new ArrayList<>();
+// compInstances1.add(ci1);
+//
+// List compInstances2 = new ArrayList<>();
+// compInstances2.add(ci1);
+//
+// assertFalse(mockedComparator.compareComponentInstanceLists(compInstances1, compInstances2));
+// assertFalse(mockedComparator.compareComponentInstanceLists(compInstances2, compInstances1));
+// }
+//
+// @Test
+// public void compareComponentInstanceLists() {
+// ComponentInstance ci1 = new ComponentInstance();
+// ci1.setReference("comp1");
+// ComponentInstance ci2 = new ComponentInstance();
+ // ci1.setId("comp2");
+//
+// ModelComparator mockedComparator = spy(ModelComparator.class);
+// doReturn(true).when(mockedComparator).compareComponentsInstances(ci1, ci1);
+// doReturn(true).when(mockedComparator).compareComponentsInstances(ci2, ci2);
+//
+// List compInstances1 = new ArrayList<>();
+// compInstances1.add(ci1);
+// compInstances1.add(ci2);
+//
+// List compInstances2 = new ArrayList<>();
+// compInstances2.add(ci2);
+// compInstances2.add(ci1);
+//
+// assertTrue(mockedComparator.compareComponentInstanceLists(compInstances1, compInstances2));
+// assertTrue(mockedComparator.compareComponentInstanceLists(compInstances2, compInstances1));
+// }
+//
+// @Test
+// public void compareServiceUnitInstanceListsWithDifferentSizes() {
+// List suInstances1 = new ArrayList<>();
+// suInstances1.add(null);
+//
+// List suInstances2 = new ArrayList<>();
+// suInstances2.add(null);
+// suInstances2.add(null);
+//
+// assertFalse(comparator.compareServiceUnitInstanceLists(suInstances1, suInstances2));
+// assertFalse(comparator.compareServiceUnitInstanceLists(suInstances2, suInstances1));
+// }
+//
+// @Test
+// public void compareServiceUnitInstanceListsNotUnique() {
+// ServiceUnit su1 = new ServiceUnit();
+// su1.setId("su1");
+// ServiceUnitInstance sui1 = new ServiceUnitInstance();
+// sui1.setReference(su1.getId());
+// ServiceUnit su2 = new ServiceUnit();
+// su2.setId("su2");
+// ServiceUnitInstance sui2 = new ServiceUnitInstance();
+// sui2.setReference(su2.getId());
+//
+// ModelComparator mockedComparator = spy(ModelComparator.class);
+// doReturn(false).when(mockedComparator).compareServiceUnitInstances(sui1, sui2);
+// doReturn(false).when(mockedComparator).compareServiceUnitInstances(sui2, sui1);
+// doReturn(true).when(mockedComparator).compareServiceUnitInstances(sui1, sui1);
+// doReturn(true).when(mockedComparator).compareServiceUnitInstances(sui2, sui2);
+//
+// List suInstances1 = new ArrayList<>();
+// suInstances1.add(sui1);
+// suInstances1.add(sui1);
+//
+// List suInstances2 = new ArrayList<>();
+// suInstances2.add(sui1);
+// suInstances2.add(sui2);
+//
+// assertFalse(mockedComparator.compareServiceUnitInstanceLists(suInstances1, suInstances2));
+// assertFalse(mockedComparator.compareServiceUnitInstanceLists(suInstances2, suInstances1));
+// }
+//
+// @Test
+// public void compareServiceUnitInstanceListsWithDifferentItems() {
+// ServiceUnit su1 = new ServiceUnit();
+// su1.setId("su");
+// ServiceUnitInstance sui1 = new ServiceUnitInstance();
+// sui1.setReference(su1.getId());
+//
+// ModelComparator mockedComparator = spy(ModelComparator.class);
+// doReturn(false).when(mockedComparator).compareServiceUnitInstances(sui1, sui1);
+//
+// List suInstances1 = new ArrayList<>();
+// suInstances1.add(sui1);
+//
+// List suInstances2 = new ArrayList<>();
+// suInstances2.add(sui1);
+//
+// assertFalse(mockedComparator.compareServiceUnitInstanceLists(suInstances1, suInstances2));
+// assertFalse(mockedComparator.compareServiceUnitInstanceLists(suInstances2, suInstances1));
+// }
+//
+// @Test
+// public void compareServiceUnitLists() {
+// ServiceUnit su1 = new ServiceUnit();
+// su1.setId("su1");
+// ServiceUnitInstance sui1 = new ServiceUnitInstance();
+// sui1.setReference(su1.getId());
+// ServiceUnit su2 = new ServiceUnit();
+// su2.setId("su2");
+// ServiceUnitInstance sui2 = new ServiceUnitInstance();
+// sui2.setReference(su2.getId());
+//
+// ModelComparator mockedComparator = spy(ModelComparator.class);
+// doReturn(true).when(mockedComparator).compareServiceUnitInstances(sui1, sui1);
+// doReturn(true).when(mockedComparator).compareServiceUnitInstances(sui2, sui2);
+//
+// List suInstances1 = new ArrayList<>();
+// suInstances1.add(sui1);
+// suInstances1.add(sui2);
+//
+// List suInstances2 = new ArrayList<>();
+// suInstances2.add(sui2);
+// suInstances2.add(sui1);
+//
+// assertTrue(mockedComparator.compareServiceUnitInstanceLists(suInstances1, suInstances2));
+// assertTrue(mockedComparator.compareServiceUnitInstanceLists(suInstances2, suInstances1));
+// }
+//
+// @Test
+// public void compareModelsWithDifferentContainerInstances() {
+// List containerInstances = new ArrayList();
+// containerInstances.add(null);
+// TopologyInstance topoInst = new TopologyInstance();
+// topoInst.setContainerInstances(containerInstances);
+// Bus bus = new Bus();
+// bus.setTopologyInstance(topoInst);
+// List buses = new ArrayList();
+// buses.add(bus);
+// BusModel busModel = new BusModel();
+// busModel.setBuses(buses);
+// Model model = new Model();
+// model.setBusModel(busModel);
+//
+// ModelComparator mockedComparator = spy(ModelComparator.class);
+// doReturn(false).when(mockedComparator).compareContainerInstances(null, null);
+// doReturn(true).when(mockedComparator).compareServiceUnitInstanceLists(null, null);
+// doReturn(true).when(mockedComparator).compareComponentInstanceLists(null, null);
+//
+// assertFalse(mockedComparator.compareModels(model, model));
+// }
+//
+// @Test
+// public void compareModelsWithDifferentServiceUnitInstanceLists() {
+// List containerInstances = new ArrayList();
+// containerInstances.add(null);
+// TopologyInstance topoInst = new TopologyInstance();
+// topoInst.setContainerInstances(containerInstances);
+// Bus bus = new Bus();
+// bus.setTopologyInstance(topoInst);
+// List buses = new ArrayList();
+// buses.add(bus);
+// BusModel busModel = new BusModel();
+// busModel.setBuses(buses);
+// Model model = new Model();
+// model.setBusModel(busModel);
+//
+// ModelComparator mockedComparator = spy(ModelComparator.class);
+// doReturn(true).when(mockedComparator).compareContainerInstances(null, null);
+// doReturn(false).when(mockedComparator).compareServiceUnitInstanceLists(null, null);
+// doReturn(true).when(mockedComparator).compareComponentInstanceLists(null, null);
+//
+// assertFalse(mockedComparator.compareModels(model, model));
+// }
+//
+// @Test
+// public void compareModelsWithDifferentComponentInstanceLists() {
+// List containerInstances = new ArrayList();
+// containerInstances.add(null);
+// TopologyInstance topoInst = new TopologyInstance();
+// topoInst.setContainerInstances(containerInstances);
+// Bus bus = new Bus();
+// bus.setTopologyInstance(topoInst);
+// List buses = new ArrayList();
+// buses.add(bus);
+// BusModel busModel = new BusModel();
+// busModel.setBuses(buses);
+// Model model = new Model();
+// model.setBusModel(busModel);
+//
+// ModelComparator mockedComparator = spy(ModelComparator.class);
+// doReturn(true).when(mockedComparator).compareContainerInstances(null, null);
+// doReturn(true).when(mockedComparator).compareServiceUnitInstanceLists(null, null);
+// doReturn(false).when(mockedComparator).compareComponentInstanceLists(null, null);
+//
+// assertFalse(mockedComparator.compareModels(model, model));
+// }
+}
diff --git a/src/test/java/org/ow2/petals/deployer/utils/RuntimeModelDeployerTest.java b/src/test/java/org/ow2/petals/deployer/utils/RuntimeModelDeployerTest.java
new file mode 100644
index 0000000..29c7c2a
--- /dev/null
+++ b/src/test/java/org/ow2/petals/deployer/utils/RuntimeModelDeployerTest.java
@@ -0,0 +1,123 @@
+/**
+ * Copyright (c) 2018-2019 Linagora
+ *
+ * This program/library is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * This program/library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program/library; If not, see http://www.gnu.org/licenses/
+ * for the GNU Lesser General Public License version 2.1.
+ */
+
+package org.ow2.petals.deployer.utils;
+
+import static org.junit.Assert.assertTrue;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.logging.ConsoleHandler;
+import java.util.logging.Formatter;
+import java.util.logging.Handler;
+import java.util.logging.Level;
+import java.util.logging.LogRecord;
+import java.util.logging.Logger;
+
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.ow2.petals.admin.junit.ArtifactLifecycleFactoryMock;
+import org.ow2.petals.admin.junit.PetalsAdministrationApi;
+import org.ow2.petals.admin.topology.Container.PortType;
+import org.ow2.petals.admin.topology.Container.State;
+import org.ow2.petals.deployer.runtimemodel.RuntimeComponent;
+import org.ow2.petals.deployer.runtimemodel.RuntimeContainer;
+import org.ow2.petals.deployer.runtimemodel.RuntimeModel;
+import org.ow2.petals.deployer.runtimemodel.RuntimeServiceUnit;
+import org.ow2.petals.jbi.descriptor.original.JBIDescriptorBuilder;
+
+public class RuntimeModelDeployerTest {
+ final public static String CONTAINER_NAME = "sample-0";
+
+ final public static String CONTAINER_HOST = "localhost";
+
+ final public static int CONTAINER_JMX_PORT = 7700;
+
+ final public static String CONTAINER_USER = "petals";
+
+ final public static String CONTAINER_PWD = "petals";
+
+ final public static State CONTAINER_STATE = State.REACHABLE;
+
+ @Rule
+ public PetalsAdministrationApi petalsAdminApiRule = new PetalsAdministrationApi();
+
+ @Before
+ public void setupLogger() throws Exception {
+ Logger deployerLogger = Logger.getLogger(RuntimeModelDeployer.class.getName());
+ deployerLogger.setLevel(Level.FINER);
+ Logger comparatorLogger = Logger.getLogger(ModelComparator.class.getName());
+ comparatorLogger.setLevel(Level.FINER);
+ Handler consoleHandler = new ConsoleHandler();
+ consoleHandler.setLevel(Level.FINER);
+ Formatter formatter = new Formatter() {
+ @Override
+ public String format(LogRecord record) {
+ return record.getMessage() + "\n";
+ }
+ };
+ consoleHandler.setFormatter(formatter);
+ deployerLogger.addHandler(consoleHandler);
+ comparatorLogger.addHandler(consoleHandler);
+ }
+
+ @Test
+ public void demoSoap() throws Exception {
+ RuntimeModel model = new RuntimeModel();
+ initializeRuntimeModel(model);
+
+ petalsAdminApiRule.registerDomain();
+ org.ow2.petals.admin.topology.Container cont = createContainerSample();
+ petalsAdminApiRule.registerContainer(cont);
+ ArtifactLifecycleFactoryMock artifactLifecycleFactoryMock = new ArtifactLifecycleFactoryMock(cont);
+ RuntimeModelDeployer modelDeployer = new RuntimeModelDeployer(petalsAdminApiRule.getSingleton(), artifactLifecycleFactoryMock,
+ JBIDescriptorBuilder.getInstance());
+ modelDeployer.deployRuntimeModel(model);
+
+ ModelExporter modelExporter = new ModelExporter();
+ RuntimeModel exportedModel = modelExporter.exportRuntimeModel(CONTAINER_HOST, CONTAINER_JMX_PORT,
+ CONTAINER_USER, CONTAINER_PWD);
+
+ ModelComparator modelComparator = new ModelComparator();
+ assertTrue(modelComparator.compareRuntimeModels(model, exportedModel));
+ }
+
+ private org.ow2.petals.admin.topology.Container createContainerSample() {
+ final Map ports = new HashMap<>();
+ ports.put(PortType.JMX, CONTAINER_JMX_PORT);
+ return new org.ow2.petals.admin.topology.Container(CONTAINER_NAME, CONTAINER_HOST, ports, CONTAINER_USER,
+ CONTAINER_PWD, CONTAINER_STATE);
+ }
+
+ private void initializeRuntimeModel(RuntimeModel model) throws Exception {
+
+ RuntimeContainer cont = new RuntimeContainer(CONTAINER_NAME, CONTAINER_JMX_PORT, CONTAINER_USER, CONTAINER_PWD,
+ "localhost");
+ cont.addComponent(new RuntimeComponent("petals-bc-soap",
+ ZipUtils.createZipFromResourceDirectory("artifacts/petals-bc-soap-5.0.0").toURI().toURL()));
+ cont.addServiceUnit(new RuntimeServiceUnit("su-SOAP-Hello_Service1-provide",
+ ZipUtils.createZipFromResourceDirectory("artifacts/sa-SOAP-Hello_Service1-provide").toURI().toURL()));
+ cont.addServiceUnit(new RuntimeServiceUnit("su-SOAP-Hello_Service2-provide",
+ ZipUtils.createZipFromResourceDirectory("artifacts/sa-SOAP-Hello_Service2-provide").toURI().toURL()));
+ cont.addServiceUnit(new RuntimeServiceUnit("su-SOAP-Hello_PortType-consume",
+ ZipUtils.createZipFromResourceDirectory("artifacts/sa-SOAP-Hello_PortType-consume").toURI().toURL()));
+
+ model.addContainer(cont);
+ }
+}
diff --git a/src/test/java/org/ow2/petals/deployer/utils/ZipUtils.java b/src/test/java/org/ow2/petals/deployer/utils/ZipUtils.java
new file mode 100644
index 0000000..a1c44cb
--- /dev/null
+++ b/src/test/java/org/ow2/petals/deployer/utils/ZipUtils.java
@@ -0,0 +1,71 @@
+/**
+ * Copyright (c) 2018-2019 Linagora
+ *
+ * This program/library is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * This program/library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program/library; If not, see http://www.gnu.org/licenses/
+ * for the GNU Lesser General Public License version 2.1.
+
+ */
+package org.ow2.petals.deployer.utils;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.net.URISyntaxException;
+import java.nio.file.Files;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipOutputStream;
+
+public class ZipUtils {
+ private static final int DEFAULT_BUFFER_SIZE = 1024;
+
+ /**
+ * Return a zip archive of a directory (the directory is considered the root of the archive).
+ *
+ * The created zip archive is a temporary file.
+ *
+ * @param resourcePath
+ * The path to the directory in resources
+ * @return The zip file created
+ * @throws IOException
+ * @throws URISyntaxException
+ */
+ public static File createZipFromResourceDirectory(String resourcePath) throws IOException, URISyntaxException {
+ File zip = Files.createTempFile(null, null).toFile();
+ File resource = new File(Thread.currentThread().getContextClassLoader().getResource(resourcePath).toURI());
+ ZipOutputStream zos = new ZipOutputStream(new FileOutputStream(zip));
+ for (File file : resource.listFiles()) {
+ addDirectoryToZip("", file, zos);
+ }
+ zos.close();
+ return zip;
+ }
+
+ private static void addDirectoryToZip(String prefix, File file, ZipOutputStream zos) throws IOException {
+ if (file.isDirectory()) {
+ for (File child : file.listFiles()) {
+ addDirectoryToZip(prefix + file.getName() + "/", child, zos);
+ }
+ } else {
+ zos.putNextEntry(new ZipEntry(prefix + file.getName()));
+ FileInputStream fis = new FileInputStream(file);
+ byte[] buffer = new byte[DEFAULT_BUFFER_SIZE];
+ while (fis.available() > 0) {
+ int read = fis.read(buffer, 0, buffer.length);
+ zos.write(buffer, 0, read);
+ }
+ fis.close();
+ }
+ }
+}
diff --git a/src/test/resources/artifacts/petals-bc-soap-5.0.0/META-INF/jbi.xml b/src/test/resources/artifacts/petals-bc-soap-5.0.0/META-INF/jbi.xml
new file mode 100644
index 0000000..3bdaf6a
--- /dev/null
+++ b/src/test/resources/artifacts/petals-bc-soap-5.0.0/META-INF/jbi.xml
@@ -0,0 +1,217 @@
+
+
+
+
+
+ petals-bc-soap
+ The PEtALS SOAP JBI binding component based on Axis2 and Jetty.
+
+ org.ow2.petals.binding.soap.SoapComponent
+
+ velocity-1.5.jar
+ axis2-mtompolicy-1.7.7.jar
+ xml-resolver-1.2.jar
+ easycommons-stream-1.4.0.jar
+ serializer-2.7.1.jar
+ jcip-annotations-1.0.jar
+ jetty-servlet-9.4.11.v20180605.jar
+ commons-httpclient-3.1.jar
+ petals-cdk-steplog-1.1.1.jar
+ esapi-2.0GA.jar
+ petals-bc-soap-5.0.0.jar
+ woodstox-core-asl-4.2.0.jar
+ httpclient-4.5.2.jar
+ petals-cdk-api-2.6.1.jar
+ commons-lang-2.1.jar
+ rampart-core-1.7.1.jar
+ xalan-2.7.1.jar
+ petals-probes-api-1.3.0.jar
+ wsdl4j-1.6.2.jar
+ jaxb2-basics-runtime-0.11.1.jar
+ axis2-transport-jms-1.7.7.jar
+ easycommons-util-2.5.0.jar
+ bcprov-jdk15on-1.59.jar
+ javax.servlet-api-3.1.0.jar
+ jetty-security-9.4.11.v20180605.jar
+ mex-1.7.6-impl.jar
+ wss4j-1.6.16.jar
+ axiom-impl-1.2.20.jar
+ geronimo-jms_1.1_spec-1.1.jar
+ petals-probes-1.3.0.jar
+ easywsdl-ext-wsdl4complexwsdl-2.7.0.jar
+ easywsdl-wsdl-2.7.0.jar
+ jetty-server-9.4.11.v20180605.jar
+ rampart-trust-1.7.1.jar
+ petals-cdk-core-5.7.1.jar
+ jetty-io-9.4.11.v20180605.jar
+ addressing-1.7.7.mar
+ commons-codec-1.9.jar
+ stax2-api-3.1.1.jar
+ commons-fileupload-1.3.3.jar
+ xmltooling-1.3.2-1.jar
+ rampart-1.7.1.mar
+ petals-cdk-jbidescriptor-2.6.1.jar
+ axiom-dom-1.2.20.jar
+ opensaml-2.5.1-1.jar
+ xmlschema-core-2.2.1.jar
+ woden-core-1.0M10.jar
+ commons-collections-3.1.jar
+ rampart-policy-1.7.1.jar
+ jaxb-impl-2.2.11.jar
+ easywsdl-schema-2.7.0.jar
+ openws-1.4.2-1.jar
+ petals-cdk-clientserver-api-1.2.1.jar
+ axiom-api-1.2.20.jar
+ geronimo-jta_1.1_spec-1.1.jar
+ petals-bc-soap-clientserver-api-1.2.0.jar
+ jetty-http-9.4.11.v20180605.jar
+ axis2-transport-base-1.7.7.jar
+ petals-jbi-descriptor-2.4.0.jar
+ axis2-kernel-1.7.7.jar
+ apache-mime4j-core-0.7.2.jar
+ neethi-3.0.3.jar
+ jaxen-1.1.6.jar
+ petals-basis-api-1.1.0.jar
+ axis2-transport-http-1.7.7.jar
+ joda-time-1.6.2.jar
+ jaxb-core-2.2.11.jar
+ xmlunit-1.6.jar
+ jsr311-api-1.1.1.jar
+ xmlsec-1.5.8.jar
+ commons-io-2.6.jar
+ jetty-util-9.4.11.v20180605.jar
+ javax.mail-1.5.6.jar
+ commons-httpclient-contrib-3.1.jar
+ httpcore-4.4.4.jar
+
+ org.ow2.petals.binding.soap.SoapBootstrap
+
+ velocity-1.5.jar
+ axis2-mtompolicy-1.7.7.jar
+ xml-resolver-1.2.jar
+ easycommons-stream-1.4.0.jar
+ serializer-2.7.1.jar
+ jcip-annotations-1.0.jar
+ jetty-servlet-9.4.11.v20180605.jar
+ commons-httpclient-3.1.jar
+ petals-cdk-steplog-1.1.1.jar
+ esapi-2.0GA.jar
+ petals-bc-soap-5.0.0.jar
+ woodstox-core-asl-4.2.0.jar
+ httpclient-4.5.2.jar
+ petals-cdk-api-2.6.1.jar
+ commons-lang-2.1.jar
+ rampart-core-1.7.1.jar
+ xalan-2.7.1.jar
+ petals-probes-api-1.3.0.jar
+ wsdl4j-1.6.2.jar
+ jaxb2-basics-runtime-0.11.1.jar
+ axis2-transport-jms-1.7.7.jar
+ easycommons-util-2.5.0.jar
+ bcprov-jdk15on-1.59.jar
+ javax.servlet-api-3.1.0.jar
+ jetty-security-9.4.11.v20180605.jar
+ mex-1.7.6-impl.jar
+ wss4j-1.6.16.jar
+ axiom-impl-1.2.20.jar
+ geronimo-jms_1.1_spec-1.1.jar
+ petals-probes-1.3.0.jar
+ easywsdl-ext-wsdl4complexwsdl-2.7.0.jar
+ easywsdl-wsdl-2.7.0.jar
+ jetty-server-9.4.11.v20180605.jar
+ rampart-trust-1.7.1.jar
+ petals-cdk-core-5.7.1.jar
+ jetty-io-9.4.11.v20180605.jar
+ addressing-1.7.7.mar
+ commons-codec-1.9.jar
+ stax2-api-3.1.1.jar
+ commons-fileupload-1.3.3.jar
+ xmltooling-1.3.2-1.jar
+ rampart-1.7.1.mar
+ petals-cdk-jbidescriptor-2.6.1.jar
+ axiom-dom-1.2.20.jar
+ opensaml-2.5.1-1.jar
+ xmlschema-core-2.2.1.jar
+ woden-core-1.0M10.jar
+ commons-collections-3.1.jar
+ rampart-policy-1.7.1.jar
+ jaxb-impl-2.2.11.jar
+ easywsdl-schema-2.7.0.jar
+ openws-1.4.2-1.jar
+ petals-cdk-clientserver-api-1.2.1.jar
+ axiom-api-1.2.20.jar
+ geronimo-jta_1.1_spec-1.1.jar
+ petals-bc-soap-clientserver-api-1.2.0.jar
+ jetty-http-9.4.11.v20180605.jar
+ axis2-transport-base-1.7.7.jar
+ petals-jbi-descriptor-2.4.0.jar
+ axis2-kernel-1.7.7.jar
+ apache-mime4j-core-0.7.2.jar
+ neethi-3.0.3.jar
+ jaxen-1.1.6.jar
+ petals-basis-api-1.1.0.jar
+ axis2-transport-http-1.7.7.jar
+ joda-time-1.6.2.jar
+ jaxb-core-2.2.11.jar
+ xmlunit-1.6.jar
+ jsr311-api-1.1.1.jar
+ xmlsec-1.5.8.jar
+ commons-io-2.6.jar
+ jetty-util-9.4.11.v20180605.jar
+ javax.mail-1.5.6.jar
+ commons-httpclient-contrib-3.1.jar
+ httpcore-4.4.4.jar
+
+
+
+
+
+
+
+
+
+
+
+
+ org.ow2.petals.binding.soap.listener.outgoing.JBIListener
+ 8084
+
+ true
+ petals
+ services
+ 2
+ 50
+ 4
+ 50
+
+ false
+ 8083
+
+
+
+
+
+
+
+
+ 4
+ 50
+ true
+
+
diff --git a/src/test/resources/artifacts/sa-SOAP-Hello_PortType-consume/META-INF/jbi.xml b/src/test/resources/artifacts/sa-SOAP-Hello_PortType-consume/META-INF/jbi.xml
new file mode 100644
index 0000000..32d540d
--- /dev/null
+++ b/src/test/resources/artifacts/sa-SOAP-Hello_PortType-consume/META-INF/jbi.xml
@@ -0,0 +1,40 @@
+
+
+
+
+
+
+ sa-SOAP-Hello_PortType-consume
+
+
+
+
+
+
+ su-SOAP-Hello_PortType-consume
+
+
+
+
+ su-SOAP-Hello_PortType-consume.zip
+ petals-bc-soap
+
+
+
+
\ No newline at end of file
diff --git a/src/test/resources/artifacts/sa-SOAP-Hello_Service1-provide/META-INF/jbi.xml b/src/test/resources/artifacts/sa-SOAP-Hello_Service1-provide/META-INF/jbi.xml
new file mode 100644
index 0000000..61c8e1c
--- /dev/null
+++ b/src/test/resources/artifacts/sa-SOAP-Hello_Service1-provide/META-INF/jbi.xml
@@ -0,0 +1,40 @@
+
+
+
+
+
+
+ sa-SOAP-Hello_Service1-provide
+
+
+
+
+
+
+ su-SOAP-Hello_Service1-provide
+
+
+
+
+ su-SOAP-Hello_Service1-provide.zip
+ petals-bc-soap
+
+
+
+
\ No newline at end of file
diff --git a/src/test/resources/artifacts/sa-SOAP-Hello_Service2-provide/META-INF/jbi.xml b/src/test/resources/artifacts/sa-SOAP-Hello_Service2-provide/META-INF/jbi.xml
new file mode 100644
index 0000000..53ffa5d
--- /dev/null
+++ b/src/test/resources/artifacts/sa-SOAP-Hello_Service2-provide/META-INF/jbi.xml
@@ -0,0 +1,40 @@
+
+
+
+
+
+
+ sa-SOAP-Hello_Service2-provide
+
+
+
+
+
+
+ su-SOAP-Hello_Service2-provide
+
+
+
+
+ su-SOAP-Hello_Service2-provide.zip
+ petals-bc-soap
+
+
+
+
\ No newline at end of file
diff --git a/src/test/resources/model.xml b/src/test/resources/model.xml
new file mode 100644
index 0000000..441b70d
--- /dev/null
+++ b/src/test/resources/model.xml
@@ -0,0 +1,55 @@
+
+
+
+
+
+ file:/su-SOAP-Hello_Service1-provide.zip
+
+
+ file:/su-SOAP-Hello_Service2-provide.zip
+
+
+ file:/su-SOAP-Hello_PortType-consume.zip
+
+
+
+
+ file:/petals-bc-soap.zip
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ localhost
+
+
+