diff options
120 files changed, 111 insertions, 12919 deletions
diff --git a/assembly/features/org.eclipse.jpt.sdk/.cvsignore b/assembly/features/org.eclipse.jpt.sdk/.cvsignore deleted file mode 100644 index bc2abf75c1..0000000000 --- a/assembly/features/org.eclipse.jpt.sdk/.cvsignore +++ /dev/null @@ -1,4 +0,0 @@ -*.bin.dist.zip -build.xml -features -plugins diff --git a/assembly/features/org.eclipse.jpt.sdk/.project b/assembly/features/org.eclipse.jpt.sdk/.project deleted file mode 100644 index 821d453136..0000000000 --- a/assembly/features/org.eclipse.jpt.sdk/.project +++ /dev/null @@ -1,17 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<projectDescription> - <name>org.eclipse.jpt.sdk</name> - <comment></comment> - <projects> - </projects> - <buildSpec> - <buildCommand> - <name>org.eclipse.pde.FeatureBuilder</name> - <arguments> - </arguments> - </buildCommand> - </buildSpec> - <natures> - <nature>org.eclipse.pde.FeatureNature</nature> - </natures> -</projectDescription> diff --git a/assembly/features/org.eclipse.jpt.sdk/build.properties b/assembly/features/org.eclipse.jpt.sdk/build.properties deleted file mode 100644 index 7200939aca..0000000000 --- a/assembly/features/org.eclipse.jpt.sdk/build.properties +++ /dev/null @@ -1,15 +0,0 @@ -############################################################################### -# Copyright (c) 2006 Oracle. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# Oracle. - initial API and implementation -############################################################################### -bin.includes = feature.xml,\ - eclipse_update_120.jpg,\ - epl-v10.html,\ - license.html,\ - feature.properties diff --git a/assembly/features/org.eclipse.jpt.sdk/eclipse_update_120.jpg b/assembly/features/org.eclipse.jpt.sdk/eclipse_update_120.jpg Binary files differdeleted file mode 100644 index bfdf708ad6..0000000000 --- a/assembly/features/org.eclipse.jpt.sdk/eclipse_update_120.jpg +++ /dev/null diff --git a/assembly/features/org.eclipse.jpt.sdk/epl-v10.html b/assembly/features/org.eclipse.jpt.sdk/epl-v10.html deleted file mode 100644 index ed4b196655..0000000000 --- a/assembly/features/org.eclipse.jpt.sdk/epl-v10.html +++ /dev/null @@ -1,328 +0,0 @@ -<html xmlns:o="urn:schemas-microsoft-com:office:office" -xmlns:w="urn:schemas-microsoft-com:office:word" -xmlns="http://www.w3.org/TR/REC-html40"> - -<head> -<meta http-equiv=Content-Type content="text/html; charset=windows-1252"> -<meta name=ProgId content=Word.Document> -<meta name=Generator content="Microsoft Word 9"> -<meta name=Originator content="Microsoft Word 9"> -<link rel=File-List -href="./Eclipse%20EPL%202003_11_10%20Final_files/filelist.xml"> -<title>Eclipse Public License - Version 1.0</title> -<!--[if gte mso 9]><xml> - <o:DocumentProperties> - <o:Revision>2</o:Revision> - <o:TotalTime>3</o:TotalTime> - <o:Created>2004-03-05T23:03:00Z</o:Created> - <o:LastSaved>2004-03-05T23:03:00Z</o:LastSaved> - <o:Pages>4</o:Pages> - <o:Words>1626</o:Words> - <o:Characters>9270</o:Characters> - <o:Lines>77</o:Lines> - <o:Paragraphs>18</o:Paragraphs> - <o:CharactersWithSpaces>11384</o:CharactersWithSpaces> - <o:Version>9.4402</o:Version> - </o:DocumentProperties> -</xml><![endif]--><!--[if gte mso 9]><xml> - <w:WordDocument> - <w:TrackRevisions/> - </w:WordDocument> -</xml><![endif]--> -<style> -<!-- - /* Font Definitions */ -@font-face - {font-family:Tahoma; - panose-1:2 11 6 4 3 5 4 4 2 4; - mso-font-charset:0; - mso-generic-font-family:swiss; - mso-font-pitch:variable; - mso-font-signature:553679495 -2147483648 8 0 66047 0;} - /* Style Definitions */ -p.MsoNormal, li.MsoNormal, div.MsoNormal - {mso-style-parent:""; - margin:0in; - margin-bottom:.0001pt; - mso-pagination:widow-orphan; - font-size:12.0pt; - font-family:"Times New Roman"; - mso-fareast-font-family:"Times New Roman";} -p - {margin-right:0in; - mso-margin-top-alt:auto; - mso-margin-bottom-alt:auto; - margin-left:0in; - mso-pagination:widow-orphan; - font-size:12.0pt; - font-family:"Times New Roman"; - mso-fareast-font-family:"Times New Roman";} -p.BalloonText, li.BalloonText, div.BalloonText - {mso-style-name:"Balloon Text"; - margin:0in; - margin-bottom:.0001pt; - mso-pagination:widow-orphan; - font-size:8.0pt; - font-family:Tahoma; - mso-fareast-font-family:"Times New Roman";} -@page Section1 - {size:8.5in 11.0in; - margin:1.0in 1.25in 1.0in 1.25in; - mso-header-margin:.5in; - mso-footer-margin:.5in; - mso-paper-source:0;} -div.Section1 - {page:Section1;} ---> -</style> -</head> - -<body lang=EN-US style='tab-interval:.5in'> - -<div class=Section1> - -<p align=center style='text-align:center'><b>Eclipse Public License - v 1.0</b> -</p> - -<p><span style='font-size:10.0pt'>THE ACCOMPANYING PROGRAM IS PROVIDED UNDER -THE TERMS OF THIS ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE, -REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE -OF THIS AGREEMENT.</span> </p> - -<p><b><span style='font-size:10.0pt'>1. DEFINITIONS</span></b> </p> - -<p><span style='font-size:10.0pt'>"Contribution" means:</span> </p> - -<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a) -in the case of the initial Contributor, the initial code and documentation -distributed under this Agreement, and<br clear=left> -b) in the case of each subsequent Contributor:</span></p> - -<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>i) -changes to the Program, and</span></p> - -<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>ii) -additions to the Program;</span></p> - -<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>where -such changes and/or additions to the Program originate from and are distributed -by that particular Contributor. A Contribution 'originates' from a Contributor -if it was added to the Program by such Contributor itself or anyone acting on -such Contributor's behalf. Contributions do not include additions to the -Program which: (i) are separate modules of software distributed in conjunction -with the Program under their own license agreement, and (ii) are not derivative -works of the Program. </span></p> - -<p><span style='font-size:10.0pt'>"Contributor" means any person or -entity that distributes the Program.</span> </p> - -<p><span style='font-size:10.0pt'>"Licensed Patents " mean patent -claims licensable by a Contributor which are necessarily infringed by the use -or sale of its Contribution alone or when combined with the Program. </span></p> - -<p><span style='font-size:10.0pt'>"Program" means the Contributions -distributed in accordance with this Agreement.</span> </p> - -<p><span style='font-size:10.0pt'>"Recipient" means anyone who -receives the Program under this Agreement, including all Contributors.</span> </p> - -<p><b><span style='font-size:10.0pt'>2. GRANT OF RIGHTS</span></b> </p> - -<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a) -Subject to the terms of this Agreement, each Contributor hereby grants Recipient -a non-exclusive, worldwide, royalty-free copyright license to<span -style='color:red'> </span>reproduce, prepare derivative works of, publicly -display, publicly perform, distribute and sublicense the Contribution of such -Contributor, if any, and such derivative works, in source code and object code -form.</span></p> - -<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>b) -Subject to the terms of this Agreement, each Contributor hereby grants -Recipient a non-exclusive, worldwide,<span style='color:green'> </span>royalty-free -patent license under Licensed Patents to make, use, sell, offer to sell, import -and otherwise transfer the Contribution of such Contributor, if any, in source -code and object code form. This patent license shall apply to the combination -of the Contribution and the Program if, at the time the Contribution is added -by the Contributor, such addition of the Contribution causes such combination -to be covered by the Licensed Patents. The patent license shall not apply to -any other combinations which include the Contribution. No hardware per se is -licensed hereunder. </span></p> - -<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>c) -Recipient understands that although each Contributor grants the licenses to its -Contributions set forth herein, no assurances are provided by any Contributor -that the Program does not infringe the patent or other intellectual property -rights of any other entity. Each Contributor disclaims any liability to Recipient -for claims brought by any other entity based on infringement of intellectual -property rights or otherwise. As a condition to exercising the rights and -licenses granted hereunder, each Recipient hereby assumes sole responsibility -to secure any other intellectual property rights needed, if any. For example, -if a third party patent license is required to allow Recipient to distribute -the Program, it is Recipient's responsibility to acquire that license before -distributing the Program.</span></p> - -<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>d) -Each Contributor represents that to its knowledge it has sufficient copyright -rights in its Contribution, if any, to grant the copyright license set forth in -this Agreement. </span></p> - -<p><b><span style='font-size:10.0pt'>3. REQUIREMENTS</span></b> </p> - -<p><span style='font-size:10.0pt'>A Contributor may choose to distribute the -Program in object code form under its own license agreement, provided that:</span> -</p> - -<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a) -it complies with the terms and conditions of this Agreement; and</span></p> - -<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>b) -its license agreement:</span></p> - -<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>i) -effectively disclaims on behalf of all Contributors all warranties and -conditions, express and implied, including warranties or conditions of title -and non-infringement, and implied warranties or conditions of merchantability -and fitness for a particular purpose; </span></p> - -<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>ii) -effectively excludes on behalf of all Contributors all liability for damages, -including direct, indirect, special, incidental and consequential damages, such -as lost profits; </span></p> - -<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>iii) -states that any provisions which differ from this Agreement are offered by that -Contributor alone and not by any other party; and</span></p> - -<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>iv) -states that source code for the Program is available from such Contributor, and -informs licensees how to obtain it in a reasonable manner on or through a -medium customarily used for software exchange.<span style='color:blue'> </span></span></p> - -<p><span style='font-size:10.0pt'>When the Program is made available in source -code form:</span> </p> - -<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a) -it must be made available under this Agreement; and </span></p> - -<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>b) a -copy of this Agreement must be included with each copy of the Program. </span></p> - -<p><span style='font-size:10.0pt'>Contributors may not remove or alter any -copyright notices contained within the Program. </span></p> - -<p><span style='font-size:10.0pt'>Each Contributor must identify itself as the -originator of its Contribution, if any, in a manner that reasonably allows -subsequent Recipients to identify the originator of the Contribution. </span></p> - -<p><b><span style='font-size:10.0pt'>4. COMMERCIAL DISTRIBUTION</span></b> </p> - -<p><span style='font-size:10.0pt'>Commercial distributors of software may -accept certain responsibilities with respect to end users, business partners -and the like. While this license is intended to facilitate the commercial use -of the Program, the Contributor who includes the Program in a commercial -product offering should do so in a manner which does not create potential -liability for other Contributors. Therefore, if a Contributor includes the -Program in a commercial product offering, such Contributor ("Commercial -Contributor") hereby agrees to defend and indemnify every other -Contributor ("Indemnified Contributor") against any losses, damages and -costs (collectively "Losses") arising from claims, lawsuits and other -legal actions brought by a third party against the Indemnified Contributor to -the extent caused by the acts or omissions of such Commercial Contributor in -connection with its distribution of the Program in a commercial product -offering. The obligations in this section do not apply to any claims or Losses -relating to any actual or alleged intellectual property infringement. In order -to qualify, an Indemnified Contributor must: a) promptly notify the Commercial -Contributor in writing of such claim, and b) allow the Commercial Contributor -to control, and cooperate with the Commercial Contributor in, the defense and -any related settlement negotiations. The Indemnified Contributor may participate -in any such claim at its own expense.</span> </p> - -<p><span style='font-size:10.0pt'>For example, a Contributor might include the -Program in a commercial product offering, Product X. That Contributor is then a -Commercial Contributor. If that Commercial Contributor then makes performance -claims, or offers warranties related to Product X, those performance claims and -warranties are such Commercial Contributor's responsibility alone. Under this -section, the Commercial Contributor would have to defend claims against the -other Contributors related to those performance claims and warranties, and if a -court requires any other Contributor to pay any damages as a result, the -Commercial Contributor must pay those damages.</span> </p> - -<p><b><span style='font-size:10.0pt'>5. NO WARRANTY</span></b> </p> - -<p><span style='font-size:10.0pt'>EXCEPT AS EXPRESSLY SET FORTH IN THIS -AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT -WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, -WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, -MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely -responsible for determining the appropriateness of using and distributing the -Program and assumes all risks associated with its exercise of rights under this -Agreement , including but not limited to the risks and costs of program errors, -compliance with applicable laws, damage to or loss of data, programs or -equipment, and unavailability or interruption of operations. </span></p> - -<p><b><span style='font-size:10.0pt'>6. DISCLAIMER OF LIABILITY</span></b> </p> - -<p><span style='font-size:10.0pt'>EXCEPT AS EXPRESSLY SET FORTH IN THIS -AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR -ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF -THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF -THE POSSIBILITY OF SUCH DAMAGES.</span> </p> - -<p><b><span style='font-size:10.0pt'>7. GENERAL</span></b> </p> - -<p><span style='font-size:10.0pt'>If any provision of this Agreement is invalid -or unenforceable under applicable law, it shall not affect the validity or -enforceability of the remainder of the terms of this Agreement, and without -further action by the parties hereto, such provision shall be reformed to the -minimum extent necessary to make such provision valid and enforceable.</span> </p> - -<p><span style='font-size:10.0pt'>If Recipient institutes patent litigation -against any entity (including a cross-claim or counterclaim in a lawsuit) -alleging that the Program itself (excluding combinations of the Program with -other software or hardware) infringes such Recipient's patent(s), then such -Recipient's rights granted under Section 2(b) shall terminate as of the date -such litigation is filed. </span></p> - -<p><span style='font-size:10.0pt'>All Recipient's rights under this Agreement -shall terminate if it fails to comply with any of the material terms or -conditions of this Agreement and does not cure such failure in a reasonable -period of time after becoming aware of such noncompliance. If all Recipient's -rights under this Agreement terminate, Recipient agrees to cease use and -distribution of the Program as soon as reasonably practicable. However, -Recipient's obligations under this Agreement and any licenses granted by -Recipient relating to the Program shall continue and survive. </span></p> - -<p><span style='font-size:10.0pt'>Everyone is permitted to copy and distribute -copies of this Agreement, but in order to avoid inconsistency the Agreement is -copyrighted and may only be modified in the following manner. The Agreement -Steward reserves the right to publish new versions (including revisions) of -this Agreement from time to time. No one other than the Agreement Steward has -the right to modify this Agreement. The Eclipse Foundation is the initial -Agreement Steward. The Eclipse Foundation may assign the responsibility to -serve as the Agreement Steward to a suitable separate entity. Each new version -of the Agreement will be given a distinguishing version number. The Program -(including Contributions) may always be distributed subject to the version of -the Agreement under which it was received. In addition, after a new version of -the Agreement is published, Contributor may elect to distribute the Program -(including its Contributions) under the new version. Except as expressly stated -in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to -the intellectual property of any Contributor under this Agreement, whether -expressly, by implication, estoppel or otherwise. All rights in the Program not -expressly granted under this Agreement are reserved.</span> </p> - -<p><span style='font-size:10.0pt'>This Agreement is governed by the laws of the -State of New York and the intellectual property laws of the United States of -America. No party to this Agreement will bring a legal action under this -Agreement more than one year after the cause of action arose. Each party waives -its rights to a jury trial in any resulting litigation.</span> </p> - -<p class=MsoNormal><![if !supportEmptyParas]> <![endif]><o:p></o:p></p> - -</div> - -</body> - -</html>
\ No newline at end of file diff --git a/assembly/features/org.eclipse.jpt.sdk/feature.properties b/assembly/features/org.eclipse.jpt.sdk/feature.properties deleted file mode 100644 index fe3c0c8494..0000000000 --- a/assembly/features/org.eclipse.jpt.sdk/feature.properties +++ /dev/null @@ -1,144 +0,0 @@ -############################################################################### -# Copyright (c) 2006 Oracle. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# Oracle. - initial API and implementation -############################################################################### -# feature.properties -# contains externalized strings for feature.xml -# "%foo" in feature.xml corresponds to the key "foo" in this file -# java.io.Properties file (ISO 8859-1 with "\" escapes) -# This file should be translated. - -# "featureName" property - name of the feature -featureName=Dali Java Persistence API (JPA) project SDK - -# "providerName" property - name of the company that provides the feature -providerName=Eclipse.org - -# "updateSiteName" property - label for the update site -updateSiteName=The Eclipse Web Tools Platform (WTP) Project update site - -# "description" property - description of the feature -description=Dali Java Persistence API (JPA) project SDK - -# "copyright" property - text of the "Feature Update Copyright" -copyright=\ -Copyright (c) 2006 Oracle Corporation.\n\ -All rights reserved. This program and the accompanying materials\n\ -are made available under the terms of the Eclipse Public License v1.0\n\ -which accompanies this distribution, and is available at\n\ -http://www.eclipse.org/legal/epl-v10.html\n\ -\n\ -Contributors:\n\ - Oracle - initial API and implementation\n -################ end of copyright property #################################### - -# "licenseURL" property - URL of the "Feature License" -# do not translate value - just change to point to a locale-specific HTML page -licenseURL=license.html - -# "license" property - text of the "Feature Update License" -# should be plain text version of license agreement pointed to be "licenseURL" -license=\ -ECLIPSE FOUNDATION SOFTWARE USER AGREEMENT\n\ -March 17, 2005\n\ -\n\ -Usage Of Content\n\ -\n\ -THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR\n\ -OTHER MATERIALS FOR OPEN SOURCE PROJECTS (COLLECTIVELY "CONTENT").\n\ -USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS\n\ -AGREEMENT AND/OR THE TERMS AND CONDITIONS OF LICENSE AGREEMENTS OR\n\ -NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU\n\ -AGREE THAT YOUR USE OF THE CONTENT IS GOVERNED BY THIS AGREEMENT\n\ -AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS\n\ -OR NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE\n\ -TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND CONDITIONS\n\ -OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED\n\ -BELOW, THEN YOU MAY NOT USE THE CONTENT.\n\ -\n\ -Applicable Licenses\n\ -\n\ -Unless otherwise indicated, all Content made available by the Eclipse Foundation\n\ -is provided to you under the terms and conditions of the Eclipse Public\n\ -License Version 1.0 ("EPL"). A copy of the EPL is provided with this\n\ -Content and is also available at http://www.eclipse.org/legal/epl-v10.html.\n\ -For purposes of the EPL, "Program" will mean the Content.\n\ -\n\ -Content includes, but is not limited to, source code, object code,\n\ -documentation and other files maintained in the Eclipse.org CVS\n\ -repository ("Repository") in CVS modules ("Modules") and made available\n\ -as downloadable archives ("Downloads").\n\ -\n\ - - Content may be structured and packaged into modules to facilitate delivering,\n\ - extending, and upgrading the Content. Typical modules may include plug-ins ("Plug-ins"),\n\ - plug-in fragments ("Fragments"), and features ("Features").\n\ - - Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java? ARchive)\n\ - in a directory named "plugins".\n\ - - A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material.\n\ - Each Feature may be packaged as a sub-directory in a directory named "features".\n\ - Within a Feature, files named "feature.xml" may contain a list of the names and version\n\ - numbers of the Plug-ins and/or Fragments associated with that Feature.\n\ - - Features may also include other Features ("Included Features"). Within a Feature, files\n\ - named "feature.xml" may contain a list of the names and version numbers of Included Features.\n\ -\n\ -Features may also include other Features ("Included Features"). Files named\n\ -"feature.xml" may contain a list of the names and version numbers of\n\ -Included Features.\n\ -\n\ -The terms and conditions governing Plug-ins and Fragments should be\n\ -contained in files named "about.html" ("Abouts"). The terms and\n\ -conditions governing Features and Included Features should be contained\n\ -in files named "license.html" ("Feature Licenses"). Abouts and Feature\n\ -Licenses may be located in any directory of a Download or Module\n\ -including, but not limited to the following locations:\n\ -\n\ - - The top-level (root) directory\n\ - - Plug-in and Fragment directories\n\ - - Inside Plug-ins and Fragments packaged as JARs\n\ - - Sub-directories of the directory named "src" of certain Plug-ins\n\ - - Feature directories\n\ -\n\ -Note: if a Feature made available by the Eclipse Foundation is installed using the\n\ -Eclipse Update Manager, you must agree to a license ("Feature Update\n\ -License") during the installation process. If the Feature contains\n\ -Included Features, the Feature Update License should either provide you\n\ -with the terms and conditions governing the Included Features or inform\n\ -you where you can locate them. Feature Update Licenses may be found in\n\ -the "license" property of files named "feature.properties". Such Abouts,\n\ -Feature Licenses and Feature Update Licenses contain the terms and\n\ -conditions (or references to such terms and conditions) that govern your\n\ -use of the associated Content in that directory.\n\ -\n\ -THE ABOUTS, FEATURE LICENSES AND FEATURE UPDATE LICENSES MAY REFER\n\ -TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS.\n\ -SOME OF THESE OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):\n\ -\n\ - - Common Public License Version 1.0 (available at http://www.eclipse.org/legal/cpl-v10.html)\n\ - - Apache Software License 1.1 (available at http://www.apache.org/licenses/LICENSE)\n\ - - Apache Software License 2.0 (available at http://www.apache.org/licenses/LICENSE-2.0)\n\ - - IBM Public License 1.0 (available at http://oss.software.ibm.com/developerworks/opensource/license10.html)\n\ - - Metro Link Public License 1.00 (available at http://www.opengroup.org/openmotif/supporters/metrolink/license.html)\n\ - - Mozilla Public License Version 1.1 (available at http://www.mozilla.org/MPL/MPL-1.1.html)\n\ -\n\ -IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR\n\ -TO USE OF THE CONTENT. If no About, Feature License or Feature Update License\n\ -is provided, please contact the Eclipse Foundation to determine what terms and conditions\n\ -govern that particular Content.\n\ -\n\ -Cryptography\n\ -\n\ -Content may contain encryption software. The country in which you are\n\ -currently may have restrictions on the import, possession, and use,\n\ -and/or re-export to another country, of encryption software. BEFORE\n\ -using any encryption software, please check the country's laws,\n\ -regulations and policies concerning the import, possession, or use,\n\ -and re-export of encryption software, to see if this is permitted.\n\ -\n\ -Java and all Java-based trademarks are trademarks of Sun Microsystems, Inc. in the United States, other countries, or both.\n -########### end of license property ########################################## diff --git a/assembly/features/org.eclipse.jpt.sdk/feature.xml b/assembly/features/org.eclipse.jpt.sdk/feature.xml deleted file mode 100644 index 4b10e054bb..0000000000 --- a/assembly/features/org.eclipse.jpt.sdk/feature.xml +++ /dev/null @@ -1,38 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<feature - id="org.eclipse.jpt.sdk" - label="%featureName" - version="1.0.0.qualifier" - provider-name="%providerName" - plugin="org.eclipse.jpt" - image="eclipse_update_120.jpg"> - - <description> - %description - </description> - - <license url="license.html"> - %license - </license> - - <copyright> - %copyright - </copyright> - - <url> - <update label="%updateSiteName" url="http://download.eclipse.org/webtools/updates"/> - <discovery label="Web Tools Platform (WTP) Updates" url="http://download.eclipse.org/webtools/updates"/> - </url> - - <includes - id="org.eclipse.jpt_sdk.feature" - version="0.0.0"/> - - <plugin - id="org.eclipse.jpt" - download-size="0" - install-size="0" - version="0.0.0" - unpack="false"/> - -</feature> diff --git a/assembly/features/org.eclipse.jpt.sdk/license.html b/assembly/features/org.eclipse.jpt.sdk/license.html deleted file mode 100644 index 2347060ef3..0000000000 --- a/assembly/features/org.eclipse.jpt.sdk/license.html +++ /dev/null @@ -1,93 +0,0 @@ -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd"> -<!-- saved from url=(0044)http://www.eclipse.org/legal/epl/notice.html --> -<HTML><HEAD><TITLE>Eclipse.org Software User Agreement</TITLE> -<META http-equiv=Content-Type content="text/html; charset=iso-8859-1"> -<META content="MSHTML 6.00.2800.1479" name=GENERATOR></HEAD> -<BODY lang=EN-US vLink=purple link=blue> -<H2>Eclipse Foundation Software User Agreement</H2> -<P>January 28, 2005</P> -<H3>Usage Of Content</H3> -<P>THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION -AND/OR OTHER MATERIALS FOR OPEN SOURCE PROJECTS (COLLECTIVELY "CONTENT"). USE OF -THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS AGREEMENT AND/OR THE -TERMS AND CONDITIONS OF LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED -BELOW. BY USING THE CONTENT, YOU AGREE THAT YOUR USE OF THE CONTENT IS GOVERNED -BY THIS AGREEMENT AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE -AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE -TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND CONDITIONS OF ANY -APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW, THEN YOU -MAY NOT USE THE CONTENT.</P> -<H3>Applicable Licenses</H3> -<P>Unless otherwise indicated, all Content made available by the Eclipse -Foundation is provided to you under the terms and conditions of the Eclipse -Public License Version 1.0 ("EPL"). A copy of the EPL is provided with this -Content and is also available at <A -href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</A>. -For purposes of the EPL, "Program" will mean the Content.</P> -<P>Content includes, but is not limited to, source code, object code, -documentation and other files maintained in the Eclipse.org CVS repository -("Repository") in CVS modules ("Modules") and made available as downloadable -archives ("Downloads").</P> -<P>Content may be apportioned into plug-ins ("Plug-ins"), plug-in fragments -("Fragments"), and features ("Features"). A Feature is a bundle of one or more -Plug-ins and/or Fragments and associated material. Files named "feature.xml" may -contain a list of the names and version numbers of the Plug-ins and/or Fragments -associated with a Feature. Plug-ins and Fragments are located in directories -named "plugins" and Features are located in directories named "features".</P> -<P>Features may also include other Features ("Included Features"). Files named -"feature.xml" may contain a list of the names and version numbers of Included -Features.</P> -<P>The terms and conditions governing Plug-ins and Fragments should be contained -in files named "about.html" ("Abouts"). The terms and conditions governing -Features and Included Features should be contained in files named "license.html" -("Feature Licenses"). Abouts and Feature Licenses may be located in any -directory of a Download or Module including, but not limited to the following -locations:</P> -<UL> - <LI>The top-level (root) directory - <LI>Plug-in and Fragment directories - <LI>Subdirectories of the directory named "src" of certain Plug-ins - <LI>Feature directories </LI></UL> -<P>Note: if a Feature made available by the Eclipse Foundation is installed -using the Eclipse Update Manager, you must agree to a license ("Feature Update -License") during the installation process. If the Feature contains Included -Features, the Feature Update License should either provide you with the terms -and conditions governing the Included Features or inform you where you can -locate them. Feature Update Licenses may be found in the "license" property of -files named "feature.properties". Such Abouts, Feature Licenses and Feature -Update Licenses contain the terms and conditions (or references to such terms -and conditions) that govern your use of the associated Content in that -directory.</P> -<P>THE ABOUTS, FEATURE LICENSES AND FEATURE UPDATE LICENSES MAY REFER TO THE EPL -OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS. SOME OF THESE -OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):</P> -<UL> - <LI>Common Public License Version 1.0 (available at <A - href="http://www.eclipse.org/legal/cpl-v10.html">http://www.eclipse.org/legal/cpl-v10.html</A>) - - <LI>Apache Software License 1.1 (available at <A - href="http://www.apache.org/licenses/LICENSE">http://www.apache.org/licenses/LICENSE</A>) - - <LI>Apache Software License 2.0 (available at <A - href="http://www.apache.org/licenses/LICENSE-2.0">http://www.apache.org/licenses/LICENSE-2.0</A>) - - <LI>IBM Public License 1.0 (available at <A - href="http://oss.software.ibm.com/developerworks/opensource/license10.html">http://oss.software.ibm.com/developerworks/opensource/license10.html</A>) - - <LI>Metro Link Public License 1.00 (available at <A - href="http://www.opengroup.org/openmotif/supporters/metrolink/license.html">http://www.opengroup.org/openmotif/supporters/metrolink/license.html</A>) - - <LI>Mozilla Public License Version 1.1 (available at <A - href="http://www.mozilla.org/MPL/MPL-1.1.html">http://www.mozilla.org/MPL/MPL-1.1.html</A>) - </LI></UL> -<P>IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR -TO USE OF THE CONTENT. If no About, Feature License or Feature Update License is -provided, please contact the Eclipse Foundation to determine what terms and -conditions govern that particular Content.</P> -<H3>Cryptography</H3> -<P>Content may contain encryption software. The country in which you are -currently may have restrictions on the import, possession, and use, and/or -re-export to another country, of encryption software. BEFORE using any -encryption software, please check the country's laws, regulations and policies -concerning the import, possession, or use, and re-export of encryption software, -to see if this is permitted.</P></BODY></HTML> diff --git a/assembly/features/org.eclipse.jpt.tests/.cvsignore b/assembly/features/org.eclipse.jpt.tests/.cvsignore deleted file mode 100644 index d9e4340782..0000000000 --- a/assembly/features/org.eclipse.jpt.tests/.cvsignore +++ /dev/null @@ -1,2 +0,0 @@ -*.bin.dist.zip -build.xml diff --git a/assembly/features/org.eclipse.jpt.tests/.project b/assembly/features/org.eclipse.jpt.tests/.project deleted file mode 100644 index 3d1dde631a..0000000000 --- a/assembly/features/org.eclipse.jpt.tests/.project +++ /dev/null @@ -1,17 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<projectDescription> - <name>org.eclipse.jpt.tests</name> - <comment></comment> - <projects> - </projects> - <buildSpec> - <buildCommand> - <name>org.eclipse.pde.FeatureBuilder</name> - <arguments> - </arguments> - </buildCommand> - </buildSpec> - <natures> - <nature>org.eclipse.pde.FeatureNature</nature> - </natures> -</projectDescription> diff --git a/assembly/features/org.eclipse.jpt.tests/build.properties b/assembly/features/org.eclipse.jpt.tests/build.properties deleted file mode 100644 index 7f47694aab..0000000000 --- a/assembly/features/org.eclipse.jpt.tests/build.properties +++ /dev/null @@ -1,5 +0,0 @@ -bin.includes = feature.xml,\ - eclipse_update_120.jpg,\ - epl-v10.html,\ - license.html,\ - feature.properties diff --git a/assembly/features/org.eclipse.jpt.tests/eclipse_update_120.jpg b/assembly/features/org.eclipse.jpt.tests/eclipse_update_120.jpg Binary files differdeleted file mode 100644 index bfdf708ad6..0000000000 --- a/assembly/features/org.eclipse.jpt.tests/eclipse_update_120.jpg +++ /dev/null diff --git a/assembly/features/org.eclipse.jpt.tests/epl-v10.html b/assembly/features/org.eclipse.jpt.tests/epl-v10.html deleted file mode 100644 index ed4b196655..0000000000 --- a/assembly/features/org.eclipse.jpt.tests/epl-v10.html +++ /dev/null @@ -1,328 +0,0 @@ -<html xmlns:o="urn:schemas-microsoft-com:office:office" -xmlns:w="urn:schemas-microsoft-com:office:word" -xmlns="http://www.w3.org/TR/REC-html40"> - -<head> -<meta http-equiv=Content-Type content="text/html; charset=windows-1252"> -<meta name=ProgId content=Word.Document> -<meta name=Generator content="Microsoft Word 9"> -<meta name=Originator content="Microsoft Word 9"> -<link rel=File-List -href="./Eclipse%20EPL%202003_11_10%20Final_files/filelist.xml"> -<title>Eclipse Public License - Version 1.0</title> -<!--[if gte mso 9]><xml> - <o:DocumentProperties> - <o:Revision>2</o:Revision> - <o:TotalTime>3</o:TotalTime> - <o:Created>2004-03-05T23:03:00Z</o:Created> - <o:LastSaved>2004-03-05T23:03:00Z</o:LastSaved> - <o:Pages>4</o:Pages> - <o:Words>1626</o:Words> - <o:Characters>9270</o:Characters> - <o:Lines>77</o:Lines> - <o:Paragraphs>18</o:Paragraphs> - <o:CharactersWithSpaces>11384</o:CharactersWithSpaces> - <o:Version>9.4402</o:Version> - </o:DocumentProperties> -</xml><![endif]--><!--[if gte mso 9]><xml> - <w:WordDocument> - <w:TrackRevisions/> - </w:WordDocument> -</xml><![endif]--> -<style> -<!-- - /* Font Definitions */ -@font-face - {font-family:Tahoma; - panose-1:2 11 6 4 3 5 4 4 2 4; - mso-font-charset:0; - mso-generic-font-family:swiss; - mso-font-pitch:variable; - mso-font-signature:553679495 -2147483648 8 0 66047 0;} - /* Style Definitions */ -p.MsoNormal, li.MsoNormal, div.MsoNormal - {mso-style-parent:""; - margin:0in; - margin-bottom:.0001pt; - mso-pagination:widow-orphan; - font-size:12.0pt; - font-family:"Times New Roman"; - mso-fareast-font-family:"Times New Roman";} -p - {margin-right:0in; - mso-margin-top-alt:auto; - mso-margin-bottom-alt:auto; - margin-left:0in; - mso-pagination:widow-orphan; - font-size:12.0pt; - font-family:"Times New Roman"; - mso-fareast-font-family:"Times New Roman";} -p.BalloonText, li.BalloonText, div.BalloonText - {mso-style-name:"Balloon Text"; - margin:0in; - margin-bottom:.0001pt; - mso-pagination:widow-orphan; - font-size:8.0pt; - font-family:Tahoma; - mso-fareast-font-family:"Times New Roman";} -@page Section1 - {size:8.5in 11.0in; - margin:1.0in 1.25in 1.0in 1.25in; - mso-header-margin:.5in; - mso-footer-margin:.5in; - mso-paper-source:0;} -div.Section1 - {page:Section1;} ---> -</style> -</head> - -<body lang=EN-US style='tab-interval:.5in'> - -<div class=Section1> - -<p align=center style='text-align:center'><b>Eclipse Public License - v 1.0</b> -</p> - -<p><span style='font-size:10.0pt'>THE ACCOMPANYING PROGRAM IS PROVIDED UNDER -THE TERMS OF THIS ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE, -REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE -OF THIS AGREEMENT.</span> </p> - -<p><b><span style='font-size:10.0pt'>1. DEFINITIONS</span></b> </p> - -<p><span style='font-size:10.0pt'>"Contribution" means:</span> </p> - -<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a) -in the case of the initial Contributor, the initial code and documentation -distributed under this Agreement, and<br clear=left> -b) in the case of each subsequent Contributor:</span></p> - -<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>i) -changes to the Program, and</span></p> - -<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>ii) -additions to the Program;</span></p> - -<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>where -such changes and/or additions to the Program originate from and are distributed -by that particular Contributor. A Contribution 'originates' from a Contributor -if it was added to the Program by such Contributor itself or anyone acting on -such Contributor's behalf. Contributions do not include additions to the -Program which: (i) are separate modules of software distributed in conjunction -with the Program under their own license agreement, and (ii) are not derivative -works of the Program. </span></p> - -<p><span style='font-size:10.0pt'>"Contributor" means any person or -entity that distributes the Program.</span> </p> - -<p><span style='font-size:10.0pt'>"Licensed Patents " mean patent -claims licensable by a Contributor which are necessarily infringed by the use -or sale of its Contribution alone or when combined with the Program. </span></p> - -<p><span style='font-size:10.0pt'>"Program" means the Contributions -distributed in accordance with this Agreement.</span> </p> - -<p><span style='font-size:10.0pt'>"Recipient" means anyone who -receives the Program under this Agreement, including all Contributors.</span> </p> - -<p><b><span style='font-size:10.0pt'>2. GRANT OF RIGHTS</span></b> </p> - -<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a) -Subject to the terms of this Agreement, each Contributor hereby grants Recipient -a non-exclusive, worldwide, royalty-free copyright license to<span -style='color:red'> </span>reproduce, prepare derivative works of, publicly -display, publicly perform, distribute and sublicense the Contribution of such -Contributor, if any, and such derivative works, in source code and object code -form.</span></p> - -<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>b) -Subject to the terms of this Agreement, each Contributor hereby grants -Recipient a non-exclusive, worldwide,<span style='color:green'> </span>royalty-free -patent license under Licensed Patents to make, use, sell, offer to sell, import -and otherwise transfer the Contribution of such Contributor, if any, in source -code and object code form. This patent license shall apply to the combination -of the Contribution and the Program if, at the time the Contribution is added -by the Contributor, such addition of the Contribution causes such combination -to be covered by the Licensed Patents. The patent license shall not apply to -any other combinations which include the Contribution. No hardware per se is -licensed hereunder. </span></p> - -<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>c) -Recipient understands that although each Contributor grants the licenses to its -Contributions set forth herein, no assurances are provided by any Contributor -that the Program does not infringe the patent or other intellectual property -rights of any other entity. Each Contributor disclaims any liability to Recipient -for claims brought by any other entity based on infringement of intellectual -property rights or otherwise. As a condition to exercising the rights and -licenses granted hereunder, each Recipient hereby assumes sole responsibility -to secure any other intellectual property rights needed, if any. For example, -if a third party patent license is required to allow Recipient to distribute -the Program, it is Recipient's responsibility to acquire that license before -distributing the Program.</span></p> - -<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>d) -Each Contributor represents that to its knowledge it has sufficient copyright -rights in its Contribution, if any, to grant the copyright license set forth in -this Agreement. </span></p> - -<p><b><span style='font-size:10.0pt'>3. REQUIREMENTS</span></b> </p> - -<p><span style='font-size:10.0pt'>A Contributor may choose to distribute the -Program in object code form under its own license agreement, provided that:</span> -</p> - -<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a) -it complies with the terms and conditions of this Agreement; and</span></p> - -<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>b) -its license agreement:</span></p> - -<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>i) -effectively disclaims on behalf of all Contributors all warranties and -conditions, express and implied, including warranties or conditions of title -and non-infringement, and implied warranties or conditions of merchantability -and fitness for a particular purpose; </span></p> - -<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>ii) -effectively excludes on behalf of all Contributors all liability for damages, -including direct, indirect, special, incidental and consequential damages, such -as lost profits; </span></p> - -<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>iii) -states that any provisions which differ from this Agreement are offered by that -Contributor alone and not by any other party; and</span></p> - -<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>iv) -states that source code for the Program is available from such Contributor, and -informs licensees how to obtain it in a reasonable manner on or through a -medium customarily used for software exchange.<span style='color:blue'> </span></span></p> - -<p><span style='font-size:10.0pt'>When the Program is made available in source -code form:</span> </p> - -<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a) -it must be made available under this Agreement; and </span></p> - -<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>b) a -copy of this Agreement must be included with each copy of the Program. </span></p> - -<p><span style='font-size:10.0pt'>Contributors may not remove or alter any -copyright notices contained within the Program. </span></p> - -<p><span style='font-size:10.0pt'>Each Contributor must identify itself as the -originator of its Contribution, if any, in a manner that reasonably allows -subsequent Recipients to identify the originator of the Contribution. </span></p> - -<p><b><span style='font-size:10.0pt'>4. COMMERCIAL DISTRIBUTION</span></b> </p> - -<p><span style='font-size:10.0pt'>Commercial distributors of software may -accept certain responsibilities with respect to end users, business partners -and the like. While this license is intended to facilitate the commercial use -of the Program, the Contributor who includes the Program in a commercial -product offering should do so in a manner which does not create potential -liability for other Contributors. Therefore, if a Contributor includes the -Program in a commercial product offering, such Contributor ("Commercial -Contributor") hereby agrees to defend and indemnify every other -Contributor ("Indemnified Contributor") against any losses, damages and -costs (collectively "Losses") arising from claims, lawsuits and other -legal actions brought by a third party against the Indemnified Contributor to -the extent caused by the acts or omissions of such Commercial Contributor in -connection with its distribution of the Program in a commercial product -offering. The obligations in this section do not apply to any claims or Losses -relating to any actual or alleged intellectual property infringement. In order -to qualify, an Indemnified Contributor must: a) promptly notify the Commercial -Contributor in writing of such claim, and b) allow the Commercial Contributor -to control, and cooperate with the Commercial Contributor in, the defense and -any related settlement negotiations. The Indemnified Contributor may participate -in any such claim at its own expense.</span> </p> - -<p><span style='font-size:10.0pt'>For example, a Contributor might include the -Program in a commercial product offering, Product X. That Contributor is then a -Commercial Contributor. If that Commercial Contributor then makes performance -claims, or offers warranties related to Product X, those performance claims and -warranties are such Commercial Contributor's responsibility alone. Under this -section, the Commercial Contributor would have to defend claims against the -other Contributors related to those performance claims and warranties, and if a -court requires any other Contributor to pay any damages as a result, the -Commercial Contributor must pay those damages.</span> </p> - -<p><b><span style='font-size:10.0pt'>5. NO WARRANTY</span></b> </p> - -<p><span style='font-size:10.0pt'>EXCEPT AS EXPRESSLY SET FORTH IN THIS -AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT -WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, -WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, -MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely -responsible for determining the appropriateness of using and distributing the -Program and assumes all risks associated with its exercise of rights under this -Agreement , including but not limited to the risks and costs of program errors, -compliance with applicable laws, damage to or loss of data, programs or -equipment, and unavailability or interruption of operations. </span></p> - -<p><b><span style='font-size:10.0pt'>6. DISCLAIMER OF LIABILITY</span></b> </p> - -<p><span style='font-size:10.0pt'>EXCEPT AS EXPRESSLY SET FORTH IN THIS -AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR -ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF -THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF -THE POSSIBILITY OF SUCH DAMAGES.</span> </p> - -<p><b><span style='font-size:10.0pt'>7. GENERAL</span></b> </p> - -<p><span style='font-size:10.0pt'>If any provision of this Agreement is invalid -or unenforceable under applicable law, it shall not affect the validity or -enforceability of the remainder of the terms of this Agreement, and without -further action by the parties hereto, such provision shall be reformed to the -minimum extent necessary to make such provision valid and enforceable.</span> </p> - -<p><span style='font-size:10.0pt'>If Recipient institutes patent litigation -against any entity (including a cross-claim or counterclaim in a lawsuit) -alleging that the Program itself (excluding combinations of the Program with -other software or hardware) infringes such Recipient's patent(s), then such -Recipient's rights granted under Section 2(b) shall terminate as of the date -such litigation is filed. </span></p> - -<p><span style='font-size:10.0pt'>All Recipient's rights under this Agreement -shall terminate if it fails to comply with any of the material terms or -conditions of this Agreement and does not cure such failure in a reasonable -period of time after becoming aware of such noncompliance. If all Recipient's -rights under this Agreement terminate, Recipient agrees to cease use and -distribution of the Program as soon as reasonably practicable. However, -Recipient's obligations under this Agreement and any licenses granted by -Recipient relating to the Program shall continue and survive. </span></p> - -<p><span style='font-size:10.0pt'>Everyone is permitted to copy and distribute -copies of this Agreement, but in order to avoid inconsistency the Agreement is -copyrighted and may only be modified in the following manner. The Agreement -Steward reserves the right to publish new versions (including revisions) of -this Agreement from time to time. No one other than the Agreement Steward has -the right to modify this Agreement. The Eclipse Foundation is the initial -Agreement Steward. The Eclipse Foundation may assign the responsibility to -serve as the Agreement Steward to a suitable separate entity. Each new version -of the Agreement will be given a distinguishing version number. The Program -(including Contributions) may always be distributed subject to the version of -the Agreement under which it was received. In addition, after a new version of -the Agreement is published, Contributor may elect to distribute the Program -(including its Contributions) under the new version. Except as expressly stated -in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to -the intellectual property of any Contributor under this Agreement, whether -expressly, by implication, estoppel or otherwise. All rights in the Program not -expressly granted under this Agreement are reserved.</span> </p> - -<p><span style='font-size:10.0pt'>This Agreement is governed by the laws of the -State of New York and the intellectual property laws of the United States of -America. No party to this Agreement will bring a legal action under this -Agreement more than one year after the cause of action arose. Each party waives -its rights to a jury trial in any resulting litigation.</span> </p> - -<p class=MsoNormal><![if !supportEmptyParas]> <![endif]><o:p></o:p></p> - -</div> - -</body> - -</html>
\ No newline at end of file diff --git a/assembly/features/org.eclipse.jpt.tests/feature.properties b/assembly/features/org.eclipse.jpt.tests/feature.properties deleted file mode 100644 index 132bef1c24..0000000000 --- a/assembly/features/org.eclipse.jpt.tests/feature.properties +++ /dev/null @@ -1,144 +0,0 @@ -############################################################################### -# Copyright (c) 2006 Oracle. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# Oracle. - initial API and implementation -############################################################################### -# feature.properties -# contains externalized strings for feature.xml -# "%foo" in feature.xml corresponds to the key "foo" in this file -# java.io.Properties file (ISO 8859-1 with "\" escapes) -# This file should be translated. - -# "featureName" property - name of the feature -featureName=Dali Java Persistence API (JPA) project Tests - -# "providerName" property - name of the company that provides the feature -providerName=Eclipse.org - -# "updateSiteName" property - label for the update site -updateSiteName=The Eclipse Web Tools Platform (WTP) Project update site - -# "description" property - description of the feature -description=Dali Java Persistence API (JPA) project Tests - -# "copyright" property - text of the "Feature Update Copyright" -copyright=\ -Copyright (c) 2006 Oracle Corporation.\n\ -All rights reserved. This program and the accompanying materials\n\ -are made available under the terms of the Eclipse Public License v1.0\n\ -which accompanies this distribution, and is available at\n\ -http://www.eclipse.org/legal/epl-v10.html\n\ -\n\ -Contributors:\n\ - Oracle - initial API and implementation\n -################ end of copyright property #################################### - -# "licenseURL" property - URL of the "Feature License" -# do not translate value - just change to point to a locale-specific HTML page -licenseURL=license.html - -# "license" property - text of the "Feature Update License" -# should be plain text version of license agreement pointed to be "licenseURL" -license=\ -ECLIPSE FOUNDATION SOFTWARE USER AGREEMENT\n\ -March 17, 2005\n\ -\n\ -Usage Of Content\n\ -\n\ -THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR\n\ -OTHER MATERIALS FOR OPEN SOURCE PROJECTS (COLLECTIVELY "CONTENT").\n\ -USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS\n\ -AGREEMENT AND/OR THE TERMS AND CONDITIONS OF LICENSE AGREEMENTS OR\n\ -NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU\n\ -AGREE THAT YOUR USE OF THE CONTENT IS GOVERNED BY THIS AGREEMENT\n\ -AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS\n\ -OR NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE\n\ -TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND CONDITIONS\n\ -OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED\n\ -BELOW, THEN YOU MAY NOT USE THE CONTENT.\n\ -\n\ -Applicable Licenses\n\ -\n\ -Unless otherwise indicated, all Content made available by the Eclipse Foundation\n\ -is provided to you under the terms and conditions of the Eclipse Public\n\ -License Version 1.0 ("EPL"). A copy of the EPL is provided with this\n\ -Content and is also available at http://www.eclipse.org/legal/epl-v10.html.\n\ -For purposes of the EPL, "Program" will mean the Content.\n\ -\n\ -Content includes, but is not limited to, source code, object code,\n\ -documentation and other files maintained in the Eclipse.org CVS\n\ -repository ("Repository") in CVS modules ("Modules") and made available\n\ -as downloadable archives ("Downloads").\n\ -\n\ - - Content may be structured and packaged into modules to facilitate delivering,\n\ - extending, and upgrading the Content. Typical modules may include plug-ins ("Plug-ins"),\n\ - plug-in fragments ("Fragments"), and features ("Features").\n\ - - Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java? ARchive)\n\ - in a directory named "plugins".\n\ - - A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material.\n\ - Each Feature may be packaged as a sub-directory in a directory named "features".\n\ - Within a Feature, files named "feature.xml" may contain a list of the names and version\n\ - numbers of the Plug-ins and/or Fragments associated with that Feature.\n\ - - Features may also include other Features ("Included Features"). Within a Feature, files\n\ - named "feature.xml" may contain a list of the names and version numbers of Included Features.\n\ -\n\ -Features may also include other Features ("Included Features"). Files named\n\ -"feature.xml" may contain a list of the names and version numbers of\n\ -Included Features.\n\ -\n\ -The terms and conditions governing Plug-ins and Fragments should be\n\ -contained in files named "about.html" ("Abouts"). The terms and\n\ -conditions governing Features and Included Features should be contained\n\ -in files named "license.html" ("Feature Licenses"). Abouts and Feature\n\ -Licenses may be located in any directory of a Download or Module\n\ -including, but not limited to the following locations:\n\ -\n\ - - The top-level (root) directory\n\ - - Plug-in and Fragment directories\n\ - - Inside Plug-ins and Fragments packaged as JARs\n\ - - Sub-directories of the directory named "src" of certain Plug-ins\n\ - - Feature directories\n\ -\n\ -Note: if a Feature made available by the Eclipse Foundation is installed using the\n\ -Eclipse Update Manager, you must agree to a license ("Feature Update\n\ -License") during the installation process. If the Feature contains\n\ -Included Features, the Feature Update License should either provide you\n\ -with the terms and conditions governing the Included Features or inform\n\ -you where you can locate them. Feature Update Licenses may be found in\n\ -the "license" property of files named "feature.properties". Such Abouts,\n\ -Feature Licenses and Feature Update Licenses contain the terms and\n\ -conditions (or references to such terms and conditions) that govern your\n\ -use of the associated Content in that directory.\n\ -\n\ -THE ABOUTS, FEATURE LICENSES AND FEATURE UPDATE LICENSES MAY REFER\n\ -TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS.\n\ -SOME OF THESE OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):\n\ -\n\ - - Common Public License Version 1.0 (available at http://www.eclipse.org/legal/cpl-v10.html)\n\ - - Apache Software License 1.1 (available at http://www.apache.org/licenses/LICENSE)\n\ - - Apache Software License 2.0 (available at http://www.apache.org/licenses/LICENSE-2.0)\n\ - - IBM Public License 1.0 (available at http://oss.software.ibm.com/developerworks/opensource/license10.html)\n\ - - Metro Link Public License 1.00 (available at http://www.opengroup.org/openmotif/supporters/metrolink/license.html)\n\ - - Mozilla Public License Version 1.1 (available at http://www.mozilla.org/MPL/MPL-1.1.html)\n\ -\n\ -IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR\n\ -TO USE OF THE CONTENT. If no About, Feature License or Feature Update License\n\ -is provided, please contact the Eclipse Foundation to determine what terms and conditions\n\ -govern that particular Content.\n\ -\n\ -Cryptography\n\ -\n\ -Content may contain encryption software. The country in which you are\n\ -currently may have restrictions on the import, possession, and use,\n\ -and/or re-export to another country, of encryption software. BEFORE\n\ -using any encryption software, please check the country's laws,\n\ -regulations and policies concerning the import, possession, or use,\n\ -and re-export of encryption software, to see if this is permitted.\n\ -\n\ -Java and all Java-based trademarks are trademarks of Sun Microsystems, Inc. in the United States, other countries, or both.\n -########### end of license property ########################################## diff --git a/assembly/features/org.eclipse.jpt.tests/feature.xml b/assembly/features/org.eclipse.jpt.tests/feature.xml deleted file mode 100644 index e445c4c153..0000000000 --- a/assembly/features/org.eclipse.jpt.tests/feature.xml +++ /dev/null @@ -1,28 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<feature - id="org.eclipse.jpt.tests" - label="%featureName" - version="1.0.0.qualifier" - provider-name="%providerName"> - - <description> - %description - </description> - - <license url="license.html"> - %license - </license> - - <copyright> - %copyright - </copyright> - - <url> - <update label="%updateSiteName" url="http://download.eclipse.org/webtools/updates/"/> - </url> - - <includes - id="org.eclipse.jpt.tests.feature" - version="0.0.0"/> - -</feature> diff --git a/assembly/features/org.eclipse.jpt.tests/license.html b/assembly/features/org.eclipse.jpt.tests/license.html deleted file mode 100644 index 2347060ef3..0000000000 --- a/assembly/features/org.eclipse.jpt.tests/license.html +++ /dev/null @@ -1,93 +0,0 @@ -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd"> -<!-- saved from url=(0044)http://www.eclipse.org/legal/epl/notice.html --> -<HTML><HEAD><TITLE>Eclipse.org Software User Agreement</TITLE> -<META http-equiv=Content-Type content="text/html; charset=iso-8859-1"> -<META content="MSHTML 6.00.2800.1479" name=GENERATOR></HEAD> -<BODY lang=EN-US vLink=purple link=blue> -<H2>Eclipse Foundation Software User Agreement</H2> -<P>January 28, 2005</P> -<H3>Usage Of Content</H3> -<P>THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION -AND/OR OTHER MATERIALS FOR OPEN SOURCE PROJECTS (COLLECTIVELY "CONTENT"). USE OF -THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS AGREEMENT AND/OR THE -TERMS AND CONDITIONS OF LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED -BELOW. BY USING THE CONTENT, YOU AGREE THAT YOUR USE OF THE CONTENT IS GOVERNED -BY THIS AGREEMENT AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE -AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE -TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND CONDITIONS OF ANY -APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW, THEN YOU -MAY NOT USE THE CONTENT.</P> -<H3>Applicable Licenses</H3> -<P>Unless otherwise indicated, all Content made available by the Eclipse -Foundation is provided to you under the terms and conditions of the Eclipse -Public License Version 1.0 ("EPL"). A copy of the EPL is provided with this -Content and is also available at <A -href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</A>. -For purposes of the EPL, "Program" will mean the Content.</P> -<P>Content includes, but is not limited to, source code, object code, -documentation and other files maintained in the Eclipse.org CVS repository -("Repository") in CVS modules ("Modules") and made available as downloadable -archives ("Downloads").</P> -<P>Content may be apportioned into plug-ins ("Plug-ins"), plug-in fragments -("Fragments"), and features ("Features"). A Feature is a bundle of one or more -Plug-ins and/or Fragments and associated material. Files named "feature.xml" may -contain a list of the names and version numbers of the Plug-ins and/or Fragments -associated with a Feature. Plug-ins and Fragments are located in directories -named "plugins" and Features are located in directories named "features".</P> -<P>Features may also include other Features ("Included Features"). Files named -"feature.xml" may contain a list of the names and version numbers of Included -Features.</P> -<P>The terms and conditions governing Plug-ins and Fragments should be contained -in files named "about.html" ("Abouts"). The terms and conditions governing -Features and Included Features should be contained in files named "license.html" -("Feature Licenses"). Abouts and Feature Licenses may be located in any -directory of a Download or Module including, but not limited to the following -locations:</P> -<UL> - <LI>The top-level (root) directory - <LI>Plug-in and Fragment directories - <LI>Subdirectories of the directory named "src" of certain Plug-ins - <LI>Feature directories </LI></UL> -<P>Note: if a Feature made available by the Eclipse Foundation is installed -using the Eclipse Update Manager, you must agree to a license ("Feature Update -License") during the installation process. If the Feature contains Included -Features, the Feature Update License should either provide you with the terms -and conditions governing the Included Features or inform you where you can -locate them. Feature Update Licenses may be found in the "license" property of -files named "feature.properties". Such Abouts, Feature Licenses and Feature -Update Licenses contain the terms and conditions (or references to such terms -and conditions) that govern your use of the associated Content in that -directory.</P> -<P>THE ABOUTS, FEATURE LICENSES AND FEATURE UPDATE LICENSES MAY REFER TO THE EPL -OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS. SOME OF THESE -OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):</P> -<UL> - <LI>Common Public License Version 1.0 (available at <A - href="http://www.eclipse.org/legal/cpl-v10.html">http://www.eclipse.org/legal/cpl-v10.html</A>) - - <LI>Apache Software License 1.1 (available at <A - href="http://www.apache.org/licenses/LICENSE">http://www.apache.org/licenses/LICENSE</A>) - - <LI>Apache Software License 2.0 (available at <A - href="http://www.apache.org/licenses/LICENSE-2.0">http://www.apache.org/licenses/LICENSE-2.0</A>) - - <LI>IBM Public License 1.0 (available at <A - href="http://oss.software.ibm.com/developerworks/opensource/license10.html">http://oss.software.ibm.com/developerworks/opensource/license10.html</A>) - - <LI>Metro Link Public License 1.00 (available at <A - href="http://www.opengroup.org/openmotif/supporters/metrolink/license.html">http://www.opengroup.org/openmotif/supporters/metrolink/license.html</A>) - - <LI>Mozilla Public License Version 1.1 (available at <A - href="http://www.mozilla.org/MPL/MPL-1.1.html">http://www.mozilla.org/MPL/MPL-1.1.html</A>) - </LI></UL> -<P>IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR -TO USE OF THE CONTENT. If no About, Feature License or Feature Update License is -provided, please contact the Eclipse Foundation to determine what terms and -conditions govern that particular Content.</P> -<H3>Cryptography</H3> -<P>Content may contain encryption software. The country in which you are -currently may have restrictions on the import, possession, and use, and/or -re-export to another country, of encryption software. BEFORE using any -encryption software, please check the country's laws, regulations and policies -concerning the import, possession, or use, and re-export of encryption software, -to see if this is permitted.</P></BODY></HTML> diff --git a/assembly/features/org.eclipse.jpt/.cvsignore b/assembly/features/org.eclipse.jpt/.cvsignore deleted file mode 100644 index d9e4340782..0000000000 --- a/assembly/features/org.eclipse.jpt/.cvsignore +++ /dev/null @@ -1,2 +0,0 @@ -*.bin.dist.zip -build.xml diff --git a/assembly/features/org.eclipse.jpt/.project b/assembly/features/org.eclipse.jpt/.project deleted file mode 100644 index b7aaec2f54..0000000000 --- a/assembly/features/org.eclipse.jpt/.project +++ /dev/null @@ -1,17 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<projectDescription> - <name>org.eclipse.jpt</name> - <comment></comment> - <projects> - </projects> - <buildSpec> - <buildCommand> - <name>org.eclipse.pde.FeatureBuilder</name> - <arguments> - </arguments> - </buildCommand> - </buildSpec> - <natures> - <nature>org.eclipse.pde.FeatureNature</nature> - </natures> -</projectDescription> diff --git a/assembly/features/org.eclipse.jpt/build.properties b/assembly/features/org.eclipse.jpt/build.properties deleted file mode 100644 index 470b4bcb63..0000000000 --- a/assembly/features/org.eclipse.jpt/build.properties +++ /dev/null @@ -1,16 +0,0 @@ -############################################################################### -# Copyright (c) 2006 Oracle. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# Oracle. - initial API and implementation -############################################################################### -bin.includes = feature.xml,\ - eclipse_update_120.jpg,\ - epl-v10.html,\ - license.html,\ - feature.properties -
\ No newline at end of file diff --git a/assembly/features/org.eclipse.jpt/eclipse_update_120.jpg b/assembly/features/org.eclipse.jpt/eclipse_update_120.jpg Binary files differdeleted file mode 100644 index bfdf708ad6..0000000000 --- a/assembly/features/org.eclipse.jpt/eclipse_update_120.jpg +++ /dev/null diff --git a/assembly/features/org.eclipse.jpt/epl-v10.html b/assembly/features/org.eclipse.jpt/epl-v10.html deleted file mode 100644 index ed4b196655..0000000000 --- a/assembly/features/org.eclipse.jpt/epl-v10.html +++ /dev/null @@ -1,328 +0,0 @@ -<html xmlns:o="urn:schemas-microsoft-com:office:office" -xmlns:w="urn:schemas-microsoft-com:office:word" -xmlns="http://www.w3.org/TR/REC-html40"> - -<head> -<meta http-equiv=Content-Type content="text/html; charset=windows-1252"> -<meta name=ProgId content=Word.Document> -<meta name=Generator content="Microsoft Word 9"> -<meta name=Originator content="Microsoft Word 9"> -<link rel=File-List -href="./Eclipse%20EPL%202003_11_10%20Final_files/filelist.xml"> -<title>Eclipse Public License - Version 1.0</title> -<!--[if gte mso 9]><xml> - <o:DocumentProperties> - <o:Revision>2</o:Revision> - <o:TotalTime>3</o:TotalTime> - <o:Created>2004-03-05T23:03:00Z</o:Created> - <o:LastSaved>2004-03-05T23:03:00Z</o:LastSaved> - <o:Pages>4</o:Pages> - <o:Words>1626</o:Words> - <o:Characters>9270</o:Characters> - <o:Lines>77</o:Lines> - <o:Paragraphs>18</o:Paragraphs> - <o:CharactersWithSpaces>11384</o:CharactersWithSpaces> - <o:Version>9.4402</o:Version> - </o:DocumentProperties> -</xml><![endif]--><!--[if gte mso 9]><xml> - <w:WordDocument> - <w:TrackRevisions/> - </w:WordDocument> -</xml><![endif]--> -<style> -<!-- - /* Font Definitions */ -@font-face - {font-family:Tahoma; - panose-1:2 11 6 4 3 5 4 4 2 4; - mso-font-charset:0; - mso-generic-font-family:swiss; - mso-font-pitch:variable; - mso-font-signature:553679495 -2147483648 8 0 66047 0;} - /* Style Definitions */ -p.MsoNormal, li.MsoNormal, div.MsoNormal - {mso-style-parent:""; - margin:0in; - margin-bottom:.0001pt; - mso-pagination:widow-orphan; - font-size:12.0pt; - font-family:"Times New Roman"; - mso-fareast-font-family:"Times New Roman";} -p - {margin-right:0in; - mso-margin-top-alt:auto; - mso-margin-bottom-alt:auto; - margin-left:0in; - mso-pagination:widow-orphan; - font-size:12.0pt; - font-family:"Times New Roman"; - mso-fareast-font-family:"Times New Roman";} -p.BalloonText, li.BalloonText, div.BalloonText - {mso-style-name:"Balloon Text"; - margin:0in; - margin-bottom:.0001pt; - mso-pagination:widow-orphan; - font-size:8.0pt; - font-family:Tahoma; - mso-fareast-font-family:"Times New Roman";} -@page Section1 - {size:8.5in 11.0in; - margin:1.0in 1.25in 1.0in 1.25in; - mso-header-margin:.5in; - mso-footer-margin:.5in; - mso-paper-source:0;} -div.Section1 - {page:Section1;} ---> -</style> -</head> - -<body lang=EN-US style='tab-interval:.5in'> - -<div class=Section1> - -<p align=center style='text-align:center'><b>Eclipse Public License - v 1.0</b> -</p> - -<p><span style='font-size:10.0pt'>THE ACCOMPANYING PROGRAM IS PROVIDED UNDER -THE TERMS OF THIS ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE, -REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE -OF THIS AGREEMENT.</span> </p> - -<p><b><span style='font-size:10.0pt'>1. DEFINITIONS</span></b> </p> - -<p><span style='font-size:10.0pt'>"Contribution" means:</span> </p> - -<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a) -in the case of the initial Contributor, the initial code and documentation -distributed under this Agreement, and<br clear=left> -b) in the case of each subsequent Contributor:</span></p> - -<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>i) -changes to the Program, and</span></p> - -<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>ii) -additions to the Program;</span></p> - -<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>where -such changes and/or additions to the Program originate from and are distributed -by that particular Contributor. A Contribution 'originates' from a Contributor -if it was added to the Program by such Contributor itself or anyone acting on -such Contributor's behalf. Contributions do not include additions to the -Program which: (i) are separate modules of software distributed in conjunction -with the Program under their own license agreement, and (ii) are not derivative -works of the Program. </span></p> - -<p><span style='font-size:10.0pt'>"Contributor" means any person or -entity that distributes the Program.</span> </p> - -<p><span style='font-size:10.0pt'>"Licensed Patents " mean patent -claims licensable by a Contributor which are necessarily infringed by the use -or sale of its Contribution alone or when combined with the Program. </span></p> - -<p><span style='font-size:10.0pt'>"Program" means the Contributions -distributed in accordance with this Agreement.</span> </p> - -<p><span style='font-size:10.0pt'>"Recipient" means anyone who -receives the Program under this Agreement, including all Contributors.</span> </p> - -<p><b><span style='font-size:10.0pt'>2. GRANT OF RIGHTS</span></b> </p> - -<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a) -Subject to the terms of this Agreement, each Contributor hereby grants Recipient -a non-exclusive, worldwide, royalty-free copyright license to<span -style='color:red'> </span>reproduce, prepare derivative works of, publicly -display, publicly perform, distribute and sublicense the Contribution of such -Contributor, if any, and such derivative works, in source code and object code -form.</span></p> - -<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>b) -Subject to the terms of this Agreement, each Contributor hereby grants -Recipient a non-exclusive, worldwide,<span style='color:green'> </span>royalty-free -patent license under Licensed Patents to make, use, sell, offer to sell, import -and otherwise transfer the Contribution of such Contributor, if any, in source -code and object code form. This patent license shall apply to the combination -of the Contribution and the Program if, at the time the Contribution is added -by the Contributor, such addition of the Contribution causes such combination -to be covered by the Licensed Patents. The patent license shall not apply to -any other combinations which include the Contribution. No hardware per se is -licensed hereunder. </span></p> - -<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>c) -Recipient understands that although each Contributor grants the licenses to its -Contributions set forth herein, no assurances are provided by any Contributor -that the Program does not infringe the patent or other intellectual property -rights of any other entity. Each Contributor disclaims any liability to Recipient -for claims brought by any other entity based on infringement of intellectual -property rights or otherwise. As a condition to exercising the rights and -licenses granted hereunder, each Recipient hereby assumes sole responsibility -to secure any other intellectual property rights needed, if any. For example, -if a third party patent license is required to allow Recipient to distribute -the Program, it is Recipient's responsibility to acquire that license before -distributing the Program.</span></p> - -<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>d) -Each Contributor represents that to its knowledge it has sufficient copyright -rights in its Contribution, if any, to grant the copyright license set forth in -this Agreement. </span></p> - -<p><b><span style='font-size:10.0pt'>3. REQUIREMENTS</span></b> </p> - -<p><span style='font-size:10.0pt'>A Contributor may choose to distribute the -Program in object code form under its own license agreement, provided that:</span> -</p> - -<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a) -it complies with the terms and conditions of this Agreement; and</span></p> - -<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>b) -its license agreement:</span></p> - -<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>i) -effectively disclaims on behalf of all Contributors all warranties and -conditions, express and implied, including warranties or conditions of title -and non-infringement, and implied warranties or conditions of merchantability -and fitness for a particular purpose; </span></p> - -<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>ii) -effectively excludes on behalf of all Contributors all liability for damages, -including direct, indirect, special, incidental and consequential damages, such -as lost profits; </span></p> - -<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>iii) -states that any provisions which differ from this Agreement are offered by that -Contributor alone and not by any other party; and</span></p> - -<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>iv) -states that source code for the Program is available from such Contributor, and -informs licensees how to obtain it in a reasonable manner on or through a -medium customarily used for software exchange.<span style='color:blue'> </span></span></p> - -<p><span style='font-size:10.0pt'>When the Program is made available in source -code form:</span> </p> - -<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a) -it must be made available under this Agreement; and </span></p> - -<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>b) a -copy of this Agreement must be included with each copy of the Program. </span></p> - -<p><span style='font-size:10.0pt'>Contributors may not remove or alter any -copyright notices contained within the Program. </span></p> - -<p><span style='font-size:10.0pt'>Each Contributor must identify itself as the -originator of its Contribution, if any, in a manner that reasonably allows -subsequent Recipients to identify the originator of the Contribution. </span></p> - -<p><b><span style='font-size:10.0pt'>4. COMMERCIAL DISTRIBUTION</span></b> </p> - -<p><span style='font-size:10.0pt'>Commercial distributors of software may -accept certain responsibilities with respect to end users, business partners -and the like. While this license is intended to facilitate the commercial use -of the Program, the Contributor who includes the Program in a commercial -product offering should do so in a manner which does not create potential -liability for other Contributors. Therefore, if a Contributor includes the -Program in a commercial product offering, such Contributor ("Commercial -Contributor") hereby agrees to defend and indemnify every other -Contributor ("Indemnified Contributor") against any losses, damages and -costs (collectively "Losses") arising from claims, lawsuits and other -legal actions brought by a third party against the Indemnified Contributor to -the extent caused by the acts or omissions of such Commercial Contributor in -connection with its distribution of the Program in a commercial product -offering. The obligations in this section do not apply to any claims or Losses -relating to any actual or alleged intellectual property infringement. In order -to qualify, an Indemnified Contributor must: a) promptly notify the Commercial -Contributor in writing of such claim, and b) allow the Commercial Contributor -to control, and cooperate with the Commercial Contributor in, the defense and -any related settlement negotiations. The Indemnified Contributor may participate -in any such claim at its own expense.</span> </p> - -<p><span style='font-size:10.0pt'>For example, a Contributor might include the -Program in a commercial product offering, Product X. That Contributor is then a -Commercial Contributor. If that Commercial Contributor then makes performance -claims, or offers warranties related to Product X, those performance claims and -warranties are such Commercial Contributor's responsibility alone. Under this -section, the Commercial Contributor would have to defend claims against the -other Contributors related to those performance claims and warranties, and if a -court requires any other Contributor to pay any damages as a result, the -Commercial Contributor must pay those damages.</span> </p> - -<p><b><span style='font-size:10.0pt'>5. NO WARRANTY</span></b> </p> - -<p><span style='font-size:10.0pt'>EXCEPT AS EXPRESSLY SET FORTH IN THIS -AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT -WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, -WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, -MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely -responsible for determining the appropriateness of using and distributing the -Program and assumes all risks associated with its exercise of rights under this -Agreement , including but not limited to the risks and costs of program errors, -compliance with applicable laws, damage to or loss of data, programs or -equipment, and unavailability or interruption of operations. </span></p> - -<p><b><span style='font-size:10.0pt'>6. DISCLAIMER OF LIABILITY</span></b> </p> - -<p><span style='font-size:10.0pt'>EXCEPT AS EXPRESSLY SET FORTH IN THIS -AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR -ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF -THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF -THE POSSIBILITY OF SUCH DAMAGES.</span> </p> - -<p><b><span style='font-size:10.0pt'>7. GENERAL</span></b> </p> - -<p><span style='font-size:10.0pt'>If any provision of this Agreement is invalid -or unenforceable under applicable law, it shall not affect the validity or -enforceability of the remainder of the terms of this Agreement, and without -further action by the parties hereto, such provision shall be reformed to the -minimum extent necessary to make such provision valid and enforceable.</span> </p> - -<p><span style='font-size:10.0pt'>If Recipient institutes patent litigation -against any entity (including a cross-claim or counterclaim in a lawsuit) -alleging that the Program itself (excluding combinations of the Program with -other software or hardware) infringes such Recipient's patent(s), then such -Recipient's rights granted under Section 2(b) shall terminate as of the date -such litigation is filed. </span></p> - -<p><span style='font-size:10.0pt'>All Recipient's rights under this Agreement -shall terminate if it fails to comply with any of the material terms or -conditions of this Agreement and does not cure such failure in a reasonable -period of time after becoming aware of such noncompliance. If all Recipient's -rights under this Agreement terminate, Recipient agrees to cease use and -distribution of the Program as soon as reasonably practicable. However, -Recipient's obligations under this Agreement and any licenses granted by -Recipient relating to the Program shall continue and survive. </span></p> - -<p><span style='font-size:10.0pt'>Everyone is permitted to copy and distribute -copies of this Agreement, but in order to avoid inconsistency the Agreement is -copyrighted and may only be modified in the following manner. The Agreement -Steward reserves the right to publish new versions (including revisions) of -this Agreement from time to time. No one other than the Agreement Steward has -the right to modify this Agreement. The Eclipse Foundation is the initial -Agreement Steward. The Eclipse Foundation may assign the responsibility to -serve as the Agreement Steward to a suitable separate entity. Each new version -of the Agreement will be given a distinguishing version number. The Program -(including Contributions) may always be distributed subject to the version of -the Agreement under which it was received. In addition, after a new version of -the Agreement is published, Contributor may elect to distribute the Program -(including its Contributions) under the new version. Except as expressly stated -in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to -the intellectual property of any Contributor under this Agreement, whether -expressly, by implication, estoppel or otherwise. All rights in the Program not -expressly granted under this Agreement are reserved.</span> </p> - -<p><span style='font-size:10.0pt'>This Agreement is governed by the laws of the -State of New York and the intellectual property laws of the United States of -America. No party to this Agreement will bring a legal action under this -Agreement more than one year after the cause of action arose. Each party waives -its rights to a jury trial in any resulting litigation.</span> </p> - -<p class=MsoNormal><![if !supportEmptyParas]> <![endif]><o:p></o:p></p> - -</div> - -</body> - -</html>
\ No newline at end of file diff --git a/assembly/features/org.eclipse.jpt/feature.properties b/assembly/features/org.eclipse.jpt/feature.properties deleted file mode 100644 index 0ae42bbb56..0000000000 --- a/assembly/features/org.eclipse.jpt/feature.properties +++ /dev/null @@ -1,144 +0,0 @@ -############################################################################### -# Copyright (c) 2006 Oracle. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# Oracle. - initial API and implementation -############################################################################### -# feature.properties -# contains externalized strings for feature.xml -# "%foo" in feature.xml corresponds to the key "foo" in this file -# java.io.Properties file (ISO 8859-1 with "\" escapes) -# This file should be translated. - -# "featureName" property - name of the feature -featureName=Java Persistence API Tools - -# "providerName" property - name of the company that provides the feature -providerName=Eclipse.org - -# "updateSiteName" property - label for the update site -updateSiteName=The Eclipse Web Tools Platform (WTP) Project update site - -# "description" property - description of the feature -description=Java Persistence API Tools - Runtime - -# "copyright" property - text of the "Feature Update Copyright" -copyright=\ -Copyright (c) 2006 Oracle Corporation.\n\ -All rights reserved. This program and the accompanying materials\n\ -are made available under the terms of the Eclipse Public License v1.0\n\ -which accompanies this distribution, and is available at\n\ -http://www.eclipse.org/legal/epl-v10.html\n\ -\n\ -Contributors:\n\ - Oracle - initial API and implementation\n -################ end of copyright property #################################### - -# "licenseURL" property - URL of the "Feature License" -# do not translate value - just change to point to a locale-specific HTML page -licenseURL=license.html - -# "license" property - text of the "Feature Update License" -# should be plain text version of license agreement pointed to be "licenseURL" -license=\ -ECLIPSE FOUNDATION SOFTWARE USER AGREEMENT\n\ -March 17, 2005\n\ -\n\ -Usage Of Content\n\ -\n\ -THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR\n\ -OTHER MATERIALS FOR OPEN SOURCE PROJECTS (COLLECTIVELY "CONTENT").\n\ -USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS\n\ -AGREEMENT AND/OR THE TERMS AND CONDITIONS OF LICENSE AGREEMENTS OR\n\ -NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU\n\ -AGREE THAT YOUR USE OF THE CONTENT IS GOVERNED BY THIS AGREEMENT\n\ -AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS\n\ -OR NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE\n\ -TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND CONDITIONS\n\ -OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED\n\ -BELOW, THEN YOU MAY NOT USE THE CONTENT.\n\ -\n\ -Applicable Licenses\n\ -\n\ -Unless otherwise indicated, all Content made available by the Eclipse Foundation\n\ -is provided to you under the terms and conditions of the Eclipse Public\n\ -License Version 1.0 ("EPL"). A copy of the EPL is provided with this\n\ -Content and is also available at http://www.eclipse.org/legal/epl-v10.html.\n\ -For purposes of the EPL, "Program" will mean the Content.\n\ -\n\ -Content includes, but is not limited to, source code, object code,\n\ -documentation and other files maintained in the Eclipse.org CVS\n\ -repository ("Repository") in CVS modules ("Modules") and made available\n\ -as downloadable archives ("Downloads").\n\ -\n\ - - Content may be structured and packaged into modules to facilitate delivering,\n\ - extending, and upgrading the Content. Typical modules may include plug-ins ("Plug-ins"),\n\ - plug-in fragments ("Fragments"), and features ("Features").\n\ - - Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java? ARchive)\n\ - in a directory named "plugins".\n\ - - A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material.\n\ - Each Feature may be packaged as a sub-directory in a directory named "features".\n\ - Within a Feature, files named "feature.xml" may contain a list of the names and version\n\ - numbers of the Plug-ins and/or Fragments associated with that Feature.\n\ - - Features may also include other Features ("Included Features"). Within a Feature, files\n\ - named "feature.xml" may contain a list of the names and version numbers of Included Features.\n\ -\n\ -Features may also include other Features ("Included Features"). Files named\n\ -"feature.xml" may contain a list of the names and version numbers of\n\ -Included Features.\n\ -\n\ -The terms and conditions governing Plug-ins and Fragments should be\n\ -contained in files named "about.html" ("Abouts"). The terms and\n\ -conditions governing Features and Included Features should be contained\n\ -in files named "license.html" ("Feature Licenses"). Abouts and Feature\n\ -Licenses may be located in any directory of a Download or Module\n\ -including, but not limited to the following locations:\n\ -\n\ - - The top-level (root) directory\n\ - - Plug-in and Fragment directories\n\ - - Inside Plug-ins and Fragments packaged as JARs\n\ - - Sub-directories of the directory named "src" of certain Plug-ins\n\ - - Feature directories\n\ -\n\ -Note: if a Feature made available by the Eclipse Foundation is installed using the\n\ -Eclipse Update Manager, you must agree to a license ("Feature Update\n\ -License") during the installation process. If the Feature contains\n\ -Included Features, the Feature Update License should either provide you\n\ -with the terms and conditions governing the Included Features or inform\n\ -you where you can locate them. Feature Update Licenses may be found in\n\ -the "license" property of files named "feature.properties". Such Abouts,\n\ -Feature Licenses and Feature Update Licenses contain the terms and\n\ -conditions (or references to such terms and conditions) that govern your\n\ -use of the associated Content in that directory.\n\ -\n\ -THE ABOUTS, FEATURE LICENSES AND FEATURE UPDATE LICENSES MAY REFER\n\ -TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS.\n\ -SOME OF THESE OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):\n\ -\n\ - - Common Public License Version 1.0 (available at http://www.eclipse.org/legal/cpl-v10.html)\n\ - - Apache Software License 1.1 (available at http://www.apache.org/licenses/LICENSE)\n\ - - Apache Software License 2.0 (available at http://www.apache.org/licenses/LICENSE-2.0)\n\ - - IBM Public License 1.0 (available at http://oss.software.ibm.com/developerworks/opensource/license10.html)\n\ - - Metro Link Public License 1.00 (available at http://www.opengroup.org/openmotif/supporters/metrolink/license.html)\n\ - - Mozilla Public License Version 1.1 (available at http://www.mozilla.org/MPL/MPL-1.1.html)\n\ -\n\ -IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR\n\ -TO USE OF THE CONTENT. If no About, Feature License or Feature Update License\n\ -is provided, please contact the Eclipse Foundation to determine what terms and conditions\n\ -govern that particular Content.\n\ -\n\ -Cryptography\n\ -\n\ -Content may contain encryption software. The country in which you are\n\ -currently may have restrictions on the import, possession, and use,\n\ -and/or re-export to another country, of encryption software. BEFORE\n\ -using any encryption software, please check the country's laws,\n\ -regulations and policies concerning the import, possession, or use,\n\ -and re-export of encryption software, to see if this is permitted.\n\ -\n\ -Java and all Java-based trademarks are trademarks of Sun Microsystems, Inc. in the United States, other countries, or both.\n -########### end of license property ########################################## diff --git a/assembly/features/org.eclipse.jpt/feature.xml b/assembly/features/org.eclipse.jpt/feature.xml deleted file mode 100644 index fdae5614e9..0000000000 --- a/assembly/features/org.eclipse.jpt/feature.xml +++ /dev/null @@ -1,38 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<feature - id="org.eclipse.jpt" - label="%featureName" - version="1.0.0.qualifier" - provider-name="%providerName" - plugin="org.eclipse.jpt" - image="eclipse_update_120.jpg"> - - <description> - %description - </description> - - <license url="license.html"> - %license - </license> - - <copyright> - %copyright - </copyright> - - <url> - <update label="%updateSiteName" url="http://download.eclipse.org/webtools/updates"/> - <discovery label="Web Tools Platform (WTP) Updates" url="http://download.eclipse.org/webtools/updates"/> - </url> - - <includes - id="org.eclipse.jpt.feature" - version="0.0.0"/> - - <plugin - id="org.eclipse.jpt" - download-size="0" - install-size="0" - version="0.0.0" - unpack="false"/> - -</feature> diff --git a/assembly/features/org.eclipse.jpt/license.html b/assembly/features/org.eclipse.jpt/license.html deleted file mode 100644 index 2347060ef3..0000000000 --- a/assembly/features/org.eclipse.jpt/license.html +++ /dev/null @@ -1,93 +0,0 @@ -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd"> -<!-- saved from url=(0044)http://www.eclipse.org/legal/epl/notice.html --> -<HTML><HEAD><TITLE>Eclipse.org Software User Agreement</TITLE> -<META http-equiv=Content-Type content="text/html; charset=iso-8859-1"> -<META content="MSHTML 6.00.2800.1479" name=GENERATOR></HEAD> -<BODY lang=EN-US vLink=purple link=blue> -<H2>Eclipse Foundation Software User Agreement</H2> -<P>January 28, 2005</P> -<H3>Usage Of Content</H3> -<P>THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION -AND/OR OTHER MATERIALS FOR OPEN SOURCE PROJECTS (COLLECTIVELY "CONTENT"). USE OF -THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS AGREEMENT AND/OR THE -TERMS AND CONDITIONS OF LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED -BELOW. BY USING THE CONTENT, YOU AGREE THAT YOUR USE OF THE CONTENT IS GOVERNED -BY THIS AGREEMENT AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE -AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE -TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND CONDITIONS OF ANY -APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW, THEN YOU -MAY NOT USE THE CONTENT.</P> -<H3>Applicable Licenses</H3> -<P>Unless otherwise indicated, all Content made available by the Eclipse -Foundation is provided to you under the terms and conditions of the Eclipse -Public License Version 1.0 ("EPL"). A copy of the EPL is provided with this -Content and is also available at <A -href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</A>. -For purposes of the EPL, "Program" will mean the Content.</P> -<P>Content includes, but is not limited to, source code, object code, -documentation and other files maintained in the Eclipse.org CVS repository -("Repository") in CVS modules ("Modules") and made available as downloadable -archives ("Downloads").</P> -<P>Content may be apportioned into plug-ins ("Plug-ins"), plug-in fragments -("Fragments"), and features ("Features"). A Feature is a bundle of one or more -Plug-ins and/or Fragments and associated material. Files named "feature.xml" may -contain a list of the names and version numbers of the Plug-ins and/or Fragments -associated with a Feature. Plug-ins and Fragments are located in directories -named "plugins" and Features are located in directories named "features".</P> -<P>Features may also include other Features ("Included Features"). Files named -"feature.xml" may contain a list of the names and version numbers of Included -Features.</P> -<P>The terms and conditions governing Plug-ins and Fragments should be contained -in files named "about.html" ("Abouts"). The terms and conditions governing -Features and Included Features should be contained in files named "license.html" -("Feature Licenses"). Abouts and Feature Licenses may be located in any -directory of a Download or Module including, but not limited to the following -locations:</P> -<UL> - <LI>The top-level (root) directory - <LI>Plug-in and Fragment directories - <LI>Subdirectories of the directory named "src" of certain Plug-ins - <LI>Feature directories </LI></UL> -<P>Note: if a Feature made available by the Eclipse Foundation is installed -using the Eclipse Update Manager, you must agree to a license ("Feature Update -License") during the installation process. If the Feature contains Included -Features, the Feature Update License should either provide you with the terms -and conditions governing the Included Features or inform you where you can -locate them. Feature Update Licenses may be found in the "license" property of -files named "feature.properties". Such Abouts, Feature Licenses and Feature -Update Licenses contain the terms and conditions (or references to such terms -and conditions) that govern your use of the associated Content in that -directory.</P> -<P>THE ABOUTS, FEATURE LICENSES AND FEATURE UPDATE LICENSES MAY REFER TO THE EPL -OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS. SOME OF THESE -OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):</P> -<UL> - <LI>Common Public License Version 1.0 (available at <A - href="http://www.eclipse.org/legal/cpl-v10.html">http://www.eclipse.org/legal/cpl-v10.html</A>) - - <LI>Apache Software License 1.1 (available at <A - href="http://www.apache.org/licenses/LICENSE">http://www.apache.org/licenses/LICENSE</A>) - - <LI>Apache Software License 2.0 (available at <A - href="http://www.apache.org/licenses/LICENSE-2.0">http://www.apache.org/licenses/LICENSE-2.0</A>) - - <LI>IBM Public License 1.0 (available at <A - href="http://oss.software.ibm.com/developerworks/opensource/license10.html">http://oss.software.ibm.com/developerworks/opensource/license10.html</A>) - - <LI>Metro Link Public License 1.00 (available at <A - href="http://www.opengroup.org/openmotif/supporters/metrolink/license.html">http://www.opengroup.org/openmotif/supporters/metrolink/license.html</A>) - - <LI>Mozilla Public License Version 1.1 (available at <A - href="http://www.mozilla.org/MPL/MPL-1.1.html">http://www.mozilla.org/MPL/MPL-1.1.html</A>) - </LI></UL> -<P>IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR -TO USE OF THE CONTENT. If no About, Feature License or Feature Update License is -provided, please contact the Eclipse Foundation to determine what terms and -conditions govern that particular Content.</P> -<H3>Cryptography</H3> -<P>Content may contain encryption software. The country in which you are -currently may have restrictions on the import, possession, and use, and/or -re-export to another country, of encryption software. BEFORE using any -encryption software, please check the country's laws, regulations and policies -concerning the import, possession, or use, and re-export of encryption software, -to see if this is permitted.</P></BODY></HTML> diff --git a/assembly/plugins/org.eclipse.jpt/.cvsignore b/assembly/plugins/org.eclipse.jpt/.cvsignore deleted file mode 100644 index e4254b18e0..0000000000 --- a/assembly/plugins/org.eclipse.jpt/.cvsignore +++ /dev/null @@ -1,3 +0,0 @@ -bin -temp.folder -build.xml diff --git a/assembly/plugins/org.eclipse.jpt/.project b/assembly/plugins/org.eclipse.jpt/.project deleted file mode 100644 index f51b04cc90..0000000000 --- a/assembly/plugins/org.eclipse.jpt/.project +++ /dev/null @@ -1,22 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<projectDescription> - <name>org.eclipse.jpt</name> - <comment></comment> - <projects> - </projects> - <buildSpec> - <buildCommand> - <name>org.eclipse.pde.ManifestBuilder</name> - <arguments> - </arguments> - </buildCommand> - <buildCommand> - <name>org.eclipse.pde.SchemaBuilder</name> - <arguments> - </arguments> - </buildCommand> - </buildSpec> - <natures> - <nature>org.eclipse.pde.PluginNature</nature> - </natures> -</projectDescription> diff --git a/assembly/plugins/org.eclipse.jpt/META-INF/MANIFEST.MF b/assembly/plugins/org.eclipse.jpt/META-INF/MANIFEST.MF deleted file mode 100644 index 5ac613eda7..0000000000 --- a/assembly/plugins/org.eclipse.jpt/META-INF/MANIFEST.MF +++ /dev/null @@ -1,7 +0,0 @@ -Manifest-Version: 1.0 -Bundle-ManifestVersion: 2 -Bundle-Name: %pluginName -Bundle-SymbolicName: org.eclipse.jpt; singleton:=true -Bundle-Version: 1.0.0.qualifier -Bundle-Localization: plugin -Bundle-Vendor: %providerName diff --git a/assembly/plugins/org.eclipse.jpt/about.html b/assembly/plugins/org.eclipse.jpt/about.html deleted file mode 100644 index 0dfbd1cc29..0000000000 --- a/assembly/plugins/org.eclipse.jpt/about.html +++ /dev/null @@ -1,34 +0,0 @@ -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN"> -<HTML> - -<head> -<title>About</title> -<meta http-equiv=Content-Type content="text/html; charset=ISO-8859-1"> -</head> - -<BODY lang="EN-US"> - -<H3>About This Content</H3> - -<P>June 9, 2006</P> - -<H3>License</H3> - -<P>The Eclipse Foundation makes available all content in this plug-in -("Content"). Unless otherwise indicated below, the Content is provided to you -under the terms and conditions of the Eclipse Public License Version 1.0 -("EPL"). A copy of the EPL is available at -<A href="http://www.eclipse.org/org/documents/epl-v10.php">http://www.eclipse.org/org/documents/epl-v10.php</A>. -For purposes of the EPL, "Program" will mean the Content.</P> - -<P>If you did not receive this Content directly from the Eclipse Foundation, the -Content is being redistributed by another party ("Redistributor") and different -terms and conditions may apply to your use of any object code in the Content. -Check the Redistributor's license that was provided with the Content. If no such -license exists, contact the Redistributor. Unless otherwise indicated below, the -terms and conditions of the EPL still apply to any source code in the Content -and such source code may be obtained at -<A href="http://www.eclipse.org/">http://www.eclipse.org/</A>.</P> - -</BODY> -</HTML>
\ No newline at end of file diff --git a/assembly/plugins/org.eclipse.jpt/about.ini b/assembly/plugins/org.eclipse.jpt/about.ini deleted file mode 100644 index f01f758119..0000000000 --- a/assembly/plugins/org.eclipse.jpt/about.ini +++ /dev/null @@ -1,41 +0,0 @@ -############################################################################### -# Copyright (c) 2006 Oracle. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# Oracle. - initial API and implementation -############################################################################### - -# about.ini -# contains information about a feature -# java.io.Properties file (ISO 8859-1 with "\" escapes) -# "%key" are externalized strings defined in about.properties -# This file does not need to be translated. - -# Property "aboutText" contains blurb for "About" dialog (translated) -aboutText=%blurb - -# Property "windowImage" contains path to window icon (16x16) -# needed for primary features only - -# Property "featureImage" contains path to feature image (32x32) -featureImage=eclipse32.gif - -# Property "aboutImage" contains path to product image (500x330 or 115x164) -# needed for primary features only - -# Property "appName" contains name of the application (translated) -# needed for primary features only - -# Property "welcomePage" contains path to welcome page (special XML-based format) -# optional - -# Property "welcomePerspective" contains the id of the perspective in which the -# welcome page is to be opened. -# optional - - - diff --git a/assembly/plugins/org.eclipse.jpt/about.mappings b/assembly/plugins/org.eclipse.jpt/about.mappings deleted file mode 100644 index bddaab4310..0000000000 --- a/assembly/plugins/org.eclipse.jpt/about.mappings +++ /dev/null @@ -1,6 +0,0 @@ -# about.mappings -# contains fill-ins for about.properties -# java.io.Properties file (ISO 8859-1 with "\" escapes) -# This file does not need to be translated. - -0=@build@
\ No newline at end of file diff --git a/assembly/plugins/org.eclipse.jpt/about.properties b/assembly/plugins/org.eclipse.jpt/about.properties deleted file mode 100644 index 159bfceeba..0000000000 --- a/assembly/plugins/org.eclipse.jpt/about.properties +++ /dev/null @@ -1,24 +0,0 @@ -############################################################################### -# Copyright (c) 2006 Oracle. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# Oracle. - initial API and implementation -############################################################################### - -# about.properties -# contains externalized strings for about.ini -# java.io.Properties file (ISO 8859-1 with "\" escapes) -# fill-ins are supplied by about.mappings -# This file should be translated. - -blurb=Java Persistence API Tools\n\ -\n\ -Version: {featureVersion}\n\ -Build id: {0}\n\ -\n\ -(c) Copyright Eclipse contributors and others 2006. All rights reserved.\n\ -Visit http://www.eclipse.org/webtools diff --git a/assembly/plugins/org.eclipse.jpt/build.properties b/assembly/plugins/org.eclipse.jpt/build.properties deleted file mode 100644 index 0ccfb0ebb8..0000000000 --- a/assembly/plugins/org.eclipse.jpt/build.properties +++ /dev/null @@ -1,19 +0,0 @@ -############################################################################### -# Copyright (c) 2006, 2007 Oracle. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# Oracle. - initial API and implementation -############################################################################### -bin.includes = META-INF/,\ - about.ini,\ - about.html,\ - about.mappings,\ - about.properties,\ - eclipse32.gif,\ - eclipse32.png,\ - plugin.properties,\ - component.xml diff --git a/assembly/plugins/org.eclipse.jpt/component.xml b/assembly/plugins/org.eclipse.jpt/component.xml deleted file mode 100644 index 11f133f65a..0000000000 --- a/assembly/plugins/org.eclipse.jpt/component.xml +++ /dev/null @@ -1,12 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<component xmlns="http://eclipse.org/wtp/releng/tools/component-model" name="org.eclipse.jpt"> -<description url=""></description> -<component-depends unrestricted="true"></component-depends> -<plugin id="org.eclipse.jpt" fragment="false"/> -<plugin id="org.eclipse.jpt.core" fragment="false"/> -<plugin id="org.eclipse.jpt.db" fragment="false"/> -<plugin id="org.eclipse.jpt.db.ui" fragment="false"/> -<plugin id="org.eclipse.jpt.gen" fragment="false"/> -<plugin id="org.eclipse.jpt.ui" fragment="false"/> -<plugin id="org.eclipse.jpt.utility" fragment="false"/> -</component>
\ No newline at end of file diff --git a/assembly/plugins/org.eclipse.jpt/eclipse32.gif b/assembly/plugins/org.eclipse.jpt/eclipse32.gif Binary files differdeleted file mode 100644 index e6ad7ccd75..0000000000 --- a/assembly/plugins/org.eclipse.jpt/eclipse32.gif +++ /dev/null diff --git a/assembly/plugins/org.eclipse.jpt/eclipse32.png b/assembly/plugins/org.eclipse.jpt/eclipse32.png Binary files differdeleted file mode 100644 index 568fac1d05..0000000000 --- a/assembly/plugins/org.eclipse.jpt/eclipse32.png +++ /dev/null diff --git a/assembly/plugins/org.eclipse.jpt/plugin.properties b/assembly/plugins/org.eclipse.jpt/plugin.properties deleted file mode 100644 index f45a08d54e..0000000000 --- a/assembly/plugins/org.eclipse.jpt/plugin.properties +++ /dev/null @@ -1,13 +0,0 @@ -############################################################################### -# Copyright (c) 2006 Oracle. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# Oracle. - initial API and implementation -############################################################################### - -pluginName = Java Persistence API Tools -providerName = Eclipse.org diff --git a/jpa/features/org.eclipse.jpt.feature/feature.xml b/jpa/features/org.eclipse.jpt.feature/feature.xml index 6eb9cbf6c1..3b80ce10a0 100644 --- a/jpa/features/org.eclipse.jpt.feature/feature.xml +++ b/jpa/features/org.eclipse.jpt.feature/feature.xml @@ -67,4 +67,11 @@ version="0.0.0" unpack="false"/> + <plugin + id="org.eclipse.jpt.doc.user" + download-size="0" + install-size="0" + version="0.0.0" + unpack="false"/> + </feature> diff --git a/jpa/features/org.eclipse.jpt.tests.feature/.project b/jpa/features/org.eclipse.jpt.tests.feature/.project deleted file mode 100644 index 91760f21b4..0000000000 --- a/jpa/features/org.eclipse.jpt.tests.feature/.project +++ /dev/null @@ -1,17 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<projectDescription> - <name>org.eclipse.jpt.tests.feature</name> - <comment></comment> - <projects> - </projects> - <buildSpec> - <buildCommand> - <name>org.eclipse.pde.FeatureBuilder</name> - <arguments> - </arguments> - </buildCommand> - </buildSpec> - <natures> - <nature>org.eclipse.pde.FeatureNature</nature> - </natures> -</projectDescription> diff --git a/jpa/features/org.eclipse.jpt.tests.feature/build.properties b/jpa/features/org.eclipse.jpt.tests.feature/build.properties deleted file mode 100644 index d6a4dce096..0000000000 --- a/jpa/features/org.eclipse.jpt.tests.feature/build.properties +++ /dev/null @@ -1,10 +0,0 @@ -bin.includes = feature.xml,\ - eclipse_update_120.jpg,\ - epl-v10.html,\ - license.html,\ - feature.properties -src.includes = license.html,\ - feature.xml,\ - epl-v10.html,\ - eclipse_update_120.jpg,\ - build.properties diff --git a/jpa/features/org.eclipse.jpt.tests.feature/eclipse_update_120.jpg b/jpa/features/org.eclipse.jpt.tests.feature/eclipse_update_120.jpg Binary files differdeleted file mode 100644 index bfdf708ad6..0000000000 --- a/jpa/features/org.eclipse.jpt.tests.feature/eclipse_update_120.jpg +++ /dev/null diff --git a/jpa/features/org.eclipse.jpt.tests.feature/epl-v10.html b/jpa/features/org.eclipse.jpt.tests.feature/epl-v10.html deleted file mode 100644 index ed4b196655..0000000000 --- a/jpa/features/org.eclipse.jpt.tests.feature/epl-v10.html +++ /dev/null @@ -1,328 +0,0 @@ -<html xmlns:o="urn:schemas-microsoft-com:office:office" -xmlns:w="urn:schemas-microsoft-com:office:word" -xmlns="http://www.w3.org/TR/REC-html40"> - -<head> -<meta http-equiv=Content-Type content="text/html; charset=windows-1252"> -<meta name=ProgId content=Word.Document> -<meta name=Generator content="Microsoft Word 9"> -<meta name=Originator content="Microsoft Word 9"> -<link rel=File-List -href="./Eclipse%20EPL%202003_11_10%20Final_files/filelist.xml"> -<title>Eclipse Public License - Version 1.0</title> -<!--[if gte mso 9]><xml> - <o:DocumentProperties> - <o:Revision>2</o:Revision> - <o:TotalTime>3</o:TotalTime> - <o:Created>2004-03-05T23:03:00Z</o:Created> - <o:LastSaved>2004-03-05T23:03:00Z</o:LastSaved> - <o:Pages>4</o:Pages> - <o:Words>1626</o:Words> - <o:Characters>9270</o:Characters> - <o:Lines>77</o:Lines> - <o:Paragraphs>18</o:Paragraphs> - <o:CharactersWithSpaces>11384</o:CharactersWithSpaces> - <o:Version>9.4402</o:Version> - </o:DocumentProperties> -</xml><![endif]--><!--[if gte mso 9]><xml> - <w:WordDocument> - <w:TrackRevisions/> - </w:WordDocument> -</xml><![endif]--> -<style> -<!-- - /* Font Definitions */ -@font-face - {font-family:Tahoma; - panose-1:2 11 6 4 3 5 4 4 2 4; - mso-font-charset:0; - mso-generic-font-family:swiss; - mso-font-pitch:variable; - mso-font-signature:553679495 -2147483648 8 0 66047 0;} - /* Style Definitions */ -p.MsoNormal, li.MsoNormal, div.MsoNormal - {mso-style-parent:""; - margin:0in; - margin-bottom:.0001pt; - mso-pagination:widow-orphan; - font-size:12.0pt; - font-family:"Times New Roman"; - mso-fareast-font-family:"Times New Roman";} -p - {margin-right:0in; - mso-margin-top-alt:auto; - mso-margin-bottom-alt:auto; - margin-left:0in; - mso-pagination:widow-orphan; - font-size:12.0pt; - font-family:"Times New Roman"; - mso-fareast-font-family:"Times New Roman";} -p.BalloonText, li.BalloonText, div.BalloonText - {mso-style-name:"Balloon Text"; - margin:0in; - margin-bottom:.0001pt; - mso-pagination:widow-orphan; - font-size:8.0pt; - font-family:Tahoma; - mso-fareast-font-family:"Times New Roman";} -@page Section1 - {size:8.5in 11.0in; - margin:1.0in 1.25in 1.0in 1.25in; - mso-header-margin:.5in; - mso-footer-margin:.5in; - mso-paper-source:0;} -div.Section1 - {page:Section1;} ---> -</style> -</head> - -<body lang=EN-US style='tab-interval:.5in'> - -<div class=Section1> - -<p align=center style='text-align:center'><b>Eclipse Public License - v 1.0</b> -</p> - -<p><span style='font-size:10.0pt'>THE ACCOMPANYING PROGRAM IS PROVIDED UNDER -THE TERMS OF THIS ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE, -REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE -OF THIS AGREEMENT.</span> </p> - -<p><b><span style='font-size:10.0pt'>1. DEFINITIONS</span></b> </p> - -<p><span style='font-size:10.0pt'>"Contribution" means:</span> </p> - -<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a) -in the case of the initial Contributor, the initial code and documentation -distributed under this Agreement, and<br clear=left> -b) in the case of each subsequent Contributor:</span></p> - -<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>i) -changes to the Program, and</span></p> - -<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>ii) -additions to the Program;</span></p> - -<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>where -such changes and/or additions to the Program originate from and are distributed -by that particular Contributor. A Contribution 'originates' from a Contributor -if it was added to the Program by such Contributor itself or anyone acting on -such Contributor's behalf. Contributions do not include additions to the -Program which: (i) are separate modules of software distributed in conjunction -with the Program under their own license agreement, and (ii) are not derivative -works of the Program. </span></p> - -<p><span style='font-size:10.0pt'>"Contributor" means any person or -entity that distributes the Program.</span> </p> - -<p><span style='font-size:10.0pt'>"Licensed Patents " mean patent -claims licensable by a Contributor which are necessarily infringed by the use -or sale of its Contribution alone or when combined with the Program. </span></p> - -<p><span style='font-size:10.0pt'>"Program" means the Contributions -distributed in accordance with this Agreement.</span> </p> - -<p><span style='font-size:10.0pt'>"Recipient" means anyone who -receives the Program under this Agreement, including all Contributors.</span> </p> - -<p><b><span style='font-size:10.0pt'>2. GRANT OF RIGHTS</span></b> </p> - -<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a) -Subject to the terms of this Agreement, each Contributor hereby grants Recipient -a non-exclusive, worldwide, royalty-free copyright license to<span -style='color:red'> </span>reproduce, prepare derivative works of, publicly -display, publicly perform, distribute and sublicense the Contribution of such -Contributor, if any, and such derivative works, in source code and object code -form.</span></p> - -<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>b) -Subject to the terms of this Agreement, each Contributor hereby grants -Recipient a non-exclusive, worldwide,<span style='color:green'> </span>royalty-free -patent license under Licensed Patents to make, use, sell, offer to sell, import -and otherwise transfer the Contribution of such Contributor, if any, in source -code and object code form. This patent license shall apply to the combination -of the Contribution and the Program if, at the time the Contribution is added -by the Contributor, such addition of the Contribution causes such combination -to be covered by the Licensed Patents. The patent license shall not apply to -any other combinations which include the Contribution. No hardware per se is -licensed hereunder. </span></p> - -<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>c) -Recipient understands that although each Contributor grants the licenses to its -Contributions set forth herein, no assurances are provided by any Contributor -that the Program does not infringe the patent or other intellectual property -rights of any other entity. Each Contributor disclaims any liability to Recipient -for claims brought by any other entity based on infringement of intellectual -property rights or otherwise. As a condition to exercising the rights and -licenses granted hereunder, each Recipient hereby assumes sole responsibility -to secure any other intellectual property rights needed, if any. For example, -if a third party patent license is required to allow Recipient to distribute -the Program, it is Recipient's responsibility to acquire that license before -distributing the Program.</span></p> - -<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>d) -Each Contributor represents that to its knowledge it has sufficient copyright -rights in its Contribution, if any, to grant the copyright license set forth in -this Agreement. </span></p> - -<p><b><span style='font-size:10.0pt'>3. REQUIREMENTS</span></b> </p> - -<p><span style='font-size:10.0pt'>A Contributor may choose to distribute the -Program in object code form under its own license agreement, provided that:</span> -</p> - -<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a) -it complies with the terms and conditions of this Agreement; and</span></p> - -<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>b) -its license agreement:</span></p> - -<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>i) -effectively disclaims on behalf of all Contributors all warranties and -conditions, express and implied, including warranties or conditions of title -and non-infringement, and implied warranties or conditions of merchantability -and fitness for a particular purpose; </span></p> - -<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>ii) -effectively excludes on behalf of all Contributors all liability for damages, -including direct, indirect, special, incidental and consequential damages, such -as lost profits; </span></p> - -<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>iii) -states that any provisions which differ from this Agreement are offered by that -Contributor alone and not by any other party; and</span></p> - -<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>iv) -states that source code for the Program is available from such Contributor, and -informs licensees how to obtain it in a reasonable manner on or through a -medium customarily used for software exchange.<span style='color:blue'> </span></span></p> - -<p><span style='font-size:10.0pt'>When the Program is made available in source -code form:</span> </p> - -<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a) -it must be made available under this Agreement; and </span></p> - -<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>b) a -copy of this Agreement must be included with each copy of the Program. </span></p> - -<p><span style='font-size:10.0pt'>Contributors may not remove or alter any -copyright notices contained within the Program. </span></p> - -<p><span style='font-size:10.0pt'>Each Contributor must identify itself as the -originator of its Contribution, if any, in a manner that reasonably allows -subsequent Recipients to identify the originator of the Contribution. </span></p> - -<p><b><span style='font-size:10.0pt'>4. COMMERCIAL DISTRIBUTION</span></b> </p> - -<p><span style='font-size:10.0pt'>Commercial distributors of software may -accept certain responsibilities with respect to end users, business partners -and the like. While this license is intended to facilitate the commercial use -of the Program, the Contributor who includes the Program in a commercial -product offering should do so in a manner which does not create potential -liability for other Contributors. Therefore, if a Contributor includes the -Program in a commercial product offering, such Contributor ("Commercial -Contributor") hereby agrees to defend and indemnify every other -Contributor ("Indemnified Contributor") against any losses, damages and -costs (collectively "Losses") arising from claims, lawsuits and other -legal actions brought by a third party against the Indemnified Contributor to -the extent caused by the acts or omissions of such Commercial Contributor in -connection with its distribution of the Program in a commercial product -offering. The obligations in this section do not apply to any claims or Losses -relating to any actual or alleged intellectual property infringement. In order -to qualify, an Indemnified Contributor must: a) promptly notify the Commercial -Contributor in writing of such claim, and b) allow the Commercial Contributor -to control, and cooperate with the Commercial Contributor in, the defense and -any related settlement negotiations. The Indemnified Contributor may participate -in any such claim at its own expense.</span> </p> - -<p><span style='font-size:10.0pt'>For example, a Contributor might include the -Program in a commercial product offering, Product X. That Contributor is then a -Commercial Contributor. If that Commercial Contributor then makes performance -claims, or offers warranties related to Product X, those performance claims and -warranties are such Commercial Contributor's responsibility alone. Under this -section, the Commercial Contributor would have to defend claims against the -other Contributors related to those performance claims and warranties, and if a -court requires any other Contributor to pay any damages as a result, the -Commercial Contributor must pay those damages.</span> </p> - -<p><b><span style='font-size:10.0pt'>5. NO WARRANTY</span></b> </p> - -<p><span style='font-size:10.0pt'>EXCEPT AS EXPRESSLY SET FORTH IN THIS -AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT -WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, -WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, -MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely -responsible for determining the appropriateness of using and distributing the -Program and assumes all risks associated with its exercise of rights under this -Agreement , including but not limited to the risks and costs of program errors, -compliance with applicable laws, damage to or loss of data, programs or -equipment, and unavailability or interruption of operations. </span></p> - -<p><b><span style='font-size:10.0pt'>6. DISCLAIMER OF LIABILITY</span></b> </p> - -<p><span style='font-size:10.0pt'>EXCEPT AS EXPRESSLY SET FORTH IN THIS -AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR -ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF -THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF -THE POSSIBILITY OF SUCH DAMAGES.</span> </p> - -<p><b><span style='font-size:10.0pt'>7. GENERAL</span></b> </p> - -<p><span style='font-size:10.0pt'>If any provision of this Agreement is invalid -or unenforceable under applicable law, it shall not affect the validity or -enforceability of the remainder of the terms of this Agreement, and without -further action by the parties hereto, such provision shall be reformed to the -minimum extent necessary to make such provision valid and enforceable.</span> </p> - -<p><span style='font-size:10.0pt'>If Recipient institutes patent litigation -against any entity (including a cross-claim or counterclaim in a lawsuit) -alleging that the Program itself (excluding combinations of the Program with -other software or hardware) infringes such Recipient's patent(s), then such -Recipient's rights granted under Section 2(b) shall terminate as of the date -such litigation is filed. </span></p> - -<p><span style='font-size:10.0pt'>All Recipient's rights under this Agreement -shall terminate if it fails to comply with any of the material terms or -conditions of this Agreement and does not cure such failure in a reasonable -period of time after becoming aware of such noncompliance. If all Recipient's -rights under this Agreement terminate, Recipient agrees to cease use and -distribution of the Program as soon as reasonably practicable. However, -Recipient's obligations under this Agreement and any licenses granted by -Recipient relating to the Program shall continue and survive. </span></p> - -<p><span style='font-size:10.0pt'>Everyone is permitted to copy and distribute -copies of this Agreement, but in order to avoid inconsistency the Agreement is -copyrighted and may only be modified in the following manner. The Agreement -Steward reserves the right to publish new versions (including revisions) of -this Agreement from time to time. No one other than the Agreement Steward has -the right to modify this Agreement. The Eclipse Foundation is the initial -Agreement Steward. The Eclipse Foundation may assign the responsibility to -serve as the Agreement Steward to a suitable separate entity. Each new version -of the Agreement will be given a distinguishing version number. The Program -(including Contributions) may always be distributed subject to the version of -the Agreement under which it was received. In addition, after a new version of -the Agreement is published, Contributor may elect to distribute the Program -(including its Contributions) under the new version. Except as expressly stated -in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to -the intellectual property of any Contributor under this Agreement, whether -expressly, by implication, estoppel or otherwise. All rights in the Program not -expressly granted under this Agreement are reserved.</span> </p> - -<p><span style='font-size:10.0pt'>This Agreement is governed by the laws of the -State of New York and the intellectual property laws of the United States of -America. No party to this Agreement will bring a legal action under this -Agreement more than one year after the cause of action arose. Each party waives -its rights to a jury trial in any resulting litigation.</span> </p> - -<p class=MsoNormal><![if !supportEmptyParas]> <![endif]><o:p></o:p></p> - -</div> - -</body> - -</html>
\ No newline at end of file diff --git a/jpa/features/org.eclipse.jpt.tests.feature/feature.properties b/jpa/features/org.eclipse.jpt.tests.feature/feature.properties deleted file mode 100644 index 7a5281e6d5..0000000000 --- a/jpa/features/org.eclipse.jpt.tests.feature/feature.properties +++ /dev/null @@ -1,144 +0,0 @@ -############################################################################### -# Copyright (c) 2006 Oracle. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# Oracle - initial API and implementation -############################################################################### -# feature.properties -# contains externalized strings for feature.xml -# "%foo" in feature.xml corresponds to the key "foo" in this file -# java.io.Properties file (ISO 8859-1 with "\" escapes) -# This file should be translated. - -# "featureName" property - name of the feature - -# "providerName" property - name of the company that provides the feature -providerName=Eclipse.org - -# "updateSiteName" property - label for the update site -# TOREVIEW - updateSiteName -updateSiteName=Web Tools Platform (WTP) Updates - -# "description" property - description of the feature -description=Dali Java Persistence API (JPA) Tools - -# "copyright" property - text of the "Feature Update Copyright" -copyright=\ -Copyright (c) 2006 Oracle Corporation.\n\ -All rights reserved. This program and the accompanying materials\n\ -are made available under the terms of the Eclipse Public License v1.0\n\ -which accompanies this distribution, and is available at\n\ -http://www.eclipse.org/legal/epl-v10.html\n\ -\n\ -Contributors:\n\ - Oracle - initial API and implementation\n -################ end of copyright property #################################### - -# "licenseURL" property - URL of the "Feature License" -# do not translate value - just change to point to a locale-specific HTML page -licenseURL=license.html - -# "license" property - text of the "Feature Update License" -# should be plain text version of license agreement pointed to be "licenseURL" -license=\ -ECLIPSE FOUNDATION SOFTWARE USER AGREEMENT\n\ -March 17, 2005\n\ -\n\ -Usage Of Content\n\ -\n\ -THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR\n\ -OTHER MATERIALS FOR OPEN SOURCE PROJECTS (COLLECTIVELY "CONTENT").\n\ -USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS\n\ -AGREEMENT AND/OR THE TERMS AND CONDITIONS OF LICENSE AGREEMENTS OR\n\ -NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU\n\ -AGREE THAT YOUR USE OF THE CONTENT IS GOVERNED BY THIS AGREEMENT\n\ -AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS\n\ -OR NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE\n\ -TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND CONDITIONS\n\ -OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED\n\ -BELOW, THEN YOU MAY NOT USE THE CONTENT.\n\ -\n\ -Applicable Licenses\n\ -\n\ -Unless otherwise indicated, all Content made available by the Eclipse Foundation\n\ -is provided to you under the terms and conditions of the Eclipse Public\n\ -License Version 1.0 ("EPL"). A copy of the EPL is provided with this\n\ -Content and is also available at http://www.eclipse.org/legal/epl-v10.html.\n\ -For purposes of the EPL, "Program" will mean the Content.\n\ -\n\ -Content includes, but is not limited to, source code, object code,\n\ -documentation and other files maintained in the Eclipse.org CVS\n\ -repository ("Repository") in CVS modules ("Modules") and made available\n\ -as downloadable archives ("Downloads").\n\ -\n\ - - Content may be structured and packaged into modules to facilitate delivering,\n\ - extending, and upgrading the Content. Typical modules may include plug-ins ("Plug-ins"),\n\ - plug-in fragments ("Fragments"), and features ("Features").\n\ - - Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java? ARchive)\n\ - in a directory named "plugins".\n\ - - A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material.\n\ - Each Feature may be packaged as a sub-directory in a directory named "features".\n\ - Within a Feature, files named "feature.xml" may contain a list of the names and version\n\ - numbers of the Plug-ins and/or Fragments associated with that Feature.\n\ - - Features may also include other Features ("Included Features"). Within a Feature, files\n\ - named "feature.xml" may contain a list of the names and version numbers of Included Features.\n\ -\n\ -Features may also include other Features ("Included Features"). Files named\n\ -"feature.xml" may contain a list of the names and version numbers of\n\ -Included Features.\n\ -\n\ -The terms and conditions governing Plug-ins and Fragments should be\n\ -contained in files named "about.html" ("Abouts"). The terms and\n\ -conditions governing Features and Included Features should be contained\n\ -in files named "license.html" ("Feature Licenses"). Abouts and Feature\n\ -Licenses may be located in any directory of a Download or Module\n\ -including, but not limited to the following locations:\n\ -\n\ - - The top-level (root) directory\n\ - - Plug-in and Fragment directories\n\ - - Inside Plug-ins and Fragments packaged as JARs\n\ - - Sub-directories of the directory named "src" of certain Plug-ins\n\ - - Feature directories\n\ -\n\ -Note: if a Feature made available by the Eclipse Foundation is installed using the\n\ -Eclipse Update Manager, you must agree to a license ("Feature Update\n\ -License") during the installation process. If the Feature contains\n\ -Included Features, the Feature Update License should either provide you\n\ -with the terms and conditions governing the Included Features or inform\n\ -you where you can locate them. Feature Update Licenses may be found in\n\ -the "license" property of files named "feature.properties". Such Abouts,\n\ -Feature Licenses and Feature Update Licenses contain the terms and\n\ -conditions (or references to such terms and conditions) that govern your\n\ -use of the associated Content in that directory.\n\ -\n\ -THE ABOUTS, FEATURE LICENSES AND FEATURE UPDATE LICENSES MAY REFER\n\ -TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS.\n\ -SOME OF THESE OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):\n\ -\n\ - - Common Public License Version 1.0 (available at http://www.eclipse.org/legal/cpl-v10.html)\n\ - - Apache Software License 1.1 (available at http://www.apache.org/licenses/LICENSE)\n\ - - Apache Software License 2.0 (available at http://www.apache.org/licenses/LICENSE-2.0)\n\ - - IBM Public License 1.0 (available at http://oss.software.ibm.com/developerworks/opensource/license10.html)\n\ - - Metro Link Public License 1.00 (available at http://www.opengroup.org/openmotif/supporters/metrolink/license.html)\n\ - - Mozilla Public License Version 1.1 (available at http://www.mozilla.org/MPL/MPL-1.1.html)\n\ -\n\ -IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR\n\ -TO USE OF THE CONTENT. If no About, Feature License or Feature Update License\n\ -is provided, please contact the Eclipse Foundation to determine what terms and conditions\n\ -govern that particular Content.\n\ -\n\ -Cryptography\n\ -\n\ -Content may contain encryption software. The country in which you are\n\ -currently may have restrictions on the import, possession, and use,\n\ -and/or re-export to another country, of encryption software. BEFORE\n\ -using any encryption software, please check the country's laws,\n\ -regulations and policies concerning the import, possession, or use,\n\ -and re-export of encryption software, to see if this is permitted.\n\ -\n\ -Java and all Java-based trademarks are trademarks of Sun Microsystems, Inc. in the United States, other countries, or both.\n -########### end of license property ########################################## diff --git a/jpa/features/org.eclipse.jpt.tests.feature/feature.xml b/jpa/features/org.eclipse.jpt.tests.feature/feature.xml deleted file mode 100644 index 2034cacec4..0000000000 --- a/jpa/features/org.eclipse.jpt.tests.feature/feature.xml +++ /dev/null @@ -1,32 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<feature - id="org.eclipse.jpt.tests.feature" - label="Dali Java Persistence API Tools (JPA) JUnit Tests" - version="1.0.0.qualifier" - provider-name="Eclipse.org"> - - <description> - %description - </description> - - <license url="license.html"> - %license - </license> - - <copyright> - %copyright - </copyright> - - <plugin - id="org.eclipse.jpt.utility.tests" - download-size="0" - install-size="0" - version="0.0.0" /> - - <plugin - id="org.eclipse.jpt.core.tests" - download-size="0" - install-size="0" - version="0.0.0" /> - -</feature> diff --git a/jpa/features/org.eclipse.jpt.tests.feature/license.html b/jpa/features/org.eclipse.jpt.tests.feature/license.html deleted file mode 100644 index 2347060ef3..0000000000 --- a/jpa/features/org.eclipse.jpt.tests.feature/license.html +++ /dev/null @@ -1,93 +0,0 @@ -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd"> -<!-- saved from url=(0044)http://www.eclipse.org/legal/epl/notice.html --> -<HTML><HEAD><TITLE>Eclipse.org Software User Agreement</TITLE> -<META http-equiv=Content-Type content="text/html; charset=iso-8859-1"> -<META content="MSHTML 6.00.2800.1479" name=GENERATOR></HEAD> -<BODY lang=EN-US vLink=purple link=blue> -<H2>Eclipse Foundation Software User Agreement</H2> -<P>January 28, 2005</P> -<H3>Usage Of Content</H3> -<P>THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION -AND/OR OTHER MATERIALS FOR OPEN SOURCE PROJECTS (COLLECTIVELY "CONTENT"). USE OF -THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS AGREEMENT AND/OR THE -TERMS AND CONDITIONS OF LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED -BELOW. BY USING THE CONTENT, YOU AGREE THAT YOUR USE OF THE CONTENT IS GOVERNED -BY THIS AGREEMENT AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE -AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE -TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND CONDITIONS OF ANY -APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW, THEN YOU -MAY NOT USE THE CONTENT.</P> -<H3>Applicable Licenses</H3> -<P>Unless otherwise indicated, all Content made available by the Eclipse -Foundation is provided to you under the terms and conditions of the Eclipse -Public License Version 1.0 ("EPL"). A copy of the EPL is provided with this -Content and is also available at <A -href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</A>. -For purposes of the EPL, "Program" will mean the Content.</P> -<P>Content includes, but is not limited to, source code, object code, -documentation and other files maintained in the Eclipse.org CVS repository -("Repository") in CVS modules ("Modules") and made available as downloadable -archives ("Downloads").</P> -<P>Content may be apportioned into plug-ins ("Plug-ins"), plug-in fragments -("Fragments"), and features ("Features"). A Feature is a bundle of one or more -Plug-ins and/or Fragments and associated material. Files named "feature.xml" may -contain a list of the names and version numbers of the Plug-ins and/or Fragments -associated with a Feature. Plug-ins and Fragments are located in directories -named "plugins" and Features are located in directories named "features".</P> -<P>Features may also include other Features ("Included Features"). Files named -"feature.xml" may contain a list of the names and version numbers of Included -Features.</P> -<P>The terms and conditions governing Plug-ins and Fragments should be contained -in files named "about.html" ("Abouts"). The terms and conditions governing -Features and Included Features should be contained in files named "license.html" -("Feature Licenses"). Abouts and Feature Licenses may be located in any -directory of a Download or Module including, but not limited to the following -locations:</P> -<UL> - <LI>The top-level (root) directory - <LI>Plug-in and Fragment directories - <LI>Subdirectories of the directory named "src" of certain Plug-ins - <LI>Feature directories </LI></UL> -<P>Note: if a Feature made available by the Eclipse Foundation is installed -using the Eclipse Update Manager, you must agree to a license ("Feature Update -License") during the installation process. If the Feature contains Included -Features, the Feature Update License should either provide you with the terms -and conditions governing the Included Features or inform you where you can -locate them. Feature Update Licenses may be found in the "license" property of -files named "feature.properties". Such Abouts, Feature Licenses and Feature -Update Licenses contain the terms and conditions (or references to such terms -and conditions) that govern your use of the associated Content in that -directory.</P> -<P>THE ABOUTS, FEATURE LICENSES AND FEATURE UPDATE LICENSES MAY REFER TO THE EPL -OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS. SOME OF THESE -OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):</P> -<UL> - <LI>Common Public License Version 1.0 (available at <A - href="http://www.eclipse.org/legal/cpl-v10.html">http://www.eclipse.org/legal/cpl-v10.html</A>) - - <LI>Apache Software License 1.1 (available at <A - href="http://www.apache.org/licenses/LICENSE">http://www.apache.org/licenses/LICENSE</A>) - - <LI>Apache Software License 2.0 (available at <A - href="http://www.apache.org/licenses/LICENSE-2.0">http://www.apache.org/licenses/LICENSE-2.0</A>) - - <LI>IBM Public License 1.0 (available at <A - href="http://oss.software.ibm.com/developerworks/opensource/license10.html">http://oss.software.ibm.com/developerworks/opensource/license10.html</A>) - - <LI>Metro Link Public License 1.00 (available at <A - href="http://www.opengroup.org/openmotif/supporters/metrolink/license.html">http://www.opengroup.org/openmotif/supporters/metrolink/license.html</A>) - - <LI>Mozilla Public License Version 1.1 (available at <A - href="http://www.mozilla.org/MPL/MPL-1.1.html">http://www.mozilla.org/MPL/MPL-1.1.html</A>) - </LI></UL> -<P>IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR -TO USE OF THE CONTENT. If no About, Feature License or Feature Update License is -provided, please contact the Eclipse Foundation to determine what terms and -conditions govern that particular Content.</P> -<H3>Cryptography</H3> -<P>Content may contain encryption software. The country in which you are -currently may have restrictions on the import, possession, and use, and/or -re-export to another country, of encryption software. BEFORE using any -encryption software, please check the country's laws, regulations and policies -concerning the import, possession, or use, and re-export of encryption software, -to see if this is permitted.</P></BODY></HTML> diff --git a/jpa/features/org.eclipse.jpt_sdk.feature/.project b/jpa/features/org.eclipse.jpt_sdk.feature/.project deleted file mode 100644 index 33da750336..0000000000 --- a/jpa/features/org.eclipse.jpt_sdk.feature/.project +++ /dev/null @@ -1,17 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<projectDescription> - <name>org.eclipse.jpt_sdk.feature</name> - <comment></comment> - <projects> - </projects> - <buildSpec> - <buildCommand> - <name>org.eclipse.pde.FeatureBuilder</name> - <arguments> - </arguments> - </buildCommand> - </buildSpec> - <natures> - <nature>org.eclipse.pde.FeatureNature</nature> - </natures> -</projectDescription> diff --git a/jpa/features/org.eclipse.jpt_sdk.feature/build.properties b/jpa/features/org.eclipse.jpt_sdk.feature/build.properties deleted file mode 100644 index 28724c6843..0000000000 --- a/jpa/features/org.eclipse.jpt_sdk.feature/build.properties +++ /dev/null @@ -1,9 +0,0 @@ -bin.includes = feature.xml,\ - license.html,\ - feature.properties,\ - epl-v10.html,\ - eclipse_update_120.jpg - -src.includes = build.properties - -generate.feature@org.eclipse.jpt.feature.source=org.eclipse.jpt.feature diff --git a/jpa/features/org.eclipse.jpt_sdk.feature/eclipse_update_120.jpg b/jpa/features/org.eclipse.jpt_sdk.feature/eclipse_update_120.jpg Binary files differdeleted file mode 100644 index bfdf708ad6..0000000000 --- a/jpa/features/org.eclipse.jpt_sdk.feature/eclipse_update_120.jpg +++ /dev/null diff --git a/jpa/features/org.eclipse.jpt_sdk.feature/epl-v10.html b/jpa/features/org.eclipse.jpt_sdk.feature/epl-v10.html deleted file mode 100644 index ed4b196655..0000000000 --- a/jpa/features/org.eclipse.jpt_sdk.feature/epl-v10.html +++ /dev/null @@ -1,328 +0,0 @@ -<html xmlns:o="urn:schemas-microsoft-com:office:office" -xmlns:w="urn:schemas-microsoft-com:office:word" -xmlns="http://www.w3.org/TR/REC-html40"> - -<head> -<meta http-equiv=Content-Type content="text/html; charset=windows-1252"> -<meta name=ProgId content=Word.Document> -<meta name=Generator content="Microsoft Word 9"> -<meta name=Originator content="Microsoft Word 9"> -<link rel=File-List -href="./Eclipse%20EPL%202003_11_10%20Final_files/filelist.xml"> -<title>Eclipse Public License - Version 1.0</title> -<!--[if gte mso 9]><xml> - <o:DocumentProperties> - <o:Revision>2</o:Revision> - <o:TotalTime>3</o:TotalTime> - <o:Created>2004-03-05T23:03:00Z</o:Created> - <o:LastSaved>2004-03-05T23:03:00Z</o:LastSaved> - <o:Pages>4</o:Pages> - <o:Words>1626</o:Words> - <o:Characters>9270</o:Characters> - <o:Lines>77</o:Lines> - <o:Paragraphs>18</o:Paragraphs> - <o:CharactersWithSpaces>11384</o:CharactersWithSpaces> - <o:Version>9.4402</o:Version> - </o:DocumentProperties> -</xml><![endif]--><!--[if gte mso 9]><xml> - <w:WordDocument> - <w:TrackRevisions/> - </w:WordDocument> -</xml><![endif]--> -<style> -<!-- - /* Font Definitions */ -@font-face - {font-family:Tahoma; - panose-1:2 11 6 4 3 5 4 4 2 4; - mso-font-charset:0; - mso-generic-font-family:swiss; - mso-font-pitch:variable; - mso-font-signature:553679495 -2147483648 8 0 66047 0;} - /* Style Definitions */ -p.MsoNormal, li.MsoNormal, div.MsoNormal - {mso-style-parent:""; - margin:0in; - margin-bottom:.0001pt; - mso-pagination:widow-orphan; - font-size:12.0pt; - font-family:"Times New Roman"; - mso-fareast-font-family:"Times New Roman";} -p - {margin-right:0in; - mso-margin-top-alt:auto; - mso-margin-bottom-alt:auto; - margin-left:0in; - mso-pagination:widow-orphan; - font-size:12.0pt; - font-family:"Times New Roman"; - mso-fareast-font-family:"Times New Roman";} -p.BalloonText, li.BalloonText, div.BalloonText - {mso-style-name:"Balloon Text"; - margin:0in; - margin-bottom:.0001pt; - mso-pagination:widow-orphan; - font-size:8.0pt; - font-family:Tahoma; - mso-fareast-font-family:"Times New Roman";} -@page Section1 - {size:8.5in 11.0in; - margin:1.0in 1.25in 1.0in 1.25in; - mso-header-margin:.5in; - mso-footer-margin:.5in; - mso-paper-source:0;} -div.Section1 - {page:Section1;} ---> -</style> -</head> - -<body lang=EN-US style='tab-interval:.5in'> - -<div class=Section1> - -<p align=center style='text-align:center'><b>Eclipse Public License - v 1.0</b> -</p> - -<p><span style='font-size:10.0pt'>THE ACCOMPANYING PROGRAM IS PROVIDED UNDER -THE TERMS OF THIS ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE, -REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE -OF THIS AGREEMENT.</span> </p> - -<p><b><span style='font-size:10.0pt'>1. DEFINITIONS</span></b> </p> - -<p><span style='font-size:10.0pt'>"Contribution" means:</span> </p> - -<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a) -in the case of the initial Contributor, the initial code and documentation -distributed under this Agreement, and<br clear=left> -b) in the case of each subsequent Contributor:</span></p> - -<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>i) -changes to the Program, and</span></p> - -<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>ii) -additions to the Program;</span></p> - -<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>where -such changes and/or additions to the Program originate from and are distributed -by that particular Contributor. A Contribution 'originates' from a Contributor -if it was added to the Program by such Contributor itself or anyone acting on -such Contributor's behalf. Contributions do not include additions to the -Program which: (i) are separate modules of software distributed in conjunction -with the Program under their own license agreement, and (ii) are not derivative -works of the Program. </span></p> - -<p><span style='font-size:10.0pt'>"Contributor" means any person or -entity that distributes the Program.</span> </p> - -<p><span style='font-size:10.0pt'>"Licensed Patents " mean patent -claims licensable by a Contributor which are necessarily infringed by the use -or sale of its Contribution alone or when combined with the Program. </span></p> - -<p><span style='font-size:10.0pt'>"Program" means the Contributions -distributed in accordance with this Agreement.</span> </p> - -<p><span style='font-size:10.0pt'>"Recipient" means anyone who -receives the Program under this Agreement, including all Contributors.</span> </p> - -<p><b><span style='font-size:10.0pt'>2. GRANT OF RIGHTS</span></b> </p> - -<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a) -Subject to the terms of this Agreement, each Contributor hereby grants Recipient -a non-exclusive, worldwide, royalty-free copyright license to<span -style='color:red'> </span>reproduce, prepare derivative works of, publicly -display, publicly perform, distribute and sublicense the Contribution of such -Contributor, if any, and such derivative works, in source code and object code -form.</span></p> - -<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>b) -Subject to the terms of this Agreement, each Contributor hereby grants -Recipient a non-exclusive, worldwide,<span style='color:green'> </span>royalty-free -patent license under Licensed Patents to make, use, sell, offer to sell, import -and otherwise transfer the Contribution of such Contributor, if any, in source -code and object code form. This patent license shall apply to the combination -of the Contribution and the Program if, at the time the Contribution is added -by the Contributor, such addition of the Contribution causes such combination -to be covered by the Licensed Patents. The patent license shall not apply to -any other combinations which include the Contribution. No hardware per se is -licensed hereunder. </span></p> - -<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>c) -Recipient understands that although each Contributor grants the licenses to its -Contributions set forth herein, no assurances are provided by any Contributor -that the Program does not infringe the patent or other intellectual property -rights of any other entity. Each Contributor disclaims any liability to Recipient -for claims brought by any other entity based on infringement of intellectual -property rights or otherwise. As a condition to exercising the rights and -licenses granted hereunder, each Recipient hereby assumes sole responsibility -to secure any other intellectual property rights needed, if any. For example, -if a third party patent license is required to allow Recipient to distribute -the Program, it is Recipient's responsibility to acquire that license before -distributing the Program.</span></p> - -<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>d) -Each Contributor represents that to its knowledge it has sufficient copyright -rights in its Contribution, if any, to grant the copyright license set forth in -this Agreement. </span></p> - -<p><b><span style='font-size:10.0pt'>3. REQUIREMENTS</span></b> </p> - -<p><span style='font-size:10.0pt'>A Contributor may choose to distribute the -Program in object code form under its own license agreement, provided that:</span> -</p> - -<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a) -it complies with the terms and conditions of this Agreement; and</span></p> - -<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>b) -its license agreement:</span></p> - -<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>i) -effectively disclaims on behalf of all Contributors all warranties and -conditions, express and implied, including warranties or conditions of title -and non-infringement, and implied warranties or conditions of merchantability -and fitness for a particular purpose; </span></p> - -<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>ii) -effectively excludes on behalf of all Contributors all liability for damages, -including direct, indirect, special, incidental and consequential damages, such -as lost profits; </span></p> - -<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>iii) -states that any provisions which differ from this Agreement are offered by that -Contributor alone and not by any other party; and</span></p> - -<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>iv) -states that source code for the Program is available from such Contributor, and -informs licensees how to obtain it in a reasonable manner on or through a -medium customarily used for software exchange.<span style='color:blue'> </span></span></p> - -<p><span style='font-size:10.0pt'>When the Program is made available in source -code form:</span> </p> - -<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a) -it must be made available under this Agreement; and </span></p> - -<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>b) a -copy of this Agreement must be included with each copy of the Program. </span></p> - -<p><span style='font-size:10.0pt'>Contributors may not remove or alter any -copyright notices contained within the Program. </span></p> - -<p><span style='font-size:10.0pt'>Each Contributor must identify itself as the -originator of its Contribution, if any, in a manner that reasonably allows -subsequent Recipients to identify the originator of the Contribution. </span></p> - -<p><b><span style='font-size:10.0pt'>4. COMMERCIAL DISTRIBUTION</span></b> </p> - -<p><span style='font-size:10.0pt'>Commercial distributors of software may -accept certain responsibilities with respect to end users, business partners -and the like. While this license is intended to facilitate the commercial use -of the Program, the Contributor who includes the Program in a commercial -product offering should do so in a manner which does not create potential -liability for other Contributors. Therefore, if a Contributor includes the -Program in a commercial product offering, such Contributor ("Commercial -Contributor") hereby agrees to defend and indemnify every other -Contributor ("Indemnified Contributor") against any losses, damages and -costs (collectively "Losses") arising from claims, lawsuits and other -legal actions brought by a third party against the Indemnified Contributor to -the extent caused by the acts or omissions of such Commercial Contributor in -connection with its distribution of the Program in a commercial product -offering. The obligations in this section do not apply to any claims or Losses -relating to any actual or alleged intellectual property infringement. In order -to qualify, an Indemnified Contributor must: a) promptly notify the Commercial -Contributor in writing of such claim, and b) allow the Commercial Contributor -to control, and cooperate with the Commercial Contributor in, the defense and -any related settlement negotiations. The Indemnified Contributor may participate -in any such claim at its own expense.</span> </p> - -<p><span style='font-size:10.0pt'>For example, a Contributor might include the -Program in a commercial product offering, Product X. That Contributor is then a -Commercial Contributor. If that Commercial Contributor then makes performance -claims, or offers warranties related to Product X, those performance claims and -warranties are such Commercial Contributor's responsibility alone. Under this -section, the Commercial Contributor would have to defend claims against the -other Contributors related to those performance claims and warranties, and if a -court requires any other Contributor to pay any damages as a result, the -Commercial Contributor must pay those damages.</span> </p> - -<p><b><span style='font-size:10.0pt'>5. NO WARRANTY</span></b> </p> - -<p><span style='font-size:10.0pt'>EXCEPT AS EXPRESSLY SET FORTH IN THIS -AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT -WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, -WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, -MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely -responsible for determining the appropriateness of using and distributing the -Program and assumes all risks associated with its exercise of rights under this -Agreement , including but not limited to the risks and costs of program errors, -compliance with applicable laws, damage to or loss of data, programs or -equipment, and unavailability or interruption of operations. </span></p> - -<p><b><span style='font-size:10.0pt'>6. DISCLAIMER OF LIABILITY</span></b> </p> - -<p><span style='font-size:10.0pt'>EXCEPT AS EXPRESSLY SET FORTH IN THIS -AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR -ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF -THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF -THE POSSIBILITY OF SUCH DAMAGES.</span> </p> - -<p><b><span style='font-size:10.0pt'>7. GENERAL</span></b> </p> - -<p><span style='font-size:10.0pt'>If any provision of this Agreement is invalid -or unenforceable under applicable law, it shall not affect the validity or -enforceability of the remainder of the terms of this Agreement, and without -further action by the parties hereto, such provision shall be reformed to the -minimum extent necessary to make such provision valid and enforceable.</span> </p> - -<p><span style='font-size:10.0pt'>If Recipient institutes patent litigation -against any entity (including a cross-claim or counterclaim in a lawsuit) -alleging that the Program itself (excluding combinations of the Program with -other software or hardware) infringes such Recipient's patent(s), then such -Recipient's rights granted under Section 2(b) shall terminate as of the date -such litigation is filed. </span></p> - -<p><span style='font-size:10.0pt'>All Recipient's rights under this Agreement -shall terminate if it fails to comply with any of the material terms or -conditions of this Agreement and does not cure such failure in a reasonable -period of time after becoming aware of such noncompliance. If all Recipient's -rights under this Agreement terminate, Recipient agrees to cease use and -distribution of the Program as soon as reasonably practicable. However, -Recipient's obligations under this Agreement and any licenses granted by -Recipient relating to the Program shall continue and survive. </span></p> - -<p><span style='font-size:10.0pt'>Everyone is permitted to copy and distribute -copies of this Agreement, but in order to avoid inconsistency the Agreement is -copyrighted and may only be modified in the following manner. The Agreement -Steward reserves the right to publish new versions (including revisions) of -this Agreement from time to time. No one other than the Agreement Steward has -the right to modify this Agreement. The Eclipse Foundation is the initial -Agreement Steward. The Eclipse Foundation may assign the responsibility to -serve as the Agreement Steward to a suitable separate entity. Each new version -of the Agreement will be given a distinguishing version number. The Program -(including Contributions) may always be distributed subject to the version of -the Agreement under which it was received. In addition, after a new version of -the Agreement is published, Contributor may elect to distribute the Program -(including its Contributions) under the new version. Except as expressly stated -in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to -the intellectual property of any Contributor under this Agreement, whether -expressly, by implication, estoppel or otherwise. All rights in the Program not -expressly granted under this Agreement are reserved.</span> </p> - -<p><span style='font-size:10.0pt'>This Agreement is governed by the laws of the -State of New York and the intellectual property laws of the United States of -America. No party to this Agreement will bring a legal action under this -Agreement more than one year after the cause of action arose. Each party waives -its rights to a jury trial in any resulting litigation.</span> </p> - -<p class=MsoNormal><![if !supportEmptyParas]> <![endif]><o:p></o:p></p> - -</div> - -</body> - -</html>
\ No newline at end of file diff --git a/jpa/features/org.eclipse.jpt_sdk.feature/feature.properties b/jpa/features/org.eclipse.jpt_sdk.feature/feature.properties deleted file mode 100644 index 60a6d9acfe..0000000000 --- a/jpa/features/org.eclipse.jpt_sdk.feature/feature.properties +++ /dev/null @@ -1,139 +0,0 @@ -############################################################################### -# Copyright (c) 2006 Oracle. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# Oracle. - initial API and implementation -############################################################################### - -# "featureName" property - name of the feature -featureName=Java Persistence API Tools Plug-in SDK - -# "providerName" property - name of the company that provides the feature -providerName=Eclipse.org - -# "updateSiteName" property - label for the update site -updateSiteName=The Eclipse Web Tools Platform (WTP) Project update site - -# "description" property - description of the feature -description=Source code zips for JPA Tools - -# "copyright" property - text of the "Feature Update Copyright" -copyright=\ -Copyright (c) 2006-07 Oracle Corporation.\n\ -All rights reserved. This program and the accompanying materials\n\ -are made available under the terms of the Eclipse Public License v1.0\n\ -which accompanies this distribution, and is available at\n\ -http://www.eclipse.org/legal/epl-v10.html\n\ -\n\ -Contributors:\n\ - Oracle - initial API and implementation\n -################ end of copyright property #################################### - -# "licenseURL" property - URL of the "Feature License" -# do not translate value - just change to point to a locale-specific HTML page -licenseURL=license.html - -# "license" property - text of the "Feature Update License" -# should be plain text version of license agreement pointed to be "licenseURL" -license=\ -ECLIPSE FOUNDATION SOFTWARE USER AGREEMENT\n\ -March 17, 2005\n\ -\n\ -Usage Of Content\n\ -\n\ -THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR\n\ -OTHER MATERIALS FOR OPEN SOURCE PROJECTS (COLLECTIVELY "CONTENT").\n\ -USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS\n\ -AGREEMENT AND/OR THE TERMS AND CONDITIONS OF LICENSE AGREEMENTS OR\n\ -NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU\n\ -AGREE THAT YOUR USE OF THE CONTENT IS GOVERNED BY THIS AGREEMENT\n\ -AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS\n\ -OR NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE\n\ -TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND CONDITIONS\n\ -OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED\n\ -BELOW, THEN YOU MAY NOT USE THE CONTENT.\n\ -\n\ -Applicable Licenses\n\ -\n\ -Unless otherwise indicated, all Content made available by the Eclipse Foundation\n\ -is provided to you under the terms and conditions of the Eclipse Public\n\ -License Version 1.0 ("EPL"). A copy of the EPL is provided with this\n\ -Content and is also available at http://www.eclipse.org/legal/epl-v10.html.\n\ -For purposes of the EPL, "Program" will mean the Content.\n\ -\n\ -Content includes, but is not limited to, source code, object code,\n\ -documentation and other files maintained in the Eclipse.org CVS\n\ -repository ("Repository") in CVS modules ("Modules") and made available\n\ -as downloadable archives ("Downloads").\n\ -\n\ - - Content may be structured and packaged into modules to facilitate delivering,\n\ - extending, and upgrading the Content. Typical modules may include plug-ins ("Plug-ins"),\n\ - plug-in fragments ("Fragments"), and features ("Features").\n\ - - Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java? ARchive)\n\ - in a directory named "plugins".\n\ - - A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material.\n\ - Each Feature may be packaged as a sub-directory in a directory named "features".\n\ - Within a Feature, files named "feature.xml" may contain a list of the names and version\n\ - numbers of the Plug-ins and/or Fragments associated with that Feature.\n\ - - Features may also include other Features ("Included Features"). Within a Feature, files\n\ - named "feature.xml" may contain a list of the names and version numbers of Included Features.\n\ -\n\ -Features may also include other Features ("Included Features"). Files named\n\ -"feature.xml" may contain a list of the names and version numbers of\n\ -Included Features.\n\ -\n\ -The terms and conditions governing Plug-ins and Fragments should be\n\ -contained in files named "about.html" ("Abouts"). The terms and\n\ -conditions governing Features and Included Features should be contained\n\ -in files named "license.html" ("Feature Licenses"). Abouts and Feature\n\ -Licenses may be located in any directory of a Download or Module\n\ -including, but not limited to the following locations:\n\ -\n\ - - The top-level (root) directory\n\ - - Plug-in and Fragment directories\n\ - - Inside Plug-ins and Fragments packaged as JARs\n\ - - Sub-directories of the directory named "src" of certain Plug-ins\n\ - - Feature directories\n\ -\n\ -Note: if a Feature made available by the Eclipse Foundation is installed using the\n\ -Eclipse Update Manager, you must agree to a license ("Feature Update\n\ -License") during the installation process. If the Feature contains\n\ -Included Features, the Feature Update License should either provide you\n\ -with the terms and conditions governing the Included Features or inform\n\ -you where you can locate them. Feature Update Licenses may be found in\n\ -the "license" property of files named "feature.properties". Such Abouts,\n\ -Feature Licenses and Feature Update Licenses contain the terms and\n\ -conditions (or references to such terms and conditions) that govern your\n\ -use of the associated Content in that directory.\n\ -\n\ -THE ABOUTS, FEATURE LICENSES AND FEATURE UPDATE LICENSES MAY REFER\n\ -TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS.\n\ -SOME OF THESE OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):\n\ -\n\ - - Common Public License Version 1.0 (available at http://www.eclipse.org/legal/cpl-v10.html)\n\ - - Apache Software License 1.1 (available at http://www.apache.org/licenses/LICENSE)\n\ - - Apache Software License 2.0 (available at http://www.apache.org/licenses/LICENSE-2.0)\n\ - - IBM Public License 1.0 (available at http://oss.software.ibm.com/developerworks/opensource/license10.html)\n\ - - Metro Link Public License 1.00 (available at http://www.opengroup.org/openmotif/supporters/metrolink/license.html)\n\ - - Mozilla Public License Version 1.1 (available at http://www.mozilla.org/MPL/MPL-1.1.html)\n\ -\n\ -IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR\n\ -TO USE OF THE CONTENT. If no About, Feature License or Feature Update License\n\ -is provided, please contact the Eclipse Foundation to determine what terms and conditions\n\ -govern that particular Content.\n\ -\n\ -Cryptography\n\ -\n\ -Content may contain encryption software. The country in which you are\n\ -currently may have restrictions on the import, possession, and use,\n\ -and/or re-export to another country, of encryption software. BEFORE\n\ -using any encryption software, please check the country's laws,\n\ -regulations and policies concerning the import, possession, or use,\n\ -and re-export of encryption software, to see if this is permitted.\n\ -\n\ -Java and all Java-based trademarks are trademarks of Sun Microsystems, Inc. in the United States, other countries, or both.\n -########### end of license property ########################################## diff --git a/jpa/features/org.eclipse.jpt_sdk.feature/feature.xml b/jpa/features/org.eclipse.jpt_sdk.feature/feature.xml deleted file mode 100644 index 78f3de1519..0000000000 --- a/jpa/features/org.eclipse.jpt_sdk.feature/feature.xml +++ /dev/null @@ -1,28 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<feature - id="org.eclipse.jpt_sdk.feature" - label="%featureName" - version="1.0.0.qualifier" - provider-name="%providerName"> - - <description> - %description - </description> - - <copyright> - %copyright - </copyright> - - <license url="license.html"> - %license - </license> - - <includes - id="org.eclipse.jpt.feature" - version="0.0.0"/> - - <includes - id="org.eclipse.jpt.feature.source" - version="0.0.0"/> - -</feature> diff --git a/jpa/features/org.eclipse.jpt_sdk.feature/license.html b/jpa/features/org.eclipse.jpt_sdk.feature/license.html deleted file mode 100644 index 2347060ef3..0000000000 --- a/jpa/features/org.eclipse.jpt_sdk.feature/license.html +++ /dev/null @@ -1,93 +0,0 @@ -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd"> -<!-- saved from url=(0044)http://www.eclipse.org/legal/epl/notice.html --> -<HTML><HEAD><TITLE>Eclipse.org Software User Agreement</TITLE> -<META http-equiv=Content-Type content="text/html; charset=iso-8859-1"> -<META content="MSHTML 6.00.2800.1479" name=GENERATOR></HEAD> -<BODY lang=EN-US vLink=purple link=blue> -<H2>Eclipse Foundation Software User Agreement</H2> -<P>January 28, 2005</P> -<H3>Usage Of Content</H3> -<P>THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION -AND/OR OTHER MATERIALS FOR OPEN SOURCE PROJECTS (COLLECTIVELY "CONTENT"). USE OF -THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS AGREEMENT AND/OR THE -TERMS AND CONDITIONS OF LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED -BELOW. BY USING THE CONTENT, YOU AGREE THAT YOUR USE OF THE CONTENT IS GOVERNED -BY THIS AGREEMENT AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE -AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE -TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND CONDITIONS OF ANY -APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW, THEN YOU -MAY NOT USE THE CONTENT.</P> -<H3>Applicable Licenses</H3> -<P>Unless otherwise indicated, all Content made available by the Eclipse -Foundation is provided to you under the terms and conditions of the Eclipse -Public License Version 1.0 ("EPL"). A copy of the EPL is provided with this -Content and is also available at <A -href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</A>. -For purposes of the EPL, "Program" will mean the Content.</P> -<P>Content includes, but is not limited to, source code, object code, -documentation and other files maintained in the Eclipse.org CVS repository -("Repository") in CVS modules ("Modules") and made available as downloadable -archives ("Downloads").</P> -<P>Content may be apportioned into plug-ins ("Plug-ins"), plug-in fragments -("Fragments"), and features ("Features"). A Feature is a bundle of one or more -Plug-ins and/or Fragments and associated material. Files named "feature.xml" may -contain a list of the names and version numbers of the Plug-ins and/or Fragments -associated with a Feature. Plug-ins and Fragments are located in directories -named "plugins" and Features are located in directories named "features".</P> -<P>Features may also include other Features ("Included Features"). Files named -"feature.xml" may contain a list of the names and version numbers of Included -Features.</P> -<P>The terms and conditions governing Plug-ins and Fragments should be contained -in files named "about.html" ("Abouts"). The terms and conditions governing -Features and Included Features should be contained in files named "license.html" -("Feature Licenses"). Abouts and Feature Licenses may be located in any -directory of a Download or Module including, but not limited to the following -locations:</P> -<UL> - <LI>The top-level (root) directory - <LI>Plug-in and Fragment directories - <LI>Subdirectories of the directory named "src" of certain Plug-ins - <LI>Feature directories </LI></UL> -<P>Note: if a Feature made available by the Eclipse Foundation is installed -using the Eclipse Update Manager, you must agree to a license ("Feature Update -License") during the installation process. If the Feature contains Included -Features, the Feature Update License should either provide you with the terms -and conditions governing the Included Features or inform you where you can -locate them. Feature Update Licenses may be found in the "license" property of -files named "feature.properties". Such Abouts, Feature Licenses and Feature -Update Licenses contain the terms and conditions (or references to such terms -and conditions) that govern your use of the associated Content in that -directory.</P> -<P>THE ABOUTS, FEATURE LICENSES AND FEATURE UPDATE LICENSES MAY REFER TO THE EPL -OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS. SOME OF THESE -OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):</P> -<UL> - <LI>Common Public License Version 1.0 (available at <A - href="http://www.eclipse.org/legal/cpl-v10.html">http://www.eclipse.org/legal/cpl-v10.html</A>) - - <LI>Apache Software License 1.1 (available at <A - href="http://www.apache.org/licenses/LICENSE">http://www.apache.org/licenses/LICENSE</A>) - - <LI>Apache Software License 2.0 (available at <A - href="http://www.apache.org/licenses/LICENSE-2.0">http://www.apache.org/licenses/LICENSE-2.0</A>) - - <LI>IBM Public License 1.0 (available at <A - href="http://oss.software.ibm.com/developerworks/opensource/license10.html">http://oss.software.ibm.com/developerworks/opensource/license10.html</A>) - - <LI>Metro Link Public License 1.00 (available at <A - href="http://www.opengroup.org/openmotif/supporters/metrolink/license.html">http://www.opengroup.org/openmotif/supporters/metrolink/license.html</A>) - - <LI>Mozilla Public License Version 1.1 (available at <A - href="http://www.mozilla.org/MPL/MPL-1.1.html">http://www.mozilla.org/MPL/MPL-1.1.html</A>) - </LI></UL> -<P>IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR -TO USE OF THE CONTENT. If no About, Feature License or Feature Update License is -provided, please contact the Eclipse Foundation to determine what terms and -conditions govern that particular Content.</P> -<H3>Cryptography</H3> -<P>Content may contain encryption software. The country in which you are -currently may have restrictions on the import, possession, and use, and/or -re-export to another country, of encryption software. BEFORE using any -encryption software, please check the country's laws, regulations and policies -concerning the import, possession, or use, and re-export of encryption software, -to see if this is permitted.</P></BODY></HTML> diff --git a/jpa/plugins/org.eclipse.jpt.db.ui/.classpath b/jpa/plugins/org.eclipse.jpt.db.ui/.classpath deleted file mode 100644 index 751c8f2e50..0000000000 --- a/jpa/plugins/org.eclipse.jpt.db.ui/.classpath +++ /dev/null @@ -1,7 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<classpath> - <classpathentry kind="src" path="src"/> - <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> - <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> - <classpathentry kind="output" path="bin"/> -</classpath> diff --git a/jpa/plugins/org.eclipse.jpt.db.ui/.cvsignore b/jpa/plugins/org.eclipse.jpt.db.ui/.cvsignore deleted file mode 100644 index 814c6a80a6..0000000000 --- a/jpa/plugins/org.eclipse.jpt.db.ui/.cvsignore +++ /dev/null @@ -1,3 +0,0 @@ -bin -build.xml -javaCompiler...args
\ No newline at end of file diff --git a/jpa/plugins/org.eclipse.jpt.db.ui/.project b/jpa/plugins/org.eclipse.jpt.db.ui/.project deleted file mode 100644 index 88ea5da610..0000000000 --- a/jpa/plugins/org.eclipse.jpt.db.ui/.project +++ /dev/null @@ -1,28 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<projectDescription> - <name>org.eclipse.jpt.db.ui</name> - <comment></comment> - <projects> - </projects> - <buildSpec> - <buildCommand> - <name>org.eclipse.jdt.core.javabuilder</name> - <arguments> - </arguments> - </buildCommand> - <buildCommand> - <name>org.eclipse.pde.ManifestBuilder</name> - <arguments> - </arguments> - </buildCommand> - <buildCommand> - <name>org.eclipse.pde.SchemaBuilder</name> - <arguments> - </arguments> - </buildCommand> - </buildSpec> - <natures> - <nature>org.eclipse.pde.PluginNature</nature> - <nature>org.eclipse.jdt.core.javanature</nature> - </natures> -</projectDescription> diff --git a/jpa/plugins/org.eclipse.jpt.db.ui/META-INF/MANIFEST.MF b/jpa/plugins/org.eclipse.jpt.db.ui/META-INF/MANIFEST.MF deleted file mode 100644 index e1b6566ff9..0000000000 --- a/jpa/plugins/org.eclipse.jpt.db.ui/META-INF/MANIFEST.MF +++ /dev/null @@ -1,15 +0,0 @@ -Manifest-Version: 1.0 -Bundle-ManifestVersion: 2 -Bundle-Name: %pluginName -Bundle-Vendor: %providerName -Bundle-SymbolicName: org.eclipse.jpt.db.ui -Bundle-Version: 1.0.0.qualifier -Bundle-ClassPath: . -Bundle-Localization: plugin -Eclipse-AutoStart: true -Export-Package: org.eclipse.jpt.db.ui.internal -Require-Bundle: org.eclipse.ui, - org.eclipse.jpt.db, - org.eclipse.datatools.connectivity.ui, - org.eclipse.datatools.sqltools.editor.core -Bundle-RequiredExecutionEnvironment: J2SE-1.5 diff --git a/jpa/plugins/org.eclipse.jpt.db.ui/build.properties b/jpa/plugins/org.eclipse.jpt.db.ui/build.properties deleted file mode 100644 index acb8fd859a..0000000000 --- a/jpa/plugins/org.eclipse.jpt.db.ui/build.properties +++ /dev/null @@ -1,16 +0,0 @@ -############################################################################### -# Copyright (c) 2006 Oracle. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# Oracle. - initial API and implementation -############################################################################### -source.. = src/ -output.. = bin/ -bin.includes = .,\ - META-INF/,\ - plugin.properties -jars.compile.order = . diff --git a/jpa/plugins/org.eclipse.jpt.db.ui/component.xml b/jpa/plugins/org.eclipse.jpt.db.ui/component.xml deleted file mode 100644 index bf648aaa4f..0000000000 --- a/jpa/plugins/org.eclipse.jpt.db.ui/component.xml +++ /dev/null @@ -1 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?><component xmlns="http://eclipse.org/wtp/releng/tools/component-model" name="org.eclipse.jpt.db.ui"><description url=""></description><component-depends unrestricted="true"></component-depends><plugin id="org.eclipse.jpt.db.ui" fragment="false"/></component>
\ No newline at end of file diff --git a/jpa/plugins/org.eclipse.jpt.db.ui/src/org/eclipse/jpt/db/ui/internal/DTPUiTools.java b/jpa/plugins/org.eclipse.jpt.db.ui/src/org/eclipse/jpt/db/ui/internal/DTPUiTools.java deleted file mode 100644 index 632fe81411..0000000000 --- a/jpa/plugins/org.eclipse.jpt.db.ui/src/org/eclipse/jpt/db/ui/internal/DTPUiTools.java +++ /dev/null @@ -1,99 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2007 Oracle. All rights reserved. -* This program and the accompanying materials are made available under the -* terms of the Eclipse Public License v1.0, which accompanies this distribution -* and is available at http://www.eclipse.org/legal/epl-v10.html. -* -* Contributors: -* Oracle - initial API and implementation -*******************************************************************************/ -package org.eclipse.jpt.db.ui.internal; - -import org.eclipse.datatools.connectivity.ICategory; -import org.eclipse.datatools.connectivity.IConnectionProfile; -import org.eclipse.datatools.connectivity.IProfileListener; -import org.eclipse.datatools.connectivity.ProfileManager; -import org.eclipse.datatools.connectivity.internal.ConnectionProfileManager; -import org.eclipse.datatools.connectivity.internal.ui.wizards.CPWizardNode; -import org.eclipse.datatools.connectivity.internal.ui.wizards.NewCPWizard; -import org.eclipse.datatools.connectivity.internal.ui.wizards.ProfileWizardProvider; -import org.eclipse.datatools.connectivity.ui.wizards.IWizardCategoryProvider; -import org.eclipse.jface.viewers.Viewer; -import org.eclipse.jface.viewers.ViewerFilter; -import org.eclipse.jface.window.Window; -import org.eclipse.jface.wizard.WizardDialog; -import org.eclipse.jpt.db.internal.ConnectionProfileRepository; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Shell; - -/** - * ConnectionProfileUiTools - */ -public class DTPUiTools { - - /** - * Launch the DTP New Connection Profile wizard to create a new database connection profile. - * - * Returns the name of the added profile, or null if the wizard is cancelled. ConnectionProfileRepository - * can be used to retrieve the added connection profile. - */ - public static String createNewProfile() { - NewCPWizard wizard; - WizardDialog wizardDialog; - - // Filter datasource category - ViewerFilter viewerFilter = new ViewerFilter() { - - public boolean select( Viewer viewer, Object parentElement, Object element) { - - CPWizardNode wizardNode = ( CPWizardNode) element; - if( !( wizardNode.getProvider() instanceof IWizardCategoryProvider)) { - ICategory cat = ConnectionProfileManager.getInstance().getProvider( - (( ProfileWizardProvider) wizardNode.getProvider()).getProfile()).getCategory(); - - // Only display wizards belong to database category - while( cat != null) { - if( cat.getId().equals( ConnectionProfileRepository.DATABASE_CATEGORY_ID)) - return true; - else - cat = cat.getParent(); - } - } - return false; - } - }; - wizard = new NewCPWizard( viewerFilter, null); - Shell currentShell = Display.getCurrent().getActiveShell(); - wizardDialog = new WizardDialog( currentShell, wizard); - wizardDialog.setBlockOnOpen( true); - - LocalProfileListener listener = new LocalProfileListener(); - ProfileManager.getInstance().addProfileListener( listener); - - if( wizardDialog.open() == Window.CANCEL) { - ProfileManager.getInstance().removeProfileListener( listener); - return null; - } - IConnectionProfile addedProfile = listener.addedProfile; - ProfileManager.getInstance().removeProfileListener( listener); - - return addedProfile.getName(); - } - - private static class LocalProfileListener implements IProfileListener { - IConnectionProfile addedProfile; - - public void profileAdded( IConnectionProfile profile) { - addedProfile = profile; - } - - public void profileChanged( IConnectionProfile profile) { - // do nothing - } - - public void profileDeleted( IConnectionProfile profile) { - // do nothing - } - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/META-INF/MANIFEST.MF b/jpa/plugins/org.eclipse.jpt.doc.user/META-INF/MANIFEST.MF index f5e7343a89..a3e8ae5c6a 100644 --- a/jpa/plugins/org.eclipse.jpt.doc.user/META-INF/MANIFEST.MF +++ b/jpa/plugins/org.eclipse.jpt.doc.user/META-INF/MANIFEST.MF @@ -1,7 +1,8 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %pluginName +Bundle-Vendor: %providerName Bundle-SymbolicName: org.eclipse.jpt.doc.user;singleton:=true Bundle-Version: 1.0.0.qualifier Bundle-Localization: plugin -Bundle-Vendor: %providerName +Eclipse-LazyStart: true diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/build.properties b/jpa/plugins/org.eclipse.jpt.doc.user/build.properties index 8ad51cb85c..78f4894a98 100644 --- a/jpa/plugins/org.eclipse.jpt.doc.user/build.properties +++ b/jpa/plugins/org.eclipse.jpt.doc.user/build.properties @@ -1,2 +1,101 @@ bin.includes = META-INF/,\ - plugin.xml + about.htm,\ + cheatsheets/,\ + concept_mapping.htm,\ + concept_persistence.htm,\ + concepts.htm,\ + concepts001.htm,\ + concepts002.htm,\ + concepts003.htm,\ + contexts.xml,\ + dcommon/,\ + getting_started.htm,\ + getting_started001.htm,\ + getting_started002.htm,\ + getting_started003.htm,\ + getting_started004.htm,\ + getting_started005.htm,\ + getting_started006.htm,\ + getting_started007.htm,\ + getting_started008.htm,\ + getting_started009.htm,\ + getting_started010.htm,\ + getting_started011.htm,\ + getting_started012.htm,\ + getting_started013.htm,\ + getting_started014.htm,\ + getting_started015.htm,\ + getting_started016.htm,\ + getting_started017.htm,\ + getting_started018.htm,\ + getting_started019.htm,\ + img/,\ + index.xml,\ + legal.htm,\ + plugin.properties,\ + plugin.xml,\ + ref_jpa_facet.htm,\ + ref_mapping_general.htm,\ + ref_new_jpa_project.htm,\ + ref_new_jpa_project_wizard.htm,\ + ref_persistence_map_view.htm,\ + ref_persistence_outline.htm,\ + ref_persistence_perspective.htm,\ + ref_persistence_prop_view.htm,\ + ref_primary_key.htm,\ + ref_project_properties.htm,\ + reference.htm,\ + reference001.htm,\ + reference002.htm,\ + reference003.htm,\ + reference004.htm,\ + reference005.htm,\ + reference006.htm,\ + reference007.htm,\ + reference008.htm,\ + reference009.htm,\ + reference010.htm,\ + reference011.htm,\ + reference012.htm,\ + reference013.htm,\ + reference014.htm,\ + reference015.htm,\ + reference016.htm,\ + reference017.htm,\ + reference018.htm,\ + task_add_persistence.htm,\ + task_create_new_project.htm,\ + task_generate_ddl.htm,\ + task_generate_entities.htm,\ + task_inheritance.htm,\ + task_manage_persistence.htm,\ + task_manage_persistence001.htm,\ + task_mapping.htm,\ + tasks.htm,\ + tasks001.htm,\ + tasks002.htm,\ + tasks003.htm,\ + tasks004.htm,\ + tasks005.htm,\ + tasks006.htm,\ + tasks007.htm,\ + tasks008.htm,\ + tasks009.htm,\ + tasks010.htm,\ + tasks011.htm,\ + tasks012.htm,\ + tasks013.htm,\ + tasks014.htm,\ + tasks015.htm,\ + tasks016.htm,\ + tasks017.htm,\ + tasks018.htm,\ + tasks019.htm,\ + tasks020.htm,\ + tasks021.htm,\ + tips_and_tricks.htm,\ + toc.xml,\ + whats_new.htm,\ + whats_new001.htm,\ + whats_new002.htm,\ + whats_new003.htm diff --git a/jpa/plugins/org.eclipse.jpt.db.ui/plugin.properties b/jpa/plugins/org.eclipse.jpt.doc.user/plugin.properties index 2b0e5835b1..85654952f5 100644 --- a/jpa/plugins/org.eclipse.jpt.db.ui/plugin.properties +++ b/jpa/plugins/org.eclipse.jpt.doc.user/plugin.properties @@ -1,5 +1,5 @@ ############################################################################### -# Copyright (c) 2006 Oracle. +# Copyright (c) 2007 Oracle. # All rights reserved. This program and the accompanying materials # are made available under the terms of the Eclipse Public License v1.0 # which accompanies this distribution, and is available at @@ -20,6 +20,5 @@ # %%% END OF TRANSLATED PROPERTIES %%% # ==================================================================== -pluginName = Java Persistence API Tools - DB UI +pluginName = Java Persistence Documentation - Doc providerName = Eclipse.org - diff --git a/jpa/plugins/org.eclipse.jpt.gen/.classpath b/jpa/plugins/org.eclipse.jpt.gen/.classpath deleted file mode 100644 index 751c8f2e50..0000000000 --- a/jpa/plugins/org.eclipse.jpt.gen/.classpath +++ /dev/null @@ -1,7 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<classpath> - <classpathentry kind="src" path="src"/> - <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> - <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> - <classpathentry kind="output" path="bin"/> -</classpath> diff --git a/jpa/plugins/org.eclipse.jpt.gen/.cvsignore b/jpa/plugins/org.eclipse.jpt.gen/.cvsignore deleted file mode 100644 index 2d14989f69..0000000000 --- a/jpa/plugins/org.eclipse.jpt.gen/.cvsignore +++ /dev/null @@ -1,3 +0,0 @@ -bin -@dot -build.xml diff --git a/jpa/plugins/org.eclipse.jpt.gen/.project b/jpa/plugins/org.eclipse.jpt.gen/.project deleted file mode 100644 index ef2d5088ee..0000000000 --- a/jpa/plugins/org.eclipse.jpt.gen/.project +++ /dev/null @@ -1,28 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<projectDescription> - <name>org.eclipse.jpt.gen</name> - <comment></comment> - <projects> - </projects> - <buildSpec> - <buildCommand> - <name>org.eclipse.jdt.core.javabuilder</name> - <arguments> - </arguments> - </buildCommand> - <buildCommand> - <name>org.eclipse.pde.ManifestBuilder</name> - <arguments> - </arguments> - </buildCommand> - <buildCommand> - <name>org.eclipse.pde.SchemaBuilder</name> - <arguments> - </arguments> - </buildCommand> - </buildSpec> - <natures> - <nature>org.eclipse.pde.PluginNature</nature> - <nature>org.eclipse.jdt.core.javanature</nature> - </natures> -</projectDescription> diff --git a/jpa/plugins/org.eclipse.jpt.gen/META-INF/MANIFEST.MF b/jpa/plugins/org.eclipse.jpt.gen/META-INF/MANIFEST.MF deleted file mode 100644 index 4035383419..0000000000 --- a/jpa/plugins/org.eclipse.jpt.gen/META-INF/MANIFEST.MF +++ /dev/null @@ -1,16 +0,0 @@ -Manifest-Version: 1.0 -Bundle-ManifestVersion: 2 -Bundle-Name: %pluginName -Bundle-Vendor: %providerName -Bundle-SymbolicName: org.eclipse.jpt.gen -Bundle-Version: 1.0.0.qualifier -Bundle-ClassPath: . -Bundle-Localization: plugin -Eclipse-LazyStart: true -Export-Package: org.eclipse.jpt.gen.internal -Require-Bundle: org.eclipse.core.runtime, - org.eclipse.jdt.core, - org.eclipse.jpt.core, - org.eclipse.jpt.db, - org.eclipse.jpt.utility -Bundle-RequiredExecutionEnvironment: J2SE-1.5 diff --git a/jpa/plugins/org.eclipse.jpt.gen/build.properties b/jpa/plugins/org.eclipse.jpt.gen/build.properties deleted file mode 100644 index 9cce53a029..0000000000 --- a/jpa/plugins/org.eclipse.jpt.gen/build.properties +++ /dev/null @@ -1,16 +0,0 @@ -############################################################################### -# Copyright (c) 2007 Oracle. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# Oracle. - initial API and implementation -############################################################################### -source.. = src/ -output.. = bin/ -bin.includes = .,\ - META-INF/,\ - plugin.properties -jars.compile.order = . diff --git a/jpa/plugins/org.eclipse.jpt.gen/component.xml b/jpa/plugins/org.eclipse.jpt.gen/component.xml deleted file mode 100644 index 7a4e04e21f..0000000000 --- a/jpa/plugins/org.eclipse.jpt.gen/component.xml +++ /dev/null @@ -1 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?><component xmlns="http://eclipse.org/wtp/releng/tools/component-model" name="org.eclipse.jpt.gen"><description url=""></description><component-depends unrestricted="true"></component-depends><plugin id="org.eclipse.jpt.gen" fragment="false"/></component>
\ No newline at end of file diff --git a/jpa/plugins/org.eclipse.jpt.gen/plugin.properties b/jpa/plugins/org.eclipse.jpt.gen/plugin.properties deleted file mode 100644 index 4875a8b174..0000000000 --- a/jpa/plugins/org.eclipse.jpt.gen/plugin.properties +++ /dev/null @@ -1,24 +0,0 @@ -############################################################################### -# Copyright (c) 2007 Oracle. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# Oracle - initial API and implementation -############################################################################### -# ==================================================================== -# To code developer: -# Do NOT change the properties between this line and the -# "%%% END OF TRANSLATED PROPERTIES %%%" line. -# Make a new property name, append to the end of the file and change -# the code to use the new property. -# ==================================================================== - -# ==================================================================== -# %%% END OF TRANSLATED PROPERTIES %%% -# ==================================================================== - -pluginName = Java Persistence API Tools - Entity Gen -providerName = Eclipse.org diff --git a/jpa/plugins/org.eclipse.jpt.gen/src/org/eclipse/jpt/gen/internal/EntityGenerator.java b/jpa/plugins/org.eclipse.jpt.gen/src/org/eclipse/jpt/gen/internal/EntityGenerator.java deleted file mode 100644 index f7919ffd9f..0000000000 --- a/jpa/plugins/org.eclipse.jpt.gen/src/org/eclipse/jpt/gen/internal/EntityGenerator.java +++ /dev/null @@ -1,1433 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2007 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.gen.internal; - -import java.io.PrintWriter; -import java.io.Serializable; -import java.io.StringWriter; -import java.lang.reflect.Modifier; -import java.text.Collator; -import java.util.Comparator; -import java.util.HashMap; -import java.util.Iterator; -import java.util.Map; -import java.util.Set; -import java.util.TreeSet; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.jdt.core.IJavaModelStatusConstants; -import org.eclipse.jdt.core.IPackageFragment; -import org.eclipse.jdt.core.JavaModelException; -import org.eclipse.jpt.core.internal.content.java.mappings.JPA; -import org.eclipse.jpt.db.internal.Column; -import org.eclipse.jpt.db.internal.ForeignKey; -import org.eclipse.jpt.db.internal.Table; -import org.eclipse.jpt.utility.internal.IndentingPrintWriter; -import org.eclipse.jpt.utility.internal.JavaType; -import org.eclipse.jpt.utility.internal.StringTools; -import org.eclipse.jpt.utility.internal.iterators.FilteringIterator; - -// TODO handle table names that are illegal class names -// TODO handle table names that are illegal file names -// TODO handle column names that are illegal field/method names -// TODO format code per preferences -// TODO organize imports per preferences -// TODO prompt user to overwrite existing classes -/** - * This generator will generate an entity for a table. - */ -public class EntityGenerator { - final Config config; - private final IPackageFragment packageFragment; - private final GenTable genTable; - private final String entityClassName; - private final OverwriteConfirmer overwriteConfirmer; - private final IProgressMonitor monitor; - - - // ********** public API ********** - - public static void generateEntity(Config config, IPackageFragment packageFragment, GenTable genTable, OverwriteConfirmer overwriteConfirmer, IProgressMonitor monitor) { - if ((config == null) || (packageFragment == null) || (genTable == null)) { - throw new NullPointerException(); - } - new EntityGenerator(config, packageFragment, genTable, overwriteConfirmer, monitor).generateEntity(); - } - - - // ********** constructor/initialization ********** - - private EntityGenerator(Config config, IPackageFragment packageFragment, GenTable genTable, OverwriteConfirmer overwriteConfirmer, IProgressMonitor monitor) { - super(); - this.config = config; - this.packageFragment = packageFragment; - this.genTable = genTable; - this.entityClassName = this.fullyQualify(this.entityName()); - this.overwriteConfirmer = overwriteConfirmer; - this.monitor = monitor; - } - - - // ********** code gen ********** - - private void generateEntity() { - try { - this.generateEntity_(); - } catch (JavaModelException ex) { - throw new RuntimeException(ex); - } - } - - private void generateEntity_() throws JavaModelException { - String fileName = this.entityName() + ".java"; - String source = this.buildSource(); - try { - this.packageFragment.createCompilationUnit(fileName, source, false, this.monitor); - } catch (JavaModelException ex) { - if (ex.getJavaModelStatus().getCode() == IJavaModelStatusConstants.NAME_COLLISION) { - if (this.overwriteConfirmer.overwrite(this.entityClassName)) { - this.packageFragment.createCompilationUnit(fileName, source, true, this.monitor); - } - } else { - throw ex; - } - } - } - - /** - * build the "body" source first; then build the "package" and "imports" source - * and concatenate the "body" source to it - */ - private String buildSource() { - // build the body source first so we can gather up the import statements - BodySource bodySource = this.buildBodySource(); - - StringWriter sw = new StringWriter(bodySource.length() + 1000); - PrintWriter pw = new PrintWriter(sw); - this.printPackageAndImportsOn(pw, bodySource); - pw.print(bodySource.source()); - return sw.toString(); - } - - private BodySource buildBodySource() { - EntitySourceWriter pw = new EntitySourceWriter(this.packageName(), this.entityClassName); - this.printBodySourceOn(pw); - return pw; - } - - private void printBodySourceOn(EntitySourceWriter pw) { - this.printClassDeclarationOn(pw); - - pw.indent(); - this.printEntityPrimaryKeyFieldsOn(pw); - this.printEntityNonPrimaryKeyBasicFieldsOn(pw); - this.printEntityManyToOneFieldsOn(pw); - this.printEntityOneToManyFieldsOn(pw); - this.printEntityOwnedManyToManyFieldsOn(pw); - this.printEntityNonOwnedManyToManyFieldsOn(pw); - this.printSerialVersionUID(pw); - pw.println(); - - this.printZeroArgumentConstructorOn(this.entityName(), this.config.methodVisibility(), pw); - if (this.config.propertyAccessType() || this.config.generateGettersAndSetters()) { - this.printEntityPrimaryKeyGettersAndSettersOn(pw); - this.printEntityNonPrimaryKeyBasicGettersAndSettersOn(pw); - this.printEntityManyToOneGettersAndSettersOn(pw); - this.printEntityOneToManyGettersAndSettersOn(pw); - this.printEntityOwnedManyToManyGettersAndSettersOn(pw); - this.printEntityNonOwnedManyToManyGettersAndSettersOn(pw); - } - - this.printPrimaryKeyClassOn(pw); - pw.undent(); - - pw.print('}'); - pw.println(); - } - - private void printClassDeclarationOn(EntitySourceWriter pw) { - this.printEntityAnnotationOn(pw); - this.printTableAnnotationOn(pw); - this.printIdClassAnnotationOn(pw); - - pw.print("public class "); - pw.printTypeDeclaration(this.entityClassName); - if (config.serializable()) { - pw.print(" implements "); - pw.printTypeDeclaration(Serializable.class.getName()); - } - pw.print(" {"); - pw.println(); - } - - private void printEntityAnnotationOn(EntitySourceWriter pw) { - pw.printAnnotation(JPA.ENTITY); - pw.println(); - } - - private void printTableAnnotationOn(EntitySourceWriter pw) { - if ( ! this.table().matchesShortJavaClassName(this.entityName())) { - pw.printAnnotation(JPA.TABLE); - pw.print("(name=\""); - pw.print(this.table().getName()); - pw.print("\")"); - pw.println(); - } - } - - private void printIdClassAnnotationOn(EntitySourceWriter pw) { - if ((this.table().primaryKeyColumnsSize() > 1) && this.config.generateIdClassForCompoundPK()) { - pw.printAnnotation(JPA.ID_CLASS); - pw.print('('); - pw.printTypeDeclaration(this.entityClassName + ".PK"); - pw.print(".class)"); - pw.println(); - } - } - - private void printEntityPrimaryKeyFieldsOn(EntitySourceWriter pw) { - if ((this.table().primaryKeyColumnsSize() > 1) && this.config.generateEmbeddedIdForCompoundPK()) { - this.printEntityEmbeddedIdPrimaryKeyFieldOn(pw); - } else { - this.printEntityReadOnlyPrimaryKeyFieldsOn(pw); - this.printEntityWritablePrimaryKeyFieldsOn(pw); - } - } - - private void printEntityEmbeddedIdPrimaryKeyFieldOn(EntitySourceWriter pw) { - if (this.config.fieldAccessType()) { - pw.printAnnotation(JPA.EMBEDDED_ID); - pw.println(); - } - pw.printVisibility(this.config.fieldVisibility()); - pw.printTypeDeclaration(this.entityClassName + ".PK"); - pw.print(' '); - pw.print(this.genTable.fieldNameForEmbeddedId()); - pw.print(';'); - pw.println(); - pw.println(); - } - - private void printEntityReadOnlyPrimaryKeyFieldsOn(EntitySourceWriter pw) { - for (Iterator<Column> stream = this.genTable.readOnlyPrimaryKeyColumns(); stream.hasNext(); ) { - this.printEntityReadOnlyPrimaryKeyFieldOn(stream.next(), pw); - } - } - - private void printEntityReadOnlyPrimaryKeyFieldOn(Column column, EntitySourceWriter pw) { - String fieldName = this.genTable.fieldNameFor(column); - if (this.config.fieldAccessType()) { - pw.printAnnotation(JPA.ID); - pw.println(); - if (column.matchesJavaFieldName(fieldName)) { - this.printReadOnlyColumnAnnotationOn(pw); // no Column name needed - } else { - this.printReadOnlyColumnAnnotationOn(column.getName(), pw); - } - } - pw.printVisibility(this.config.fieldVisibility()); - pw.printTypeDeclaration(column.javaTypeDeclaration()); - pw.print(' '); - pw.print(fieldName); - pw.print(';'); - pw.println(); - pw.println(); - } - - private void printReadOnlyColumnAnnotationOn(String columnName, EntitySourceWriter pw) { - pw.printAnnotation(JPA.COLUMN); - pw.print("(name=\""); - pw.print(columnName); - pw.print("\", insertable=false, updatable=false)"); - pw.println(); - } - - private void printReadOnlyColumnAnnotationOn(EntitySourceWriter pw) { - pw.printAnnotation(JPA.COLUMN); - pw.print("(insertable=false, updatable=false)"); - pw.println(); - } - - private void printEntityWritablePrimaryKeyFieldsOn(EntitySourceWriter pw) { - for (Iterator<Column> stream = this.genTable.writablePrimaryKeyColumns(); stream.hasNext(); ) { - this.printEntityWritablePrimaryKeyFieldOn(stream.next(), pw); - } - } - - private void printEntityWritablePrimaryKeyFieldOn(Column column, EntitySourceWriter pw) { - String fieldName = this.genTable.fieldNameFor(column); - if (this.config.fieldAccessType()) { - pw.printAnnotation(JPA.ID); - pw.println(); - if ( ! column.matchesJavaFieldName(fieldName)) { - this.printColumnAnnotationOn(column.getName(), pw); - } - } - pw.printVisibility(this.config.fieldVisibility()); - pw.printTypeDeclaration(column.javaTypeDeclaration()); - pw.print(' '); - pw.print(fieldName); - pw.print(';'); - pw.println(); - pw.println(); - } - - private void printEntityNonPrimaryKeyBasicFieldsOn(EntitySourceWriter pw) { - for (Iterator<Column> stream = this.genTable.nonPrimaryKeyBasicColumns(); stream.hasNext(); ) { - this.printEntityNonPrimaryKeyBasicFieldOn(stream.next(), pw); - } - } - - private void printEntityNonPrimaryKeyBasicFieldOn(Column column, EntitySourceWriter pw) { - String fieldName = this.genTable.fieldNameFor(column); - if (this.config.fieldAccessType()) { - if ( ! column.matchesJavaFieldName(fieldName)) { - this.printColumnAnnotationOn(column.getName(), pw); - } - } - pw.printVisibility(this.config.fieldVisibility()); - pw.printTypeDeclaration(column.javaTypeDeclaration()); - pw.print(' '); - pw.print(fieldName); - pw.print(';'); - pw.println(); - pw.println(); - } - - private void printColumnAnnotationOn(String columnName, EntitySourceWriter pw) { - pw.printAnnotation(JPA.COLUMN); - pw.print("(name=\""); - pw.print(columnName); - pw.print("\")"); - pw.println(); - } - - private void printEntityManyToOneFieldsOn(EntitySourceWriter pw) { - for (Iterator<ManyToOneRelation> stream = this.genTable.manyToOneRelations(); stream.hasNext(); ) { - this.printEntityManyToOneFieldOn(stream.next(), pw); - } - } - - private void printEntityManyToOneFieldOn(ManyToOneRelation relation, EntitySourceWriter pw) { - String fieldName = this.genTable.fieldNameFor(relation); - if (this.config.fieldAccessType()) { - this.printManyToOneAnnotationOn(fieldName, relation, pw); - } - pw.printVisibility(this.config.fieldVisibility()); - pw.printTypeDeclaration(this.fullyQualify(relation.referencedEntityName())); - pw.print(' '); - pw.print(fieldName); - pw.print(';'); - pw.println(); - pw.println(); - } - - private void printManyToOneAnnotationOn(String fieldName, ManyToOneRelation relation, EntitySourceWriter pw) { - pw.printAnnotation(JPA.MANY_TO_ONE); - pw.println(); - ForeignKey fk = relation.getForeignKey(); - if (fk.matchesJavaFieldName(fieldName)) { - return; // no JoinColumn annotation needed - } - if (fk.referencesSingleColumnPrimaryKey()) { - pw.printAnnotation(JPA.JOIN_COLUMN); - pw.print("(name=\""); - pw.print(fk.columnPairs().next().getBaseColumn().getName()); - pw.print("\")"); - } else { - if (fk.columnPairsSize() > 1) { - pw.printAnnotation(JPA.JOIN_COLUMNS); - pw.print("({"); - pw.println(); - pw.indent(); - } - this.printJoinColumnAnnotationsOn(fk, pw); - if (fk.columnPairsSize() > 1) { - pw.undent(); - pw.println(); - pw.print("})"); - } - } - pw.println(); - } - - private void printJoinColumnAnnotationsOn(ForeignKey foreignKey, EntitySourceWriter pw) { - for (Iterator<ForeignKey.ColumnPair> stream = foreignKey.columnPairs(); stream.hasNext(); ) { - this.printJoinColumnAnnotationOn(stream.next(), pw); - if (stream.hasNext()) { - pw.println(','); - } - } - } - - private void printJoinColumnAnnotationOn(ForeignKey.ColumnPair columnPair, EntitySourceWriter pw) { - this.printJoinColumnAnnotationOn(columnPair.getBaseColumn().getName(), columnPair.getReferencedColumn().getName(), pw); - } - - /** - * assume that at least one of the two names is not null - */ - private void printJoinColumnAnnotationOn(String baseColumnName, String referencedColumnName, EntitySourceWriter pw) { - pw.printAnnotation(JPA.JOIN_COLUMN); - pw.print('('); - if (baseColumnName != null) { - pw.print("name=\""); - pw.print(baseColumnName); - } - if (referencedColumnName != null) { - if (baseColumnName != null) { - pw.print("\", "); - } - pw.print("referencedColumnName=\""); - pw.print(referencedColumnName); - } - pw.print("\")"); - } - - private void printEntityOneToManyFieldsOn(EntitySourceWriter pw) { - for (Iterator<OneToManyRelation> stream = this.genTable.oneToManyRelations(); stream.hasNext(); ) { - this.printEntityOneToManyFieldOn(stream.next(), pw); - } - } - - private void printEntityOneToManyFieldOn(OneToManyRelation relation, EntitySourceWriter pw) { - String fieldName = this.genTable.fieldNameFor(relation); - if (this.config.fieldAccessType()) { - this.printOneToManyAnnotationOn(fieldName, relation, pw); - } - pw.printVisibility(this.config.fieldVisibility()); - pw.printTypeDeclaration(this.config.getCollectionTypeName()); - pw.print('<'); - pw.printTypeDeclaration(this.fullyQualify(relation.referencedEntityName())); - pw.print('>'); - pw.print(' '); - pw.print(fieldName); - pw.print(';'); - pw.println(); - pw.println(); - } - - private void printOneToManyAnnotationOn(String fieldName, OneToManyRelation relation, EntitySourceWriter pw) { - pw.printAnnotation(JPA.ONE_TO_MANY); - pw.print("(mappedBy=\""); - pw.print(relation.mappedBy()); - pw.print("\")"); - pw.println(); - } - - private void printEntityOwnedManyToManyFieldsOn(EntitySourceWriter pw) { - for (Iterator<ManyToManyRelation> stream = this.genTable.ownedManyToManyRelations(); stream.hasNext(); ) { - this.printEntityOwnedManyToManyFieldOn(stream.next(), pw); - } - } - - private void printEntityOwnedManyToManyFieldOn(ManyToManyRelation relation, EntitySourceWriter pw) { - String fieldName = this.genTable.fieldNameFor(relation); - if (this.config.fieldAccessType()) { - this.printOwnedManyToManyAnnotationOn(fieldName, relation, pw); - } - pw.printVisibility(this.config.fieldVisibility()); - pw.printTypeDeclaration(this.config.getCollectionTypeName()); - pw.print('<'); - pw.printTypeDeclaration(this.fullyQualify(relation.nonOwningEntityName())); - pw.print('>'); - pw.print(' '); - pw.print(fieldName); - pw.print(';'); - pw.println(); - pw.println(); - } - - /** - * I guess you could build a state machine for all this crap, - * but that seems like overkill... - */ - private void printOwnedManyToManyAnnotationOn(String fieldName, ManyToManyRelation relation, EntitySourceWriter pw) { - pw.printAnnotation(JPA.MANY_TO_MANY); - pw.println(); - boolean first = true; - boolean comma = false; - if ( ! relation.joinTableNameIsDefault()) { - if (first) { - first = false; - pw.printAnnotation(JPA.JOIN_TABLE); - pw.print('('); - } - pw.print("name=\""); - pw.print(relation.getJoinTable().name()); - pw.print('\"'); - comma = true; - } - if ( ! relation.joinColumnsIsDefaultFor(fieldName)) { - if (first) { - first = false; - pw.printAnnotation(JPA.JOIN_TABLE); - pw.print('('); - } else if (comma) { - pw.print(','); - } - pw.println(); - pw.indent(); - this.printJoinTableJoinColumnsOn("joinColumns", fieldName, relation.getOwningForeignKey(), pw); - pw.undent(); - comma = true; - } - String inverseFieldName = relation.getNonOwningTable().fieldNameFor(relation); - if ( ! relation.inverseJoinColumnsIsDefaultFor(inverseFieldName)) { - if (first) { - first = false; - pw.printAnnotation(JPA.JOIN_TABLE); - pw.print('('); - } else if (comma) { - pw.print(','); - } - pw.println(); - pw.indent(); - this.printJoinTableJoinColumnsOn("inverseJoinColumns", inverseFieldName, relation.getNonOwningForeignKey(), pw); - pw.undent(); - comma = true; - } - if ( ! first) { - pw.print(')'); - } - pw.println(); - } - - private void printJoinTableJoinColumnsOn(String elementName, String fieldName, ForeignKey foreignKey, EntitySourceWriter pw) { - if (foreignKey.columnPairsSize() != 1) { - this.printJoinTableJoinColumnsOn(elementName, foreignKey, pw); - } else if (foreignKey.getReferencedTable().primaryKeyColumnsSize() != 1) { - // if the referenced table has a composite primary key, neither of the columns can be a default - // since both of the defaults require a single-column primary key - this.printJoinTableJoinColumnsOn(elementName, foreignKey, pw); - } else { - ForeignKey.ColumnPair columnPair = foreignKey.columnPairs().next(); - Column pkColumn = foreignKey.getReferencedTable().primaryKeyColumns().next(); - if (columnPair.getBaseColumn().matchesJavaFieldName(fieldName + "_" + pkColumn.getName())) { - if (columnPair.getReferencedColumn() == pkColumn) { - // we shouldn't get here... - } else { - pw.print(elementName); - pw.print('='); - this.printJoinColumnAnnotationOn(null, columnPair.getReferencedColumn().getName(), pw); - } - } else { - if (columnPair.getReferencedColumn() == pkColumn) { - pw.print(elementName); - pw.print('='); - this.printJoinColumnAnnotationOn(columnPair.getBaseColumn().getName(), null, pw); - } else { - this.printJoinTableJoinColumnsOn(elementName, foreignKey, pw); - } - } - } - } - - private void printJoinTableJoinColumnsOn(String elementName, ForeignKey foreignKey, EntitySourceWriter pw) { - pw.print(elementName); - pw.print('='); - if (foreignKey.columnPairsSize() > 1) { - pw.print('{'); - pw.println(); - pw.indent(); - } - this.printJoinColumnAnnotationsOn(foreignKey, pw); - if (foreignKey.columnPairsSize() > 1) { - pw.undent(); - pw.println(); - pw.print('}'); - pw.println(); - } - } - - private void printEntityNonOwnedManyToManyFieldsOn(EntitySourceWriter pw) { - for (Iterator<ManyToManyRelation> stream = this.genTable.nonOwnedManyToManyRelations(); stream.hasNext(); ) { - this.printEntityNonOwnedManyToManyFieldOn(stream.next(), pw); - } - } - - private void printEntityNonOwnedManyToManyFieldOn(ManyToManyRelation relation, EntitySourceWriter pw) { - String fieldName = this.genTable.fieldNameFor(relation); - if (this.config.fieldAccessType()) { - this.printNonOwnedManyToManyAnnotationOn(fieldName, relation, pw); - } - pw.printVisibility(this.config.fieldVisibility()); - pw.printTypeDeclaration(this.config.getCollectionTypeName()); - pw.print('<'); - pw.printTypeDeclaration(this.fullyQualify(relation.owningEntityName())); - pw.print('>'); - pw.print(' '); - pw.print(fieldName); - pw.print(';'); - pw.println(); - pw.println(); - } - - private void printNonOwnedManyToManyAnnotationOn(String fieldName, ManyToManyRelation relation, EntitySourceWriter pw) { - pw.printAnnotation(JPA.MANY_TO_MANY); - pw.print("(mappedBy=\""); - pw.print(relation.getMappedBy()); - pw.print("\")"); - pw.println(); - } - - private String fullyQualify(String shortClassName) { - String pkg = this.packageName(); - return (pkg.length() == 0) ? shortClassName : pkg + '.' + shortClassName; - } - - private void printSerialVersionUID(EntitySourceWriter pw) { - if (this.config.generateSerialVersionUID()) { - pw.print("private static final long serialVersionUID = 1L;"); - pw.println(); - } - } - - private void printZeroArgumentConstructorOn(String ctorName, String visibility, EntitySourceWriter pw) { - if (this.config.generateDefaultConstructor()) { - pw.printVisibility(visibility); - pw.print(ctorName); - pw.print("() {"); - pw.println(); - pw.indent(); - pw.println("super();"); - pw.undent(); - pw.print('}'); - pw.println(); - pw.println(); - } - } - - private void printEntityPrimaryKeyGettersAndSettersOn(EntitySourceWriter pw) { - if ((this.table().primaryKeyColumnsSize() > 1) && this.config.generateEmbeddedIdForCompoundPK()) { - this.printEntityEmbeddedIdPrimaryKeyGetterAndSetterOn(pw); - } else { - this.printEntityReadOnlyPrimaryKeyGettersAndSettersOn(pw); - this.printEntityWritablePrimaryKeyGettersAndSettersOn(pw); - } - } - - private void printEntityEmbeddedIdPrimaryKeyGetterAndSetterOn(EntitySourceWriter pw) { - if (this.config.propertyAccessType()) { - pw.printAnnotation(JPA.EMBEDDED_ID); - pw.println(); - } - pw.printGetterAndSetter(this.genTable.fieldNameForEmbeddedId(), this.entityClassName + ".PK", this.config.methodVisibility()); - } - - private void printEntityReadOnlyPrimaryKeyGettersAndSettersOn(EntitySourceWriter pw) { - for (Iterator<Column> stream = this.genTable.readOnlyPrimaryKeyColumns(); stream.hasNext(); ) { - this.printEntityReadOnlyPrimaryKeyGetterAndSetterOn(stream.next(), pw); - } - } - - private void printEntityReadOnlyPrimaryKeyGetterAndSetterOn(Column column, EntitySourceWriter pw) { - String propertyName = this.genTable.fieldNameFor(column); - if (this.config.propertyAccessType()) { - pw.printAnnotation(JPA.ID); - pw.println(); - if (column.matchesJavaFieldName(propertyName)) { - this.printReadOnlyColumnAnnotationOn(pw); // no Column name needed - } else { - this.printReadOnlyColumnAnnotationOn(column.getName(), pw); - } - } - - pw.printGetterAndSetter(propertyName, column.javaTypeDeclaration(), this.config.methodVisibility()); - } - - private void printEntityWritablePrimaryKeyGettersAndSettersOn(EntitySourceWriter pw) { - for (Iterator<Column> stream = this.genTable.writablePrimaryKeyColumns(); stream.hasNext(); ) { - this.printEntityWritablePrimaryKeyGetterAndSetterOn(stream.next(), pw); - } - } - - private void printEntityWritablePrimaryKeyGetterAndSetterOn(Column column, EntitySourceWriter pw) { - String propertyName = this.genTable.fieldNameFor(column); - if (this.config.propertyAccessType()) { - pw.printAnnotation(JPA.ID); - pw.println(); - if ( ! column.matchesJavaFieldName(propertyName)) { - this.printColumnAnnotationOn(column.getName(), pw); - } - } - - pw.printGetterAndSetter(propertyName, column.javaTypeDeclaration(), this.config.methodVisibility()); - } - - private void printEntityNonPrimaryKeyBasicGettersAndSettersOn(EntitySourceWriter pw) { - for (Iterator<Column> stream = this.genTable.nonPrimaryKeyBasicColumns(); stream.hasNext(); ) { - this.printEntityNonPrimaryKeyBasicGetterAndSetterOn(stream.next(), pw); - } - } - - private void printEntityNonPrimaryKeyBasicGetterAndSetterOn(Column column, EntitySourceWriter pw) { - String propertyName = this.genTable.fieldNameFor(column); - if (this.config.propertyAccessType()) { - if ( ! column.matchesJavaFieldName(propertyName)) { - this.printColumnAnnotationOn(column.getName(), pw); - } - } - - pw.printGetterAndSetter(propertyName, column.javaTypeDeclaration(), this.config.methodVisibility()); - } - - private void printEntityManyToOneGettersAndSettersOn(EntitySourceWriter pw) { - for (Iterator<ManyToOneRelation> stream = this.genTable.manyToOneRelations(); stream.hasNext(); ) { - this.printEntityManyToOneGetterAndSetterOn(stream.next(), pw); - } - } - - private void printEntityManyToOneGetterAndSetterOn(ManyToOneRelation relation, EntitySourceWriter pw) { - String propertyName = this.genTable.fieldNameFor(relation); - if (this.config.propertyAccessType()) { - this.printManyToOneAnnotationOn(propertyName, relation, pw); - } - - String typeDeclaration = this.fullyQualify(relation.referencedEntityName()); - pw.printGetterAndSetter(propertyName, typeDeclaration, this.config.methodVisibility()); - } - - private void printEntityOneToManyGettersAndSettersOn(EntitySourceWriter pw) { - for (Iterator<OneToManyRelation> stream = this.genTable.oneToManyRelations(); stream.hasNext(); ) { - this.printEntityOneToManyGetterAndSetterOn(stream.next(), pw); - } - } - - private void printEntityOneToManyGetterAndSetterOn(OneToManyRelation relation, EntitySourceWriter pw) { - String propertyName = this.genTable.fieldNameFor(relation); - if (this.config.propertyAccessType()) { - this.printOneToManyAnnotationOn(propertyName, relation, pw); - } - - String elementTypeDeclaration = this.fullyQualify(relation.referencedEntityName()); - pw.printCollectionGetterAndSetter(propertyName, this.config.getCollectionTypeName(), elementTypeDeclaration, this.config.methodVisibility()); - } - - private void printEntityOwnedManyToManyGettersAndSettersOn(EntitySourceWriter pw) { - for (Iterator<ManyToManyRelation> stream = this.genTable.ownedManyToManyRelations(); stream.hasNext(); ) { - this.printEntityOwnedManyToManyGetterAndSetterOn(stream.next(), pw); - } - } - - private void printEntityOwnedManyToManyGetterAndSetterOn(ManyToManyRelation relation, EntitySourceWriter pw) { - String propertyName = this.genTable.fieldNameFor(relation); - if (this.config.propertyAccessType()) { - this.printOwnedManyToManyAnnotationOn(propertyName, relation, pw); - } - - String elementTypeDeclaration = this.fullyQualify(relation.nonOwningEntityName()); - pw.printCollectionGetterAndSetter(propertyName, this.config.getCollectionTypeName(), elementTypeDeclaration, this.config.methodVisibility()); - } - - private void printEntityNonOwnedManyToManyGettersAndSettersOn(EntitySourceWriter pw) { - for (Iterator<ManyToManyRelation> stream = this.genTable.nonOwnedManyToManyRelations(); stream.hasNext(); ) { - this.printEntityNonOwnedManyToManyGetterAndSetterOn(stream.next(), pw); - } - } - - private void printEntityNonOwnedManyToManyGetterAndSetterOn(ManyToManyRelation relation, EntitySourceWriter pw) { - String propertyName = this.genTable.fieldNameFor(relation); - if (this.config.propertyAccessType()) { - this.printNonOwnedManyToManyAnnotationOn(propertyName, relation, pw); - } - - String elementTypeDeclaration = this.fullyQualify(relation.owningEntityName()); - pw.printCollectionGetterAndSetter(propertyName, this.config.getCollectionTypeName(), elementTypeDeclaration, this.config.methodVisibility()); - } - - private void printPrimaryKeyClassOn(EntitySourceWriter pw) { - if (this.table().primaryKeyColumnsSize() <= 1) { - return; - } - pw.println(); - if (this.config.generateEmbeddedIdForCompoundPK()) { - pw.printAnnotation(JPA.EMBEDDABLE); - pw.println(); - } - pw.print("public static class PK implements "); - pw.printTypeDeclaration(Serializable.class.getName()); - pw.print(" {"); - pw.println(); - - pw.indent(); - this.printIdFieldsOn(pw); - this.printSerialVersionUID(pw); - pw.println(); - this.printZeroArgumentConstructorOn("PK", "public", pw); - - if (this.config.propertyAccessType() || this.config.generateGettersAndSetters()) { - this.printIdGettersAndSettersOn(pw); - } - - this.printEqualsMethodOn("PK", this.table().primaryKeyColumns(), pw); - this.printHashCodeMethodOn(this.table().primaryKeyColumns(), pw); - pw.undent(); - - pw.print('}'); - pw.println(); - pw.println(); - } - - private void printIdFieldsOn(EntitySourceWriter pw) { - for (Iterator<Column> stream = this.table().primaryKeyColumns(); stream.hasNext(); ) { - this.printIdFieldOn(stream.next(), pw); - } - } - - private void printIdFieldOn(Column column, EntitySourceWriter pw) { - String fieldName = this.genTable.fieldNameFor(column); - pw.printVisibility(this.config.fieldVisibility()); - pw.printTypeDeclaration(column.javaTypeDeclaration()); - pw.print(' '); - pw.print(fieldName); - pw.print(';'); - pw.println(); - } - - private void printIdGettersAndSettersOn(EntitySourceWriter pw) { - for (Iterator<Column> stream = this.table().primaryKeyColumns(); stream.hasNext(); ) { - this.printIdGetterAndSetterOn(stream.next(), pw); - } - } - - private void printIdGetterAndSetterOn(Column column, EntitySourceWriter pw) { - String propertyName = this.genTable.fieldNameFor(column); - pw.printGetterAndSetter(propertyName, column.javaTypeDeclaration(), this.config.methodVisibility()); - } - - private void printEqualsMethodOn(String className, Iterator<Column> columns, EntitySourceWriter pw) { - pw.printAnnotation("java.lang.Override"); - pw.println(); - - pw.println("public boolean equals(Object o) {"); - pw.indent(); - pw.println("if (o == this) {"); - pw.indent(); - pw.println("return true;"); - pw.undent(); - pw.print('}'); - pw.println(); - - pw.print("if ( ! (o instanceof "); - pw.print(className); - pw.print(")) {"); - pw.println(); - pw.indent(); - pw.println("return false;"); - pw.undent(); - pw.print('}'); - pw.println(); - - pw.print(className); - pw.print(" other = ("); - pw.print(className); - pw.print(") o;"); - pw.println(); - - pw.print("return "); - pw.indent(); - while (columns.hasNext()) { - this.printEqualsClauseOn(columns.next(), pw); - if (columns.hasNext()) { - pw.println(); - pw.print("&& "); - } - } - pw.print(';'); - pw.println(); - pw.undent(); - pw.undent(); - pw.print('}'); - pw.println(); - pw.println(); - } - - private void printEqualsClauseOn(Column column, EntitySourceWriter pw) { - String fieldName = this.genTable.fieldNameFor(column); - JavaType javaType = column.javaType(); - if (javaType.isPrimitive()) { - this.printPrimitiveEqualsClauseOn(fieldName, pw); - } else { - this.printReferenceEqualsClauseOn(fieldName, pw); - } - } - - private void printPrimitiveEqualsClauseOn(String fieldName, EntitySourceWriter pw) { - pw.print("(this."); - pw.print(fieldName); - pw.print(" == other."); - pw.print(fieldName); - pw.print(')'); - } - - private void printReferenceEqualsClauseOn(String fieldName, EntitySourceWriter pw) { - pw.print("this."); - pw.print(fieldName); - pw.print(".equals(other."); - pw.print(fieldName); - pw.print(')'); - } - - private void printHashCodeMethodOn(Iterator<Column> columns, EntitySourceWriter pw) { - pw.printAnnotation("java.lang.Override"); - pw.println(); - - pw.println("public int hashCode() {"); - pw.indent(); - pw.print("return "); - pw.indent(); - while (columns.hasNext()) { - this.printHashCodeClauseOn(columns.next(), pw); - if (columns.hasNext()) { - pw.println(); - pw.print("^ "); - } - } - pw.print(';'); - pw.println(); - pw.undent(); - pw.undent(); - pw.print('}'); - pw.println(); - pw.println(); - } - - private void printHashCodeClauseOn(Column column, EntitySourceWriter pw) { - String fieldName = this.genTable.fieldNameFor(column); - JavaType javaType = column.javaType(); - if (javaType.isPrimitive()) { - this.printPrimitiveHashCodeClauseOn(javaType.getElementTypeName(), fieldName, pw); - } else { - this.printReferenceHashCodeClauseOn(fieldName, pw); - } - } - - private void printPrimitiveHashCodeClauseOn(String primitiveName, String fieldName, EntitySourceWriter pw) { - if (primitiveName.equals("int") || primitiveName.equals("short") || primitiveName.equals("byte") || primitiveName.equals("char")) { - pw.print("this."); - pw.print(fieldName); - } else if (primitiveName.equals("long")) { // cribbed from Long#hashCode() - // ((int) (this.value ^ (this.value >>> 32))) - pw.print("((int) (this."); - pw.print(fieldName); - pw.print(" ^ (this."); - pw.print(fieldName); - pw.print(" >>> 32)))"); - } else if (primitiveName.equals("double")) { // cribbed from Double#hashCode() - // ((int) (java.lang.Double.doubleToLongBits(this.value) ^ (java.lang.Double.doubleToLongBits(this.value) >>> 32))) - pw.print("((int) ("); - pw.printTypeDeclaration("java.lang.Double"); - pw.print(".doubleToLongBits(this."); - pw.print(fieldName); - pw.print(") ^ ("); - pw.printTypeDeclaration("java.lang.Double"); - pw.print(".doubleToLongBits(this."); - pw.print(fieldName); - pw.print(") >>> 32)))"); - } else if (primitiveName.equals("float")) { // cribbed from Float#hashCode() - // java.lang.Float.floatToIntBits(this.value) - pw.printTypeDeclaration("java.lang.Float"); - pw.print(".floatToIntBits(this."); - pw.print(fieldName); - pw.print(')'); - } else if (primitiveName.equals("boolean")) { // cribbed from Boolean#hashCode() - // (this.value ? 1231 : 1237) - pw.print("(this."); - pw.print(fieldName); - pw.print(" ? 1231 : 1237)"); - } else { - throw new IllegalArgumentException(primitiveName); - } - } - - private void printReferenceHashCodeClauseOn(String fieldName, EntitySourceWriter pw) { - pw.print("this."); - pw.print(fieldName); - pw.print(".hashCode()"); - } - - private void printPackageAndImportsOn(PrintWriter pw, BodySource bodySource) { - if (this.packageName().length() != 0) { - pw.print("package "); - pw.print(this.packageName()); - pw.print(';'); - pw.println(); - pw.println(); - } - - for (Iterator<Map.Entry<String, String>> stream = bodySource.importEntries(); stream.hasNext(); ) { - Map.Entry<String, String> entry = stream.next(); - pw.print("import "); - pw.print(entry.getValue()); // package - pw.print('.'); - pw.print(entry.getKey()); // short class name - pw.print(';'); - pw.println(); - } - pw.println(); - } - - - // ********** convenience methods ********** - - private String packageName() { - return this.packageFragment.getElementName(); - } - - private Table table() { - return this.genTable.getTable(); - } - - private String entityName() { - return this.genTable.getEntityName(); - } - - - // ********** writer ********** - - private interface BodySource { - - /** - * return a sorted set of map entries; the key is the short class name, - * the value is the package name - */ - Iterator<Map.Entry<String, String>> importEntries(); - - /** - * return the body source code - */ - String source(); - - /** - * return the length of the body source code - */ - int length(); - - } - - /** - * Extend IndentingPrintWriter with some methods that facilitate building - * entity source code. - */ - private static class EntitySourceWriter extends IndentingPrintWriter implements BodySource { - final String packageName; - final String entityClassName; - // key = short class name; value = package name - private final Map<String, String> imports = new HashMap<String, String>(); - - EntitySourceWriter(String packageName, String entityClassName) { - super(new StringWriter(20000)); - this.packageName = packageName; - this.entityClassName = entityClassName; - } - - void printVisibility(String visibilityModifier) { - if (visibilityModifier.length() != 0) { - this.print(visibilityModifier); - this.print(' '); - } - } - - void printAnnotation(String annotationName) { - this.print('@'); - this.printTypeDeclaration(annotationName); - } - - void printTypeDeclaration(String typeDeclaration) { - this.print(this.importedTypeDeclaration(typeDeclaration)); - } - - /** - * Return the specified class's "imported" name. - * The class declaration must be of the form: - * "int" - * "int[]" (not "[I") - * "java.lang.Object" - * "java.lang.Object[]" (not "[Ljava.lang.Object;") - * "java.util.Map.Entry" (not "java.util.Map$Entry") - * "java.util.Map.Entry[][]" (not "[[Ljava.util.Map$Entry;") - */ - private String importedTypeDeclaration(String typeDeclaration) { - if (this.typeDeclarationIsMemberClass(typeDeclaration)) { - // no need for an import, just return the partially-qualified name - return this.memberClassTypeDeclaration(typeDeclaration); - } - int last = typeDeclaration.lastIndexOf('.'); - String pkg = (last == -1) ? "" : typeDeclaration.substring(0, last); - String shortTypeDeclaration = typeDeclaration.substring(last + 1); - String shortElementTypeName = shortTypeDeclaration; - while (shortElementTypeName.endsWith("[]")) { - shortElementTypeName = shortElementTypeName.substring(0, shortElementTypeName.length() - 2); - } - String prev = this.imports.get(shortElementTypeName); - if (prev == null) { - // this is the first class with this short element type name - this.imports.put(shortElementTypeName, pkg); - return shortTypeDeclaration; - } - if (prev.equals(pkg)) { - // this element type has already been imported - return shortTypeDeclaration; - } - // another class with the same short element type name has been - // previously imported, so this one must be used fully-qualified - return typeDeclaration; - } - - /** - * e.g. "foo.bar.Employee.PK" will return true - */ - private boolean typeDeclarationIsMemberClass(String typeDeclaration) { - return (typeDeclaration.length() > this.entityClassName.length()) - && typeDeclaration.startsWith(this.entityClassName) - && (typeDeclaration.charAt(this.entityClassName.length()) == '.'); - } - - /** - * e.g. "foo.bar.Employee.PK" will return "Employee.PK" - * this prevents collisions with other imported classes (e.g. "joo.jar.PK") - */ - private String memberClassTypeDeclaration(String typeDeclaration) { - int index = this.packageName.length(); - if (index != 0) { - index++; // bump past the '.' - } - return typeDeclaration.substring(index); - } - - public Iterator<Map.Entry<String, String>> importEntries() { - return new FilteringIterator<Map.Entry<String, String>>(this.sortedImportEntries()) { - @Override - @SuppressWarnings("unchecked") - protected boolean accept(Object next) { - String pkg = ((Map.Entry<String, String>) next).getValue(); - if (pkg.equals("") - || pkg.equals("java.lang") - || pkg.equals(EntitySourceWriter.this.packageName)) { - return false; - } - return true; - } - }; - } - - private Iterator<Map.Entry<String, String>> sortedImportEntries() { - TreeSet<Map.Entry<String, String>> sortedImports = new TreeSet<Map.Entry<String, String>>(this.buildImportEntriesComparator()); - sortedImports.addAll(this.imports.entrySet()); - return sortedImports.iterator(); - } - - private Comparator<Map.Entry<String, String>> buildImportEntriesComparator() { - return new Comparator<Map.Entry<String, String>>() { - public int compare(Map.Entry<String, String> e1, Map.Entry<String, String> e2) { - Collator collator = Collator.getInstance(); - int pkg = collator.compare(e1.getValue(), e2.getValue()); - return (pkg == 0) ? collator.compare(e1.getKey(), e2.getKey()) : pkg; - } - }; - } - - void printGetterAndSetter(String propertyName, String typeDeclaration, String visibility) { - this.printGetter(propertyName, typeDeclaration, visibility); - this.println(); - this.println(); - - this.printSetter(propertyName, typeDeclaration, visibility); - this.println(); - this.println(); - } - - private void printGetter(String propertyName, String typeDeclaration, String visibility) { - this.printVisibility(visibility); - this.printTypeDeclaration(typeDeclaration); - this.print(' '); - this.print(typeDeclaration.equals("boolean") ? "is" : "get"); - this.print(StringTools.capitalize(propertyName)); - this.print("() {"); - this.println(); - - this.indent(); - this.print("return this."); - this.print(propertyName); - this.print(';'); - this.println(); - this.undent(); - - this.print('}'); - } - - private void printSetter(String propertyName, String typeDeclaration, String visibility) { - this.printVisibility(visibility); - this.print("void set"); - this.print(StringTools.capitalize(propertyName)); - this.print('('); - this.printTypeDeclaration(typeDeclaration); - this.print(' '); - this.print(propertyName); - this.print(") {"); - this.println(); - - this.indent(); - this.print("this."); - this.print(propertyName); - this.print(" = "); - this.print(propertyName); - this.print(';'); - this.println(); - this.undent(); - - this.print('}'); - } - - void printCollectionGetterAndSetter(String propertyName, String collectionTypeDeclaration, String elementTypeDeclaration, String visibility) { - this.printCollectionGetter(propertyName, collectionTypeDeclaration, elementTypeDeclaration, visibility); - this.println(); - this.println(); - - this.printCollectionSetter(propertyName, collectionTypeDeclaration, elementTypeDeclaration, visibility); - this.println(); - this.println(); - } - - private void printCollectionGetter(String propertyName, String collectionTypeDeclaration, String elementTypeDeclaration, String visibility) { - this.printVisibility(visibility); - this.printTypeDeclaration(collectionTypeDeclaration); - this.print('<'); - this.printTypeDeclaration(elementTypeDeclaration); - this.print("> get"); - this.print(StringTools.capitalize(propertyName)); - this.print("() {"); - this.println(); - - this.indent(); - this.print("return this."); - this.print(propertyName); - this.print(';'); - this.println(); - this.undent(); - - this.print('}'); - } - - private void printCollectionSetter(String propertyName, String collectionTypeDeclaration, String elementTypeDeclaration, String visibility) { - this.printVisibility(visibility); - this.print("void set"); - this.print(StringTools.capitalize(propertyName)); - this.print('('); - this.printTypeDeclaration(collectionTypeDeclaration); - this.print('<'); - this.printTypeDeclaration(elementTypeDeclaration); - this.print('>'); - this.print(' '); - this.print(propertyName); - this.print(") {"); - this.println(); - - this.indent(); - this.print("this."); - this.print(propertyName); - this.print(" = "); - this.print(propertyName); - this.print(';'); - this.println(); - this.undent(); - - this.print('}'); - } - - public String source() { - return this.out.toString(); - } - - public int length() { - return ((StringWriter) this.out).getBuffer().length(); - } - - } - - - // ********** config ********** - - public static class Config { - private boolean convertToCamelCase = true; - private boolean propertyAccessType = false; // as opposed to "field" - private String collectionTypeName = Set.class.getName(); - private int fieldVisibility = Modifier.PRIVATE; - private int methodVisibility = Modifier.PUBLIC; - private boolean generateGettersAndSetters = true; - private boolean generateDefaultConstructor = true; - private boolean serializable = true; - private boolean generateSerialVersionUID = true; - private boolean generateEmbeddedIdForCompoundPK = true; // as opposed to IdClass - private Map<Table, String> overrideEntityNames = new HashMap<Table, String>(); - - public static final int PRIVATE = 0; - public static final int PACKAGE = 1; - public static final int PROTECTED = 2; - public static final int PUBLIC = 3; - - - public boolean convertToCamelCase() { - return this.convertToCamelCase; - } - public void setConvertToCamelCase(boolean convertToCamelCase) { - this.convertToCamelCase = convertToCamelCase; - } - - public boolean propertyAccessType() { - return this.propertyAccessType; - } - public void setPropertyAccessType(boolean propertyAccessType) { - this.propertyAccessType = propertyAccessType; - } - - public boolean fieldAccessType() { - return ! this.propertyAccessType; - } - public void setFieldAccessType(boolean fieldAccessType) { - this.propertyAccessType = ! fieldAccessType; - } - - public String getCollectionTypeName() { - return this.collectionTypeName; - } - public void setCollectionTypeName(String collectionTypeName) { - this.collectionTypeName = collectionTypeName; - } - - public int getFieldVisibility() { - return this.fieldVisibility; - } - /** entity fields cannot be 'public' */ - public void setFieldVisibility(int fieldVisibility) { - switch (fieldVisibility) { - case PRIVATE: - case PACKAGE: - case PROTECTED: - this.fieldVisibility = fieldVisibility; - break; - default: - throw new IllegalArgumentException("invalid field visibility: " + fieldVisibility); - } - } - String fieldVisibility() { - switch (this.fieldVisibility) { - case PRIVATE: - return "private"; - case PACKAGE: - return ""; - case PROTECTED: - return "protected"; - default: - throw new IllegalStateException("invalid field visibility: " + this.fieldVisibility); - } - } - - public int getMethodVisibility() { - return this.methodVisibility; - } - /** entity properties must be 'public' or 'protected' */ - public void setMethodVisibility(int methodVisibility) { - switch (methodVisibility) { - case PROTECTED: - case PUBLIC: - this.methodVisibility = methodVisibility; - break; - default: - throw new IllegalArgumentException("invalid method visibility: " + methodVisibility); - } - } - String methodVisibility() { - switch (this.methodVisibility) { - case PROTECTED: - return "protected"; - case PUBLIC: - return "public"; - default: - throw new IllegalStateException("invalid method visibility: " + this.methodVisibility); - } - } - - public boolean generateGettersAndSetters() { - return this.generateGettersAndSetters; - } - public void setGenerateGettersAndSetters(boolean generateGettersAndSetters) { - this.generateGettersAndSetters = generateGettersAndSetters; - } - - public boolean generateDefaultConstructor() { - return this.generateDefaultConstructor; - } - public void setGenerateDefaultConstructor(boolean generateDefaultConstructor) { - this.generateDefaultConstructor = generateDefaultConstructor; - } - - public boolean serializable() { - return this.serializable; - } - public void setSerializable(boolean serializable) { - this.serializable = serializable; - } - - public boolean generateSerialVersionUID() { - return this.generateSerialVersionUID; - } - public void setGenerateSerialVersionUID(boolean generateSerialVersionUID) { - this.generateSerialVersionUID = generateSerialVersionUID; - } - - public boolean generateEmbeddedIdForCompoundPK() { - return this.generateEmbeddedIdForCompoundPK; - } - public void setGenerateEmbeddedIdForCompoundPK(boolean generateEmbeddedIdForCompoundPK) { - this.generateEmbeddedIdForCompoundPK = generateEmbeddedIdForCompoundPK; - } - - public boolean generateIdClassForCompoundPK() { - return ! this.generateEmbeddedIdForCompoundPK; - } - public void setGenerateIdClassForCompoundPK(boolean generateIdClassForCompoundPK) { - this.generateEmbeddedIdForCompoundPK = ! generateIdClassForCompoundPK; - } - - /** - * key = table - * value = user-supplied override entity name - */ - public String getOverrideEntityName(Table table) { - return this.overrideEntityNames.get(table); - } - public void setOverrideEntityName(Table table, String overrideEntityName) { - this.overrideEntityNames.put(table, overrideEntityName); - } - public void clearOverrideEntityNames() { - this.overrideEntityNames.clear(); - } - public void setOverrideEntityNames(Map<Table, String> overrideEntityNames) { - this.clearOverrideEntityNames(); - for (Map.Entry<Table, String> entry : overrideEntityNames.entrySet()) { - this.setOverrideEntityName(entry.getKey(), entry.getValue()); - } - } - - } - - - // ********** config ********** - - public static interface OverwriteConfirmer { - /** - * Return whether the entity generator should overwrite the specified - * file. - */ - boolean overwrite(String className); - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.gen/src/org/eclipse/jpt/gen/internal/GenScope.java b/jpa/plugins/org.eclipse.jpt.gen/src/org/eclipse/jpt/gen/internal/GenScope.java deleted file mode 100644 index ee9db7fa8d..0000000000 --- a/jpa/plugins/org.eclipse.jpt.gen/src/org/eclipse/jpt/gen/internal/GenScope.java +++ /dev/null @@ -1,175 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2007 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.gen.internal; - -import java.util.Collection; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Iterator; -import java.util.Map; -import java.util.Set; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.OperationCanceledException; -import org.eclipse.jpt.db.internal.Table; -import org.eclipse.jpt.utility.internal.CollectionTools; -import org.eclipse.jpt.utility.internal.iterators.FilteringIterator; - -class GenScope { - private final Map<Table, GenTable> genTables = new HashMap<Table, GenTable>(); - - private IProgressMonitor progressMonitor; - - // ********** construction/initialization ********** - - GenScope(Collection<Table> tables, EntityGenerator.Config entityConfig, IProgressMonitor progressMonitor) { - super(); - this.initialize(tables, entityConfig, progressMonitor); - } - - private void checkCanceled() { - if (this.progressMonitor.isCanceled()) { - throw new OperationCanceledException(); - } - } - - private void initialize(Collection<Table> tables, EntityGenerator.Config entityConfig, IProgressMonitor monitor) { - this.progressMonitor = monitor; - this.buildGenTables(tables, entityConfig); - checkCanceled(); - this.configureManyToManyRelations(); - checkCanceled(); - this.configureManyToOneRelations(); - checkCanceled(); - this.configureFieldNames(); - checkCanceled(); - } - - private void buildGenTables(Collection<Table> tables, EntityGenerator.Config entityConfig) { - int size = tables.size(); - // pass around a growing list of the entity names so we can avoid duplicates - Set<String> entityNames = new HashSet<String>(size); - for (Table table : tables) { - this.buildGenTable(table, entityConfig, entityNames); - this.progressMonitor.worked(40/size); - } - } - - private void buildGenTable(Table table, EntityGenerator.Config entityConfig, Collection<String> entityNames) { - this.genTables.put(table, new GenTable(this, table, entityConfig, entityNames)); - } - - /** - * find all the "join" tables - */ - private void configureManyToManyRelations() { - int tablesSize = CollectionTools.size(this.tables()); - - //first time takes the longest, should we take that into account? - for (Iterator<GenTable> stream = this.tables(); stream.hasNext(); ) { - checkCanceled(); - stream.next().configureManyToManyRelations(); - this.progressMonitor.worked(730/tablesSize); - } - // revert any "join" table that is referenced by another table back to an "entity" table - Set<GenTable> referencedTables = this.buildReferencedTables(); - tablesSize = CollectionTools.size(this.joinTables()); - for (Iterator<GenTable> stream = this.joinTables(); stream.hasNext(); ) { - GenTable joinGenTable = stream.next(); - if (referencedTables.contains(joinGenTable)) { - joinGenTable.clearJoinTableRelation(); - } - this.progressMonitor.worked(40/tablesSize); - } - } - - /** - * find all the many-to-one and one-to-many relations - */ - private void configureManyToOneRelations() { - int tablesSize = CollectionTools.size(this.entityTables()); - for (Iterator<GenTable> stream = this.entityTables(); stream.hasNext(); ) { - stream.next().configureManyToOneRelations(); - this.progressMonitor.worked(50/tablesSize); - } - } - - /** - * determine all the Java field names up-front because we will - * need them for things like 'mappedBy' annotation elements - */ - private void configureFieldNames() { - int tablesSize = CollectionTools.size(this.entityTables()); - for (Iterator<GenTable> stream = this.entityTables(); stream.hasNext(); ) { - stream.next().configureFieldNames(); - this.progressMonitor.worked(50/tablesSize); - } - } - - - // ********** package API ********** - - /** - * return only the gen tables that are suitable for generating - * entities (i.e. exclude the "join" tables) - */ - Iterator<GenTable> entityTables() { - return new FilteringIterator<GenTable>(this.tables()) { - @Override - protected boolean accept(Object next) { - return ! ((GenTable) next).isJoinTable(); - } - }; - } - - int numEntityTables() { - return CollectionTools.size(entityTables()); - } - - /** - * return the gen table corresponding to the specified table - */ - GenTable genTable(Table table) { - return this.genTables.get(table); - } - - - // ********** internal API ********** - - private Iterator<GenTable> tables() { - return this.genTables.values().iterator(); - } - - /** - * return only the "join" gen tables - */ - private Iterator<GenTable> joinTables() { - return new FilteringIterator<GenTable>(this.tables()) { - @Override - protected boolean accept(Object next) { - return ((GenTable) next).isJoinTable(); - } - }; - } - - /** - * build a set of the tables that are referenced by other tables - * in the scope - */ - private Set<GenTable> buildReferencedTables() { - int size = CollectionTools.size(this.tables()); - Set<GenTable> referencedTables = new HashSet<GenTable>(this.genTables.size()); - for (Iterator<GenTable> stream = this.tables(); stream.hasNext(); ) { - stream.next().addReferencedTablesTo(referencedTables); - this.progressMonitor.worked(20/size); - } - return referencedTables; - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.gen/src/org/eclipse/jpt/gen/internal/GenTable.java b/jpa/plugins/org.eclipse.jpt.gen/src/org/eclipse/jpt/gen/internal/GenTable.java deleted file mode 100644 index ea7fd3d3c9..0000000000 --- a/jpa/plugins/org.eclipse.jpt.gen/src/org/eclipse/jpt/gen/internal/GenTable.java +++ /dev/null @@ -1,342 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2007 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.gen.internal; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Iterator; -import java.util.Map; -import java.util.Set; -import org.eclipse.jpt.db.internal.Column; -import org.eclipse.jpt.db.internal.ForeignKey; -import org.eclipse.jpt.db.internal.Table; -import org.eclipse.jpt.utility.internal.CollectionTools; -import org.eclipse.jpt.utility.internal.NameTools; -import org.eclipse.jpt.utility.internal.StringTools; -import org.eclipse.jpt.utility.internal.iterators.FilteringIterator; - -/** - * associate a table with the various relations that will be used when - * generating the entity - */ -class GenTable { - private final GenScope scope; - private final Table table; - private final EntityGenerator.Config entityConfig; - private final String entityName; - private ManyToManyRelation joinTableRelation; - private Collection<ManyToManyRelation> ownedManyToManyRelations = new ArrayList<ManyToManyRelation>(); - private Collection<ManyToManyRelation> nonOwnedManyToManyRelations = new ArrayList<ManyToManyRelation>(); - private Collection<ManyToOneRelation> manyToOneRelations = new ArrayList<ManyToOneRelation>(); - private Collection<OneToManyRelation> oneToManyRelations = new ArrayList<OneToManyRelation>(); - private Set<Column> foreignKeyColumns = new HashSet<Column>(); - - // key=column/relation; value=name - private final Map<Object, String> fieldNames = new HashMap<Object, String>(); - - private static final Object EMBEDDED_ID_VIRTUAL_COLUMN = new Object(); - - - // ********** construction/initialization ********** - - GenTable(GenScope scope, Table table, EntityGenerator.Config entityConfig, Collection<String> entityNames) { - super(); - this.scope = scope; - this.table = table; - this.entityConfig = entityConfig; - this.entityName = this.buildEntityName(entityNames); - } - - private String buildEntityName(Collection<String> entityNames) { - String name = this.table.shortJavaClassName(); - String overrideEntityName = this.entityConfig.getOverrideEntityName(this.table); - if (overrideEntityName == null) { - if (this.entityConfig.convertToCamelCase()) { - name = StringTools.convertUnderscoresToCamelCase(name); - } - } else { - name = overrideEntityName; - } - name = NameTools.uniqueNameForIgnoreCase(name, entityNames); - entityNames.add(name); - return name; - } - - - // ********** package API ********** - - /** - * determine whether the table is a "join" table within the table's scope - */ - void configureManyToManyRelations() { - if (this.table.foreignKeysSize() != 2) { - // the table must have exactly 2 foreign keys - return; - } - for (Iterator<Column> stream = this.table.columns(); stream.hasNext(); ) { - if ( ! this.table.foreignKeyColumnsContains(stream.next())) { - // all the table's columns must belong to one (or both) of the 2 foreign keys - return; - } - } - Iterator<ForeignKey> fKeys = this.table.foreignKeys(); - ForeignKey owningFK = fKeys.next(); - ForeignKey nonOwningFK = fKeys.next(); - GenTable owningTable = this.scope.genTable(owningFK.getReferencedTable()); - GenTable nonOwningTable = this.scope.genTable(nonOwningFK.getReferencedTable()); - if ((owningTable == null) || (nonOwningTable == null)) { - // both tables must be in the scope - return; - } - this.joinTableRelation = new ManyToManyRelation(this, owningFK, owningTable, nonOwningFK, nonOwningTable); - } - - void addReferencedTablesTo(Set<GenTable> referencedTables) { - for (Iterator<ForeignKey> stream = this.table.foreignKeys(); stream.hasNext(); ) { - ForeignKey fk = stream.next(); - GenTable genTable = this.scope.genTable(fk.getReferencedTable()); - if (genTable != null) { - referencedTables.add(genTable); - } - } - } - - void clearJoinTableRelation() { - this.joinTableRelation.clear(); - this.joinTableRelation = null; - } - - /** - * find "in-scope" foreign keys - */ - void configureManyToOneRelations() { - for (Iterator<ForeignKey> stream = this.table.foreignKeys(); stream.hasNext(); ) { - ForeignKey fk = stream.next(); - GenTable referencedtable = this.scope.genTable(fk.getReferencedTable()); - if (referencedtable == null) { - continue; // skip to next FK - } - this.manyToOneRelations.add(new ManyToOneRelation(this, fk, referencedtable)); - } - } - - /** - * now that all the relations are in place, we can configure the Java - * field names - */ - void configureFieldNames() { - Set<Column> columns = CollectionTools.set(this.table.columns()); - if ((this.table.primaryKeyColumnsSize() > 1) && this.entityConfig.generateEmbeddedIdForCompoundPK()) { - // if we are going to generate an EmbeddedId field, add it to - // 'fieldNames' so we don't collide with it later, when generating - // field names for the columns etc. - this.configureFieldName(EMBEDDED_ID_VIRTUAL_COLUMN, "pk"); - } - this.configureManyToOneFieldNames(columns); - this.configureBasicFieldNames(columns); - this.configureOneToManyFieldNames(); - this.configureOwnedManyToManyFieldNames(); - this.configureNonOwnedManyToManyFieldNames(); - } - - /** - * return the columns that are part of the table's primary key - * but are also part of an "in-scope" foreign key - */ - public Iterator<Column> readOnlyPrimaryKeyColumns() { - return new FilteringIterator<Column>(this.table.primaryKeyColumns()) { - @Override - protected boolean accept(Object column) { - return GenTable.this.foreignKeyColumnsContains((Column) column); - } - }; - } - - /** - * return the columns that are part of the table's primary key - * but are NOT part of any "in-scope" foreign key - */ - Iterator<Column> writablePrimaryKeyColumns() { - return new FilteringIterator<Column>(this.table.primaryKeyColumns()) { - @Override - protected boolean accept(Object column) { - return ! GenTable.this.foreignKeyColumnsContains((Column) column); - } - }; - } - - /** - * return the columns that NEITHER part of the table's primary key - * NOR part of any foreign key - */ - public Iterator<Column> nonPrimaryKeyBasicColumns() { - return new FilteringIterator<Column>(this.table.columns()) { - @Override - protected boolean accept(Object column) { - return ! (GenTable.this.primaryKeyColumnsContains((Column) column) - || GenTable.this.foreignKeyColumnsContains((Column) column)); - } - }; - } - - Table getTable() { - return this.table; - } - - String getEntityName() { - return this.entityName; - } - - boolean isJoinTable() { - return this.joinTableRelation != null; - } - - void addOwnedManyToManyRelation(ManyToManyRelation relation) { - this.ownedManyToManyRelations.add(relation); - } - - void removeOwnedManyToManyRelation(ManyToManyRelation relation) { - this.ownedManyToManyRelations.remove(relation); - } - - void addNonOwnedManyToManyRelation(ManyToManyRelation relation) { - this.nonOwnedManyToManyRelations.add(relation); - } - - void removeNonOwnedManyToManyRelation(ManyToManyRelation relation) { - this.nonOwnedManyToManyRelations.remove(relation); - } - - void addOneToManyRelation(OneToManyRelation relation) { - this.oneToManyRelations.add(relation); - } - - String javaFieldName() { - return this.table.javaFieldName(); - } - - Iterator<ManyToOneRelation> manyToOneRelations() { - return this.manyToOneRelations.iterator(); - } - - Iterator<OneToManyRelation> oneToManyRelations() { - return this.oneToManyRelations.iterator(); - } - - Iterator<ManyToManyRelation> ownedManyToManyRelations() { - return this.ownedManyToManyRelations.iterator(); - } - - Iterator<ManyToManyRelation> nonOwnedManyToManyRelations() { - return this.nonOwnedManyToManyRelations.iterator(); - } - - /** - * the key can be a column or relation - */ - private String fieldNameForInternal(Object o) { - return this.fieldNames.get(o); - } - - /** - * this will return null if we don't want an embedded id field - */ - String fieldNameForEmbeddedId() { - return this.fieldNameForInternal(EMBEDDED_ID_VIRTUAL_COLUMN); - } - - String fieldNameFor(Column column) { - return this.fieldNameForInternal(column); - } - - String fieldNameFor(ManyToOneRelation relation) { - return this.fieldNameForInternal(relation); - } - - String fieldNameFor(OneToManyRelation relation) { - return this.fieldNameForInternal(relation); - } - - String fieldNameFor(ManyToManyRelation relation) { - return this.fieldNameForInternal(relation); - } - - String name() { - return this.table.getName(); - } - - - // ********** internal API ********** - - /** - * while we are figuring out the names for the m:1 fields, remove from the - * specified set of columns the columns that are only part of the foreign keys - */ - private void configureManyToOneFieldNames(Set<Column> columns) { - for (ManyToOneRelation relation : this.manyToOneRelations) { - CollectionTools.removeAll(columns, relation.getForeignKey().nonPrimaryKeyBaseColumns()); - CollectionTools.addAll(this.foreignKeyColumns, relation.getForeignKey().baseColumns()); - relation.setMappedBy(this.configureFieldName(relation, relation.javaFieldName())); - } - } - - private String configureFieldName(Object o, String fieldName) { - fieldName = this.camelCase(fieldName); - fieldName = NameTools.uniqueNameFor(fieldName, this.fieldNames.values()); - this.fieldNames.put(o, fieldName); - return fieldName; - } - - private String camelCase(String name) { - return this.entityConfig.convertToCamelCase() ? - StringTools.convertUnderscoresToCamelCase(name, false) // false = don't capitalize first letter - : - name; - } - - /** - * build a unique field name for the specified "basic" columns, - * checking for name collisions - */ - private void configureBasicFieldNames(Set<Column> columns) { - for (Column column : columns) { - this.configureFieldName(column, column.javaFieldName()); - } - } - - private void configureOneToManyFieldNames() { - for (OneToManyRelation relation : this.oneToManyRelations) { - this.configureFieldName(relation, relation.javaFieldName()); - } - } - - private void configureOwnedManyToManyFieldNames() { - for (ManyToManyRelation relation : this.ownedManyToManyRelations) { - relation.setMappedBy(this.configureFieldName(relation, relation.javaFieldNameFor(this))); - } - } - - private void configureNonOwnedManyToManyFieldNames() { - for (ManyToManyRelation relation : this.nonOwnedManyToManyRelations) { - this.configureFieldName(relation, relation.javaFieldNameFor(this)); - } - } - - boolean foreignKeyColumnsContains(Column column) { - return this.foreignKeyColumns.contains(column); - } - - boolean primaryKeyColumnsContains(Column column) { - return this.table.primaryKeyColumnsContains(column); - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.gen/src/org/eclipse/jpt/gen/internal/ManyToManyRelation.java b/jpa/plugins/org.eclipse.jpt.gen/src/org/eclipse/jpt/gen/internal/ManyToManyRelation.java deleted file mode 100644 index d87608715a..0000000000 --- a/jpa/plugins/org.eclipse.jpt.gen/src/org/eclipse/jpt/gen/internal/ManyToManyRelation.java +++ /dev/null @@ -1,104 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2007 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.gen.internal; - -import org.eclipse.jpt.db.internal.ForeignKey; - -/** - * This object is shared by the two gen tables that make up the relation. - * Upon construction, 'mappedBy' will be 'null'. The first gen table to be - * used to generate an entity will fill in 'mappedBy' with the appropriate - * field/property name. - */ -class ManyToManyRelation { - private final GenTable joinTable; - private final ForeignKey owningForeignKey; - private final GenTable owningTable; - private final ForeignKey nonOwningForeignKey; - private final GenTable nonOwningTable; - private String mappedBy; - - - ManyToManyRelation(GenTable joinTable, ForeignKey owningForeignKey, GenTable owningTable, ForeignKey nonOwningForeignKey, GenTable nonOwningTable) { - super(); - this.joinTable = joinTable; - - this.owningForeignKey = owningForeignKey; - this.owningTable = owningTable; - owningTable.addOwnedManyToManyRelation(this); - - this.nonOwningForeignKey = nonOwningForeignKey; - this.nonOwningTable = nonOwningTable; - nonOwningTable.addNonOwnedManyToManyRelation(this); - } - - GenTable getJoinTable() { - return this.joinTable; - } - - ForeignKey getOwningForeignKey() { - return this.owningForeignKey; - } - - GenTable getOwningTable() { - return this.owningTable; - } - - ForeignKey getNonOwningForeignKey() { - return this.nonOwningForeignKey; - } - - GenTable getNonOwningTable() { - return this.nonOwningTable; - } - - private GenTable otherTable(GenTable table) { - return (table == this.owningTable) ? this.nonOwningTable : this.owningTable; - } - - String javaFieldNameFor(GenTable table) { - // TODO i18n? - return this.otherTable(table).javaFieldName() + "_collection"; - } - - void clear() { - this.owningTable.removeOwnedManyToManyRelation(this); - this.nonOwningTable.removeNonOwnedManyToManyRelation(this); - } - - String getMappedBy() { - return this.mappedBy; - } - - void setMappedBy(String mappedBy) { - this.mappedBy = mappedBy; - } - - String owningEntityName() { - return this.owningTable.getEntityName(); - } - - String nonOwningEntityName() { - return this.nonOwningTable.getEntityName(); - } - - boolean joinTableNameIsDefault() { - return this.joinTable.name().equals(this.getOwningTable().name() + "_" + this.getNonOwningTable().name()); - } - - boolean joinColumnsIsDefaultFor(String javaFieldName) { - return this.owningForeignKey.isDefaultFor(javaFieldName); - } - - boolean inverseJoinColumnsIsDefaultFor(String javaFieldName) { - return this.nonOwningForeignKey.isDefaultFor(javaFieldName); - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.gen/src/org/eclipse/jpt/gen/internal/ManyToOneRelation.java b/jpa/plugins/org.eclipse.jpt.gen/src/org/eclipse/jpt/gen/internal/ManyToOneRelation.java deleted file mode 100644 index 333018d3e6..0000000000 --- a/jpa/plugins/org.eclipse.jpt.gen/src/org/eclipse/jpt/gen/internal/ManyToOneRelation.java +++ /dev/null @@ -1,61 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2007 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.gen.internal; - -import org.eclipse.jpt.db.internal.ForeignKey; - -class ManyToOneRelation { - private final GenTable baseTable; // the "many" side - private final ForeignKey foreignKey; - private final GenTable referencedTable; // the "one" side - private String mappedBy; - - - ManyToOneRelation(GenTable baseTable, ForeignKey foreignKey, GenTable referencedTable) { - super(); - this.baseTable = baseTable; - this.foreignKey = foreignKey; - this.referencedTable = referencedTable; - referencedTable.addOneToManyRelation(new OneToManyRelation(this)); - } - - GenTable getBaseTable() { - return this.baseTable; - } - - ForeignKey getForeignKey() { - return this.foreignKey; - } - - GenTable getReferencedTable() { - return this.referencedTable; - } - - String javaFieldName() { - return this.foreignKey.javaFieldName(); - } - - String getMappedBy() { - return this.mappedBy; - } - - void setMappedBy(String mappedBy) { - this.mappedBy = mappedBy; - } - - String baseEntityName() { - return this.baseTable.getEntityName(); - } - - String referencedEntityName() { - return this.referencedTable.getEntityName(); - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.gen/src/org/eclipse/jpt/gen/internal/OneToManyRelation.java b/jpa/plugins/org.eclipse.jpt.gen/src/org/eclipse/jpt/gen/internal/OneToManyRelation.java deleted file mode 100644 index 4656d00c12..0000000000 --- a/jpa/plugins/org.eclipse.jpt.gen/src/org/eclipse/jpt/gen/internal/OneToManyRelation.java +++ /dev/null @@ -1,37 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2007 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.gen.internal; - -class OneToManyRelation { - private final ManyToOneRelation manyToOneRelation; - - OneToManyRelation(ManyToOneRelation manyToOneRelation) { - super(); - this.manyToOneRelation = manyToOneRelation; - } - - ManyToOneRelation getManyToOneRelation() { - return this.manyToOneRelation; - } - - String javaFieldName() { - // TODO i18n? - return this.manyToOneRelation.getBaseTable().javaFieldName() + "_collection"; - } - - String mappedBy() { - return this.manyToOneRelation.getMappedBy(); - } - - String referencedEntityName() { - return this.manyToOneRelation.baseEntityName(); - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.gen/src/org/eclipse/jpt/gen/internal/PackageGenerator.java b/jpa/plugins/org.eclipse.jpt.gen/src/org/eclipse/jpt/gen/internal/PackageGenerator.java deleted file mode 100644 index bce0da3063..0000000000 --- a/jpa/plugins/org.eclipse.jpt.gen/src/org/eclipse/jpt/gen/internal/PackageGenerator.java +++ /dev/null @@ -1,91 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2007 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.gen.internal; - -import java.util.Collection; -import java.util.Iterator; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.OperationCanceledException; -import org.eclipse.jdt.core.IPackageFragment; -import org.eclipse.jpt.db.internal.Table; -import org.eclipse.jpt.gen.internal.EntityGenerator.OverwriteConfirmer; -import org.eclipse.jpt.utility.internal.CollectionTools; - -/** - * This generator will generate a package of entities for a set of tables. - */ -public class PackageGenerator { - private final Config config; - private final EntityGenerator.Config entityConfig; - private final GenScope scope; - private final OverwriteConfirmer overwriteConfirmer; - private final IProgressMonitor monitor; - - - // ********** public API ********** - - public static void generateEntities(Config config, EntityGenerator.Config entityConfig, Collection<Table> tables, OverwriteConfirmer overwriteConfirmer, IProgressMonitor monitor) { - if ((config == null) || (entityConfig == null) || (tables == null)) { - throw new NullPointerException(); - } - new PackageGenerator(config, entityConfig, tables, overwriteConfirmer, monitor).generateEntities(); - } - - - // ********** construction/initialization ********** - - private PackageGenerator(Config config, EntityGenerator.Config entityConfig, Collection<Table> tables, OverwriteConfirmer overwriteConfirmer, IProgressMonitor monitor) { - super(); - this.config = config; - this.entityConfig = entityConfig; - this.scope = new GenScope(tables, entityConfig, monitor); - this.overwriteConfirmer = overwriteConfirmer; - this.monitor = monitor; - } - - - // ********** generation ********** - - private void generateEntities() { - int size = CollectionTools.size(this.scope.entityTables()); - for (Iterator<GenTable> stream = this.scope.entityTables(); stream.hasNext(); ) { - checkCanceled(); - this.buildEntity(stream.next()); - this.monitor.worked(50/size); - } - } - - private void checkCanceled() { - if (this.monitor.isCanceled()) { - throw new OperationCanceledException(); - } - } - - - private void buildEntity(GenTable genTable) { - EntityGenerator.generateEntity(this.entityConfig, this.config.getPackageFragment(), genTable, overwriteConfirmer, this.monitor); - } - - - // ********** config ********** - - public static class Config { - private IPackageFragment packageFragment; - - public IPackageFragment getPackageFragment() { - return this.packageFragment; - } - public void setPackageFragment(IPackageFragment packageFragment) { - this.packageFragment = packageFragment; - } - - } - -} diff --git a/jpa/tests/org.eclipse.jpt.core.tests/.classpath b/jpa/tests/org.eclipse.jpt.core.tests/.classpath deleted file mode 100644 index c8e5756d0f..0000000000 --- a/jpa/tests/org.eclipse.jpt.core.tests/.classpath +++ /dev/null @@ -1,12 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<classpath> - <classpathentry kind="src" path="src"/> - <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> - <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"> - <accessrules> - <accessrule kind="accessible" pattern="org/eclipse/wst/**"/> - <accessrule kind="accessible" pattern="org/eclipse/jst/**"/> - </accessrules> - </classpathentry> - <classpathentry kind="output" path="bin"/> -</classpath> diff --git a/jpa/tests/org.eclipse.jpt.core.tests/.cvsignore b/jpa/tests/org.eclipse.jpt.core.tests/.cvsignore deleted file mode 100644 index ba077a4031..0000000000 --- a/jpa/tests/org.eclipse.jpt.core.tests/.cvsignore +++ /dev/null @@ -1 +0,0 @@ -bin diff --git a/jpa/tests/org.eclipse.jpt.core.tests/.project b/jpa/tests/org.eclipse.jpt.core.tests/.project deleted file mode 100644 index 08395a8e86..0000000000 --- a/jpa/tests/org.eclipse.jpt.core.tests/.project +++ /dev/null @@ -1,28 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<projectDescription> - <name>org.eclipse.jpt.core.tests</name> - <comment></comment> - <projects> - </projects> - <buildSpec> - <buildCommand> - <name>org.eclipse.jdt.core.javabuilder</name> - <arguments> - </arguments> - </buildCommand> - <buildCommand> - <name>org.eclipse.pde.ManifestBuilder</name> - <arguments> - </arguments> - </buildCommand> - <buildCommand> - <name>org.eclipse.pde.SchemaBuilder</name> - <arguments> - </arguments> - </buildCommand> - </buildSpec> - <natures> - <nature>org.eclipse.pde.PluginNature</nature> - <nature>org.eclipse.jdt.core.javanature</nature> - </natures> -</projectDescription> diff --git a/jpa/tests/org.eclipse.jpt.core.tests/META-INF/MANIFEST.MF b/jpa/tests/org.eclipse.jpt.core.tests/META-INF/MANIFEST.MF deleted file mode 100644 index f03a1152e8..0000000000 --- a/jpa/tests/org.eclipse.jpt.core.tests/META-INF/MANIFEST.MF +++ /dev/null @@ -1,16 +0,0 @@ -Manifest-Version: 1.0 -Bundle-ManifestVersion: 2 -Bundle-Name: %pluginName -Bundle-Vendor: %providerName -Bundle-SymbolicName: org.eclipse.jpt.core.tests -Bundle-Version: 1.0.0 -Bundle-Localization: plugin -Require-Bundle: org.eclipse.core.resources, - org.eclipse.core.runtime, - org.eclipse.jdt.core, - org.eclipse.jpt.core, - org.eclipse.jpt.utility, - org.eclipse.wst.common.project.facet.core, - org.junit, - org.eclipse.emf.ecore -Bundle-RequiredExecutionEnvironment: J2SE-1.5 diff --git a/jpa/tests/org.eclipse.jpt.core.tests/build.properties b/jpa/tests/org.eclipse.jpt.core.tests/build.properties deleted file mode 100644 index 6b79e8c08b..0000000000 --- a/jpa/tests/org.eclipse.jpt.core.tests/build.properties +++ /dev/null @@ -1,16 +0,0 @@ -############################################################################### -# Copyright (c) 2006, 2007 Oracle. All rights reserved. This -# program and the accompanying materials are made available under the terms of -# the Eclipse Public License v1.0 which accompanies this distribution, and is -# available at http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: Oracle. - initial API and implementation -############################################################################### -javacSource = 1.5 -javacTarget = 1.5 -bin.includes = .,\ - META-INF/,\ - test.xml,\ - plugin.properties -source.. = src/ -output.. = bin/ diff --git a/jpa/tests/org.eclipse.jpt.core.tests/plugin.properties b/jpa/tests/org.eclipse.jpt.core.tests/plugin.properties deleted file mode 100644 index 6ebf8dbed1..0000000000 --- a/jpa/tests/org.eclipse.jpt.core.tests/plugin.properties +++ /dev/null @@ -1,22 +0,0 @@ -############################################################################### -# Copyright (c) 2006, 2007 Oracle. All rights reserved. This -# program and the accompanying materials are made available under the terms of -# the Eclipse Public License v1.0 which accompanies this distribution, and is -# available at http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: Oracle. - initial API and implementation -############################################################################### -# ==================================================================== -# To code developer: -# Do NOT change the properties between this line and the -# "%%% END OF TRANSLATED PROPERTIES %%%" line. -# Make a new property name, append to the end of the file and change -# the code to use the new property. -# ==================================================================== - -# ==================================================================== -# %%% END OF TRANSLATED PROPERTIES %%% -# ==================================================================== - -pluginName=Java Persistence API Core Tests -providerName=Eclipse.org diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/JptCoreTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/JptCoreTests.java deleted file mode 100644 index 8b990a6bb8..0000000000 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/JptCoreTests.java +++ /dev/null @@ -1,36 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2007 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.core.tests.internal; - -import junit.framework.Test; -import junit.framework.TestSuite; -import org.eclipse.jpt.core.tests.internal.content.java.mappings.JptCoreContentJavaMappingsTests; -import org.eclipse.jpt.core.tests.internal.jdtutility.JptCoreJdtUtilityTests; -import org.eclipse.jpt.core.tests.internal.model.JptCoreModelTests; - -/** - * Runs all JPA Core Tests - */ -public class JptCoreTests { - - public static Test suite() { - TestSuite suite = new TestSuite(JptCoreTests.class.getName()); - suite.addTest(JptCoreContentJavaMappingsTests.suite()); - suite.addTest(JptCoreModelTests.suite()); - suite.addTest(JptCoreJdtUtilityTests.suite()); - return suite; - } - - private JptCoreTests() { - super(); - throw new UnsupportedOperationException(); - } - -} diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/ProjectUtility.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/ProjectUtility.java deleted file mode 100644 index ac9e78a7d6..0000000000 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/ProjectUtility.java +++ /dev/null @@ -1,91 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007 Oracle. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.core.tests.internal; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.resources.IWorkspaceRunnable; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.AssertionFailedException; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IProgressMonitor; -/** - * Copied from org.eclipse.wst.common.tests - */ -public class ProjectUtility { - public static IProject[] getAllProjects() { - IProject[] projects = new IProject[0]; - try { - projects = ResourcesPlugin.getWorkspace().getRoot().getProjects(); - } catch (AssertionFailedException ex) { - // Catch Malformed tree exception that occurs from time to time... - } - return projects; - } - public static void deleteAllProjects() throws Exception { - //closing projects and tread work in here is a hack because of a BeanInfo bug holding - //onto jars loaded in another VM - -// for (int i = 0; i < projects.length; i++) { -// if (projects[i].exists()) { -// projects[i].close(null); // This should signal the extra VM to kill itself -// } -// } - // Thread.yield(); // give the VM a chance to die - IWorkspaceRunnable runnable = new IWorkspaceRunnable() { - - public void run(IProgressMonitor monitor) { - IProject[] projects = getAllProjects(); - for (int i = 0; i < projects.length; i++) { - IProject project = projects[i]; - boolean success = false; - Exception lastException = null; - // Don't make 2^12 is about 4 seconds which is the max we - // will wait for the VM to die - for (int j = 0; j < 13 && !success; j++) { - try { - if (project.exists()) { - project.delete(true, true, null); - ResourcesPlugin.getWorkspace().getRoot().refreshLocal(IResource.DEPTH_INFINITE, null); - } - success = true; - } catch (Exception e) { - lastException = e; - if (project.exists()) { - try { - project.close(null); - project.open(null); - } catch (Exception e2) { - // do nothing - } - } - try { - Thread.sleep((int) Math.pow(2, j)); - } catch (InterruptedException e1) { - // do nothing - } // if the VM isn't dead, try sleeping - } - } - if (!success && lastException != null) { - //Logger.getLogger().log("Problem while deleting: " + lastException.getMessage()); -// Assert.fail("Caught Exception=" + -// lastException.getMessage() + " when deleting project=" + project.getName()); - } - } - } - }; - try { - ResourcesPlugin.getWorkspace().run(runnable, null); - } catch (CoreException ce) { - // do nothing - } - //verifyNoProjects(); - } -}
\ No newline at end of file diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/content/java/mappings/JavaEntityTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/content/java/mappings/JavaEntityTests.java deleted file mode 100644 index bbf7a950dd..0000000000 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/content/java/mappings/JavaEntityTests.java +++ /dev/null @@ -1,52 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007 Oracle. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.core.tests.internal.content.java.mappings; - -import java.util.Iterator; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.jpt.core.internal.content.java.IJavaTypeMapping; -import org.eclipse.jpt.core.internal.content.java.mappings.JPA; -import org.eclipse.jpt.utility.internal.iterators.ArrayIterator; - -public class JavaEntityTests extends JpaJavaTestCase { - - public JavaEntityTests(String name) { - super(name); - } - - private void createTestEntity1() throws CoreException { - this.createTestType(new DefaultAnnotationWriter() { - @Override - public Iterator<String> imports() { - return new ArrayIterator<String>(JPA.ENTITY); - } - @Override - public void appendTypeAnnotationTo(StringBuffer sb) { - sb.append("@Entity"); - } - }); - this.synchPersistenceXml(); - } - - public void testGetName() throws Exception { - this.createTestEntity1(); - IJavaTypeMapping typeMapping = this.javaPersistentTypeNamed(FULLY_QUALIFIED_TYPE_NAME).getMapping(); - assertEquals(TYPE_NAME, typeMapping.getName()); - } - -// TODO we can only execute 1 test for now... -// public void testGetKey() throws Exception { -// this.createTestEntity1(); -// IJavaTypeMapping typeMapping = this.javaPersistentTypeNamed(FULLY_QUALIFIED_TYPE_NAME).getMapping(); -// assertEquals(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, typeMapping.getKey()); -// } -// -} diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/content/java/mappings/JpaJavaTestCase.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/content/java/mappings/JpaJavaTestCase.java deleted file mode 100644 index ba028e9704..0000000000 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/content/java/mappings/JpaJavaTestCase.java +++ /dev/null @@ -1,62 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007 Oracle. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.core.tests.internal.content.java.mappings; - -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.NullProgressMonitor; -import org.eclipse.jdt.core.JavaCore; -import org.eclipse.jpt.core.internal.IJpaFile; -import org.eclipse.jpt.core.internal.content.java.JavaPersistentType; -import org.eclipse.jpt.core.internal.content.java.JpaCompilationUnit; -import org.eclipse.jpt.core.internal.jdtutility.Type; -import org.eclipse.jpt.core.internal.synch.SynchronizeClassesJob; -import org.eclipse.jpt.core.tests.internal.jdtutility.AnnotationTestCase; -import org.eclipse.jpt.core.tests.internal.projects.TestJavaProject; -import org.eclipse.jpt.core.tests.internal.projects.TestJpaProject; -import org.eclipse.jpt.utility.internal.ClassTools; - -public abstract class JpaJavaTestCase extends AnnotationTestCase { - - public JpaJavaTestCase(String name) { - super(name); - } - - @Override - protected TestJavaProject buildJavaProject(String projectName, boolean autoBuild) throws Exception { - return new TestJpaProject(projectName, autoBuild); - } - - protected TestJpaProject jpaProject() { - return (TestJpaProject) this.javaProject; - } - - protected JavaPersistentType javaPersistentTypeNamed(String typeName) { - for (IJpaFile jpaFile : this.jpaProject().getJpaProject().jpaFiles(JavaCore.JAVA_SOURCE_CONTENT_TYPE)) { - JpaCompilationUnit cu = (JpaCompilationUnit) jpaFile.getContent(); - for (JavaPersistentType pt : cu.getTypes()) { - if (pt.fullyQualifiedTypeName().equals(typeName)) { - return pt; - } - } - } - throw new IllegalArgumentException("missing type: " + typeName); - } - - protected Type typeNamed(String typeName) { - return this.javaPersistentTypeNamed(typeName).getType(); - } - - protected void synchPersistenceXml() { - SynchronizeClassesJob job = new SynchronizeClassesJob(this.jpaProject().getProject().getFile("src/META-INF/persistence.xml")); - ClassTools.executeMethod(job, "run", IProgressMonitor.class, new NullProgressMonitor()); - } - -} diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/content/java/mappings/JptCoreContentJavaMappingsTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/content/java/mappings/JptCoreContentJavaMappingsTests.java deleted file mode 100644 index ddbb6bd094..0000000000 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/content/java/mappings/JptCoreContentJavaMappingsTests.java +++ /dev/null @@ -1,28 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.core.tests.internal.content.java.mappings; - -import junit.framework.Test; -import junit.framework.TestSuite; - -public class JptCoreContentJavaMappingsTests { - - public static Test suite() { - TestSuite suite = new TestSuite(JptCoreContentJavaMappingsTests.class.getName()); -// suite.addTestSuite(JavaEntityTests.class); - return suite; - } - - private JptCoreContentJavaMappingsTests() { - super(); - throw new UnsupportedOperationException(); - } - -} diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/jdtutility/AnnotationTestCase.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/jdtutility/AnnotationTestCase.java deleted file mode 100644 index 87d6169bac..0000000000 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/jdtutility/AnnotationTestCase.java +++ /dev/null @@ -1,429 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2007 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.core.tests.internal.jdtutility; - -import java.util.Iterator; -import java.util.List; -import junit.framework.TestCase; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.jdt.core.IType; -import org.eclipse.jdt.core.JavaModelException; -import org.eclipse.jdt.core.dom.AST; -import org.eclipse.jdt.core.dom.Annotation; -import org.eclipse.jdt.core.dom.Expression; -import org.eclipse.jdt.core.dom.MemberValuePair; -import org.eclipse.jdt.core.dom.NormalAnnotation; -import org.eclipse.jdt.core.dom.NumberLiteral; -import org.eclipse.jdt.core.dom.SimpleName; -import org.eclipse.jdt.core.dom.SingleMemberAnnotation; -import org.eclipse.jdt.core.dom.StringLiteral; -import org.eclipse.jpt.core.internal.jdtutility.FieldAttribute; -import org.eclipse.jpt.core.internal.jdtutility.MethodAttribute; -import org.eclipse.jpt.core.internal.jdtutility.Type; -import org.eclipse.jpt.core.tests.internal.projects.TestJavaProject; -import org.eclipse.jpt.core.tests.internal.projects.TestJavaProject.SourceWriter; -import org.eclipse.jpt.utility.internal.iterators.EmptyIterator; -import org.eclipse.jpt.utility.internal.iterators.SingleElementIterator; - -/** - * Provide an easy(?) way to build an annotated source file. - * The type must be created by calling one of the #createType() methods - * before calling any of the various helper methods (i.e. the type is *not* - * created during #setUp()). - */ -public abstract class AnnotationTestCase extends TestCase { - protected TestJavaProject javaProject; - - protected static final String CR = System.getProperty("line.separator"); - protected static final String PROJECT_NAME = "AnnotationTestProject"; - protected static final String PACKAGE_NAME = "test"; - protected static final String TYPE_NAME = "AnnotationTestType"; - protected static final String FULLY_QUALIFIED_TYPE_NAME = PACKAGE_NAME + "." + TYPE_NAME; - protected static final String FILE_NAME = TYPE_NAME + ".java"; - - protected static final String[] EMPTY_STRING_ARRAY = new String[0]; - - - // ********** TestCase behavior ********** - - protected AnnotationTestCase(String name) { - super(name); - } - - @Override - protected void setUp() throws Exception { - super.setUp(); - this.javaProject = this.buildJavaProject(PROJECT_NAME, false); // false = no auto-build - } - - protected TestJavaProject buildJavaProject(String projectName, boolean autoBuild) throws Exception { - return new TestJavaProject(projectName, autoBuild); // false = no auto-build - } - - @Override - protected void tearDown() throws Exception { -// this.dumpSource(); - this.javaProject.dispose(); - this.javaProject = null; - super.tearDown(); - } - - protected void dumpSource() throws Exception { - System.out.println("*** " + this.getName() + " ****"); - System.out.println(this.source()); - System.out.println(); - } - - - // ********** type creation ********** - - /** - * create an un-annotated type - */ - protected IType createTestType() throws CoreException { - return this.createTestType(new DefaultAnnotationWriter()); - } - - /** - * shortcut for simply adding an annotation to the 'id' field - */ - protected IType createTestType(final String annotationImport, final String idFieldAnnotation) throws CoreException { - return this.createTestType(new DefaultAnnotationWriter() { - @Override - public Iterator<String> imports() { - return (annotationImport == null) ? - EmptyIterator.<String>instance() - : - new SingleElementIterator<String>(annotationImport); - } - @Override - public void appendIdFieldAnnotationTo(StringBuffer sb) { - sb.append(idFieldAnnotation); - } - }); - } - - /** - * shortcut for simply adding a fully-qualified annotation to the 'id' field - */ - protected IType createTestType(final String idFieldAnnotation) throws CoreException { - return this.createTestType(null, idFieldAnnotation); - } - - protected IType createTestType(AnnotationWriter annotationWriter) throws CoreException { - return this.javaProject.createType(PACKAGE_NAME, FILE_NAME, this.createSourceWriter(annotationWriter)); - } - - protected SourceWriter createSourceWriter(AnnotationWriter annotationWriter) { - return new AnnotatedSourceWriter(annotationWriter); - } - - protected void appendSourceTo(StringBuffer sb, AnnotationWriter annotationWriter) { - sb.append(CR); - for (Iterator<String> stream = annotationWriter.imports(); stream.hasNext(); ) { - sb.append("import "); - sb.append(stream.next()); - sb.append(";"); - sb.append(CR); - } - annotationWriter.appendTypeAnnotationTo(sb); - sb.append(CR); - sb.append("public class ").append(TYPE_NAME).append(" {").append(CR); - sb.append(CR); - sb.append(" "); - annotationWriter.appendIdFieldAnnotationTo(sb); - sb.append(CR); - sb.append(" private int id;").append(CR); - sb.append(CR); - sb.append(" "); - annotationWriter.appendNameFieldAnnotationTo(sb); - sb.append(CR); - sb.append(" private String name;").append(CR); - sb.append(CR); - sb.append(" "); - annotationWriter.appendGetIdMethodAnnotationTo(sb); - sb.append(CR); - sb.append(" public int getId() {").append(CR); - sb.append(" return this.id;").append(CR); - sb.append(" }").append(CR); - sb.append(CR); - sb.append(" "); - annotationWriter.appendSetIdMethodAnnotationTo(sb); - sb.append(CR); - sb.append(" public void setId(int id) {").append(CR); - sb.append(" this.id = id;").append(CR); - sb.append(" }").append(CR); - sb.append(CR); - sb.append(" "); - annotationWriter.appendGetNameMethodAnnotationTo(sb); - sb.append(CR); - sb.append(" public String getName() {").append(CR); - sb.append(" return this.name;").append(CR); - sb.append(" }").append(CR); - sb.append(CR); - sb.append(" "); - annotationWriter.appendSetNameMethodAnnotationTo(sb); - sb.append(CR); - sb.append(" public void setTestField(String testField) {").append(CR); - sb.append(" this.testField = testField;").append(CR); - sb.append(" }").append(CR); - sb.append(CR); - sb.append("}").append(CR); - } - - - // ********** queries ********** - - protected IType jdtType() throws JavaModelException { - return this.javaProject.findType(FULLY_QUALIFIED_TYPE_NAME); - } - - protected Type testType() throws JavaModelException { - return new Type(this.jdtType()); - } - - protected FieldAttribute idField() throws JavaModelException { - return this.fieldNamed("id"); - } - - protected FieldAttribute nameField() throws JavaModelException { - return this.fieldNamed("name"); - } - - protected FieldAttribute fieldNamed(String fieldName) throws JavaModelException { - return new FieldAttribute(this.jdtType().getField(fieldName)); - } - - protected MethodAttribute idGetMethod() throws JavaModelException { - return this.methodNamed("getId"); - } - - protected MethodAttribute nameGetMethod() throws JavaModelException { - return this.methodNamed("getName"); - } - - protected MethodAttribute methodNamed(String methodName) throws JavaModelException { - return this.method(methodName, EMPTY_STRING_ARRAY); - } - - protected MethodAttribute method(String methodName, String[] parameterTypeSignatures) throws JavaModelException { - return new MethodAttribute(this.jdtType().getMethod(methodName, parameterTypeSignatures)); - } - - protected String source() throws JavaModelException { - return this.jdtType().getOpenable().getBuffer().getContents(); - } - - - // ********** test validation ********** - - protected void assertSourceContains(String s) throws JavaModelException { - String source = this.source(); - boolean found = source.indexOf(s) > -1; - if ( ! found) { - String msg = "source does not contain the expected string: " + s + " (see System console)"; - System.out.println("*** " + this.getName() + " ****"); - System.out.println(msg); - System.out.println(source); - System.out.println(); - fail(msg); - } - } - - protected void assertSourceDoesNotContain(String s) throws JavaModelException { - String source = this.source(); - int pos = source.indexOf(s); - if (pos != -1) { - String msg = "unexpected string in source (position: " + pos + "): " + s + " (see System console)"; - System.out.println("*** " + this.getName() + " ****"); - System.out.println(msg); - System.out.println(source); - System.out.println(); - fail(msg); - } - } - - - // ********** manipulate annotations ********** - - /** - * Return the *first* member value pair for the specified annotation element - * with the specified name. - * Return null if the annotation has no such element. - */ - protected MemberValuePair memberValuePair(NormalAnnotation annotation, String elementName) { - for (MemberValuePair pair : this.values(annotation)) { - if (pair.getName().getFullyQualifiedName().equals(elementName)) { - return pair; - } - } - return null; - } - - @SuppressWarnings("unchecked") - protected List<MemberValuePair> values(NormalAnnotation na) { - return na.values(); - } - - /** - * check for null member value pair - */ - protected Expression valueInternal(MemberValuePair pair) { - return (pair == null) ? null : pair.getValue(); - } - - /** - * Return the value of the *first* annotation element - * with the specified name. - * Return null if the annotation has no such element. - */ - protected Expression annotationElementValue(NormalAnnotation annotation, String elementName) { - return this.valueInternal(this.memberValuePair(annotation, elementName)); - } - - /** - * Return the value of the *first* annotation element - * with the specified name. - * Return null if the annotation has no such element. - */ - protected Expression annotationElementValue(SingleMemberAnnotation annotation, String elementName) { - return elementName.equals("value") ? annotation.getValue() : null; - } - - /** - * Return the value of the *first* annotation element - * with the specified name. - * Return null if the annotation has no such element. - * (An element name of "value" will return the value of a single - * member annotation.) - */ - protected Expression annotationElementValue(Annotation annotation, String elementName) { - if (annotation.isNormalAnnotation()) { - return this.annotationElementValue((NormalAnnotation) annotation, elementName); - } - if (annotation.isSingleMemberAnnotation()) { - return this.annotationElementValue((SingleMemberAnnotation) annotation, elementName); - } - return null; - } - - /** - * Build a number literal and set its initial value to the specified literal. - */ - protected NumberLiteral newNumberLiteral(AST ast, int value) { - return ast.newNumberLiteral(Integer.toString(value)); - } - - /** - * Build a string literal and set its initial value. - */ - protected StringLiteral newStringLiteral(AST ast, String value) { - StringLiteral stringLiteral = ast.newStringLiteral(); - stringLiteral.setLiteralValue(value); - return stringLiteral; - } - - protected MemberValuePair newMemberValuePair(AST ast, SimpleName name, Expression value) { - MemberValuePair pair = ast.newMemberValuePair(); - pair.setName(name); - pair.setValue(value); - return pair; - } - - protected MemberValuePair newMemberValuePair(AST ast, String name, Expression value) { - return this.newMemberValuePair(ast, ast.newSimpleName(name), value); - } - - protected MemberValuePair newMemberValuePair(AST ast, String name, String value) { - return this.newMemberValuePair(ast, name, this.newStringLiteral(ast, value)); - } - - protected MemberValuePair newMemberValuePair(AST ast, String name, int value) { - return this.newMemberValuePair(ast, name, this.newNumberLiteral(ast, value)); - } - - /** - * Add the specified member value pair to the specified annotation. - * Return the resulting annotation. - */ - protected NormalAnnotation addMemberValuePair(NormalAnnotation annotation, MemberValuePair pair) { - this.values(annotation).add(pair); - return annotation; - } - - /** - * Add the specified member value pair to the specified annotation. - * Return the resulting annotation. - */ - protected NormalAnnotation addMemberValuePair(NormalAnnotation annotation, String name, int value) { - return this.addMemberValuePair(annotation, this.newMemberValuePair(annotation.getAST(), name, value)); - } - - /** - * Add the specified member value pair to the specified annotation. - * Return the resulting annotation. - */ - protected NormalAnnotation addMemberValuePair(NormalAnnotation annotation, String name, String value) { - return this.addMemberValuePair(annotation, this.newMemberValuePair(annotation.getAST(), name, value)); - } - - - // ********** member classes ********** - - public interface AnnotationWriter { - Iterator<String> imports(); - void appendTypeAnnotationTo(StringBuffer sb); - void appendIdFieldAnnotationTo(StringBuffer sb); - void appendNameFieldAnnotationTo(StringBuffer sb); - void appendGetIdMethodAnnotationTo(StringBuffer sb); - void appendSetIdMethodAnnotationTo(StringBuffer sb); - void appendGetNameMethodAnnotationTo(StringBuffer sb); - void appendSetNameMethodAnnotationTo(StringBuffer sb); - } - - public static class DefaultAnnotationWriter implements AnnotationWriter { - public Iterator<String> imports() {return EmptyIterator.instance();} - public void appendTypeAnnotationTo(StringBuffer sb) {/* do nothing */} - public void appendIdFieldAnnotationTo(StringBuffer sb) {/* do nothing */} - public void appendNameFieldAnnotationTo(StringBuffer sb) {/* do nothing */} - public void appendGetIdMethodAnnotationTo(StringBuffer sb) {/* do nothing */} - public void appendSetIdMethodAnnotationTo(StringBuffer sb) {/* do nothing */} - public void appendGetNameMethodAnnotationTo(StringBuffer sb) {/* do nothing */} - public void appendSetNameMethodAnnotationTo(StringBuffer sb) {/* do nothing */} - } - - public static class AnnotationWriterWrapper implements AnnotationWriter { - private final AnnotationWriter aw; - public AnnotationWriterWrapper(AnnotationWriter aw) { - super(); - this.aw = aw; - } - public Iterator<String> imports() {return aw.imports();} - public void appendTypeAnnotationTo(StringBuffer sb) {aw.appendTypeAnnotationTo(sb);} - public void appendIdFieldAnnotationTo(StringBuffer sb) {aw.appendIdFieldAnnotationTo(sb);} - public void appendNameFieldAnnotationTo(StringBuffer sb) {aw.appendNameFieldAnnotationTo(sb);} - public void appendGetIdMethodAnnotationTo(StringBuffer sb) {aw.appendGetIdMethodAnnotationTo(sb);} - public void appendSetIdMethodAnnotationTo(StringBuffer sb) {aw.appendSetIdMethodAnnotationTo(sb);} - public void appendGetNameMethodAnnotationTo(StringBuffer sb) {aw.appendGetNameMethodAnnotationTo(sb);} - public void appendSetNameMethodAnnotationTo(StringBuffer sb) {aw.appendSetNameMethodAnnotationTo(sb);} - } - - public class AnnotatedSourceWriter implements SourceWriter { - private AnnotationWriter annotationWriter; - public AnnotatedSourceWriter(AnnotationWriter annotationWriter) { - super(); - this.annotationWriter = annotationWriter; - } - public void appendSourceTo(StringBuffer sb) { - AnnotationTestCase.this.appendSourceTo(sb, this.annotationWriter); - } - } - -} diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/jdtutility/CombinationIndexedDeclarationAnnotationAdapterTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/jdtutility/CombinationIndexedDeclarationAnnotationAdapterTests.java deleted file mode 100644 index 10a259ccf7..0000000000 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/jdtutility/CombinationIndexedDeclarationAnnotationAdapterTests.java +++ /dev/null @@ -1,728 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2007 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.core.tests.internal.jdtutility; - -import org.eclipse.jdt.core.dom.Annotation; -import org.eclipse.jdt.core.dom.MemberValuePair; -import org.eclipse.jdt.core.dom.NormalAnnotation; -import org.eclipse.jdt.core.dom.StringLiteral; -import org.eclipse.jpt.core.internal.jdtutility.AnnotationAdapter; -import org.eclipse.jpt.core.internal.jdtutility.CombinationIndexedDeclarationAnnotationAdapter; -import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationAdapter; -import org.eclipse.jpt.core.internal.jdtutility.IndexedAnnotationAdapter; -import org.eclipse.jpt.core.internal.jdtutility.IndexedDeclarationAnnotationAdapter; -import org.eclipse.jpt.core.internal.jdtutility.MemberAnnotationAdapter; -import org.eclipse.jpt.core.internal.jdtutility.MemberIndexedAnnotationAdapter; - -public class CombinationIndexedDeclarationAnnotationAdapterTests extends AnnotationTestCase { - - public CombinationIndexedDeclarationAnnotationAdapterTests(String name) { - super(name); - } - - private void createAnnotationAndMembers(String annotationName, String annotationBody) throws Exception { - this.javaProject.createType("annot", annotationName + ".java", "public @interface " + annotationName + " { " + annotationBody + " }"); - } - - public void testGetAnnotation1() throws Exception { - this.createAnnotationAndMembers("JoinColumn", "String name();"); - this.createAnnotationAndMembers("JoinColumns", "JoinColumn[] value();"); - this.createTestType("@annot.JoinColumn(name=\"ADDRESS_ID\")"); - DeclarationAnnotationAdapter daa = new CombinationIndexedDeclarationAnnotationAdapter( - "annot.JoinColumn", "annot.JoinColumns", 0); - AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(), daa); - Annotation annotation = aa.getAnnotation(); - assertNotNull(annotation); - assertEquals("annot.JoinColumn", annotation.getTypeName().getFullyQualifiedName()); - assertTrue(annotation.isNormalAnnotation()); - } - - public void testGetAnnotation2() throws Exception { - this.createAnnotationAndMembers("JoinColumn", "String name();"); - this.createAnnotationAndMembers("JoinColumns", "JoinColumn[] value();"); - this.createTestType("@annot.JoinColumn(name=\"ADDRESS_ID\")"); - DeclarationAnnotationAdapter daa = new CombinationIndexedDeclarationAnnotationAdapter( - "annot.JoinColumn", "annot.JoinColumns", 1); - AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(), daa); - Annotation annotation = aa.getAnnotation(); - assertNull(annotation); - } - - public void testGetAnnotation3() throws Exception { - this.createAnnotationAndMembers("JoinColumn", "String name();"); - this.createAnnotationAndMembers("JoinColumns", "JoinColumn[] value();"); - this.createTestType("@annot.JoinColumns(@annot.JoinColumn(name=\"ADDRESS_ID\"))"); - DeclarationAnnotationAdapter daa = new CombinationIndexedDeclarationAnnotationAdapter( - "annot.JoinColumn", "annot.JoinColumns", 0); - AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(), daa); - Annotation annotation = aa.getAnnotation(); - assertNotNull(annotation); - assertEquals("annot.JoinColumn", annotation.getTypeName().getFullyQualifiedName()); - assertTrue(annotation.isNormalAnnotation()); - } - - public void testGetAnnotation4() throws Exception { - this.createAnnotationAndMembers("JoinColumn", "String name();"); - this.createAnnotationAndMembers("JoinColumns", "JoinColumn[] value();"); - this.createTestType("@annot.JoinColumns(@annot.JoinColumn(name=\"ADDRESS_ID\"))"); - DeclarationAnnotationAdapter daa = new CombinationIndexedDeclarationAnnotationAdapter( - "annot.JoinColumn", "annot.JoinColumns", 1); - AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(), daa); - Annotation annotation = aa.getAnnotation(); - assertNull(annotation); - } - - public void testGetAnnotation5() throws Exception { - this.createAnnotationAndMembers("JoinColumn", "String name();"); - this.createAnnotationAndMembers("JoinColumns", "JoinColumn[] value();"); - this.createTestType("@annot.JoinColumns({@annot.JoinColumn(name=\"ADDRESS_ID1\"), @annot.JoinColumn(name=\"ADDRESS_ID2\")})"); - DeclarationAnnotationAdapter daa = new CombinationIndexedDeclarationAnnotationAdapter( - "annot.JoinColumn", "annot.JoinColumns", 1); - AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(), daa); - Annotation annotation = aa.getAnnotation(); - assertNotNull(annotation); - assertEquals("annot.JoinColumn", annotation.getTypeName().getFullyQualifiedName()); - assertTrue(annotation.isNormalAnnotation()); - String value = ((StringLiteral) ((MemberValuePair) ((NormalAnnotation) annotation).values().get(0)).getValue()).getLiteralValue(); - assertEquals("ADDRESS_ID2", value); - } - - public void testGetAnnotation6() throws Exception { - this.createAnnotationAndMembers("JoinColumn", "String name();"); - this.createAnnotationAndMembers("JoinColumns", "JoinColumn[] value();"); - this.createTestType("@annot.JoinColumns({@annot.JoinColumn(name=\"ADDRESS_ID1\"), @annot.JoinColumn(name=\"ADDRESS_ID2\")})"); - DeclarationAnnotationAdapter daa = new CombinationIndexedDeclarationAnnotationAdapter( - "annot.JoinColumn", "annot.JoinColumns", "columns", 1); - AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(), daa); - Annotation annotation = aa.getAnnotation(); - assertNull(annotation); - } - - public void testGetAnnotation7() throws Exception { - this.createAnnotationAndMembers("JoinColumn", "String name();"); - this.createAnnotationAndMembers("JoinColumns", "JoinColumn[] columns();"); - this.createTestType("@annot.JoinColumns(columns={@annot.JoinColumn(name=\"ADDRESS_ID1\"), @annot.JoinColumn(name=\"ADDRESS_ID2\")})"); - DeclarationAnnotationAdapter daa = new CombinationIndexedDeclarationAnnotationAdapter( - "annot.JoinColumn", "annot.JoinColumns", "columns", 1); - AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(), daa); - Annotation annotation = aa.getAnnotation(); - assertNotNull(annotation); - assertEquals("annot.JoinColumn", annotation.getTypeName().getFullyQualifiedName()); - assertTrue(annotation.isNormalAnnotation()); - String value = ((StringLiteral) ((MemberValuePair) ((NormalAnnotation) annotation).values().get(0)).getValue()).getLiteralValue(); - assertEquals("ADDRESS_ID2", value); - } - - public void testGetAnnotation8() throws Exception { - this.createAnnotationAndMembers("JoinColumn", "String name();"); - this.createAnnotationAndMembers("JoinColumns", "JoinColumn[] columns();"); - this.createTestType("@annot.JoinColumns(columns={@annot.JoinColumn(name=\"ADDRESS_ID1\"), @annot.JoinColumn(name=\"ADDRESS_ID2\")})"); - DeclarationAnnotationAdapter daa = new CombinationIndexedDeclarationAnnotationAdapter( - "annot.JoinColumn", "annot.JoinColumns", 1); - AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(), daa); - Annotation annotation = aa.getAnnotation(); - assertNull(annotation); - } - - public void testRemoveAnnotation1() throws Exception { - this.createAnnotationAndMembers("JoinColumn", "String name();"); - this.createAnnotationAndMembers("JoinColumns", "JoinColumn[] value();"); - this.createTestType("@annot.JoinColumn(name=\"ADDRESS_ID\")"); - DeclarationAnnotationAdapter daa = new CombinationIndexedDeclarationAnnotationAdapter( - "annot.JoinColumn", "annot.JoinColumns", 0); - AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(), daa); - aa.removeAnnotation(); - this.assertSourceDoesNotContain("JoinColumn"); - } - - public void testRemoveAnnotation2() throws Exception { - this.createAnnotationAndMembers("JoinColumn", "String name();"); - this.createAnnotationAndMembers("JoinColumns", "JoinColumn[] value();"); - this.createTestType("@annot.JoinColumns(@annot.JoinColumn(name=\"ADDRESS_ID\"))"); - DeclarationAnnotationAdapter daa = new CombinationIndexedDeclarationAnnotationAdapter( - "annot.JoinColumn", "annot.JoinColumns", 0); - AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(), daa); - aa.removeAnnotation(); - this.assertSourceDoesNotContain("JoinColumns"); - this.assertSourceDoesNotContain("JoinColumn"); - } - - public void testRemoveAnnotation3() throws Exception { - this.createAnnotationAndMembers("JoinColumn", "String name();"); - this.createAnnotationAndMembers("JoinColumns", "JoinColumn[] value();"); - this.createTestType("@annot.JoinColumns({@annot.JoinColumn(name=\"ADDRESS_ID1\"), @annot.JoinColumn(name=\"ADDRESS_ID2\")})"); - DeclarationAnnotationAdapter daa = new CombinationIndexedDeclarationAnnotationAdapter( - "annot.JoinColumn", "annot.JoinColumns", 1); - AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(), daa); - aa.removeAnnotation(); - this.assertSourceDoesNotContain("JoinColumns"); - this.assertSourceDoesNotContain("ADDRESS_ID2"); - this.assertSourceContains("@JoinColumn(name=\"ADDRESS_ID1\")"); - } - - public void testRemoveAnnotation4() throws Exception { - this.createAnnotationAndMembers("JoinColumn", "String name();"); - this.createAnnotationAndMembers("JoinColumns", "JoinColumn[] columns();"); - this.createTestType("@annot.JoinColumns(columns={@annot.JoinColumn(name=\"ADDRESS_ID1\"), @annot.JoinColumn(name=\"ADDRESS_ID2\")})"); - DeclarationAnnotationAdapter daa = new CombinationIndexedDeclarationAnnotationAdapter( - "annot.JoinColumn", "annot.JoinColumns", "columns", 1); - AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(), daa); - aa.removeAnnotation(); - this.assertSourceDoesNotContain("JoinColumns"); - this.assertSourceDoesNotContain("ADDRESS_ID2"); - this.assertSourceContains("@JoinColumn(name=\"ADDRESS_ID1\")"); - } - - public void testRemoveAnnotation5() throws Exception { - this.createAnnotationAndMembers("JoinColumn", "String name();"); - this.createAnnotationAndMembers("JoinColumns", "String comment(); JoinColumn[] columns();"); - this.createTestType("@annot.JoinColumns(comment=\"test\",columns={@annot.JoinColumn(name=\"ADDRESS_ID1\"), @annot.JoinColumn(name=\"ADDRESS_ID2\")})"); - DeclarationAnnotationAdapter daa = new CombinationIndexedDeclarationAnnotationAdapter( - "annot.JoinColumn", "annot.JoinColumns", "columns", 1); - AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(), daa); - aa.removeAnnotation(); - this.assertSourceContains("@annot.JoinColumns(comment=\"test\",columns=@annot.JoinColumn(name=\"ADDRESS_ID1\"))"); - } - - public void testRemoveAnnotation6() throws Exception { - this.createAnnotationAndMembers("JoinColumn", "String name();"); - this.createAnnotationAndMembers("JoinColumns", "JoinColumn[] value();"); - this.createTestType("@annot.JoinColumns(null)"); - DeclarationAnnotationAdapter daa = new CombinationIndexedDeclarationAnnotationAdapter( - "annot.JoinColumn", "annot.JoinColumns", 0); - AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(), daa); - aa.removeAnnotation(); - this.assertSourceContains("@annot.JoinColumns(null)"); - } - - public void testRemoveAnnotation12() throws Exception { - this.createAnnotationAndMembers("JoinColumn", "String name();"); - this.createAnnotationAndMembers("JoinColumns", "JoinColumn[] value();"); - this.createTestType("@annot.JoinColumns({@annot.JoinColumn(name=\"ADDRESS_ID0\"), null, @annot.JoinColumn(name=\"ADDRESS_ID2\")})"); - String expected = "@JoinColumn(name=\"ADDRESS_ID0\")"; - DeclarationAnnotationAdapter daa = new CombinationIndexedDeclarationAnnotationAdapter( - "annot.JoinColumn", "annot.JoinColumns", "value", 2); - AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(), daa); - Annotation annotation = aa.getAnnotation(); - assertNotNull(annotation); - - aa.removeAnnotation(); - this.assertSourceContains(expected); - this.assertSourceDoesNotContain("JoinColumns"); - } - - public void testRemoveAnnotation13() throws Exception { - this.createAnnotationAndMembers("JoinColumn", "String name();"); - this.createAnnotationAndMembers("JoinColumns", "JoinColumn[] value();"); - this.createTestType("@annot.JoinColumns({null, @annot.JoinColumn(name=\"ADDRESS_ID1\")})"); - this.assertSourceContains("@annot.JoinColumn"); - DeclarationAnnotationAdapter daa = new CombinationIndexedDeclarationAnnotationAdapter( - "annot.JoinColumn", "annot.JoinColumns", "value", 1); - AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(), daa); - Annotation annotation = aa.getAnnotation(); - assertNotNull(annotation); - - aa.removeAnnotation(); - this.assertSourceDoesNotContain("JoinColumn"); - } - - public void testRemoveAnnotation14() throws Exception { - this.createAnnotationAndMembers("JoinColumn", "String name();"); - this.createAnnotationAndMembers("JoinColumns", "JoinColumn[] value();"); - this.createTestType("@annot.JoinColumns({@annot.JoinColumn(name=\"ADDRESS_ID0\"), null, @annot.JoinColumn(name=\"ADDRESS_ID2\"), null})"); - String expected = "@JoinColumn(name=\"ADDRESS_ID0\")"; - DeclarationAnnotationAdapter daa = new CombinationIndexedDeclarationAnnotationAdapter( - "annot.JoinColumn", "annot.JoinColumns", "value", 2); - AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(), daa); - Annotation annotation = aa.getAnnotation(); - assertNotNull(annotation); - - aa.removeAnnotation(); - this.assertSourceContains(expected); - } - - public void testRemoveAnnotation15() throws Exception { - this.createAnnotationAndMembers("JoinColumn", "String name();"); - this.createAnnotationAndMembers("JoinColumns", "JoinColumn[] value();"); - this.createTestType("@annot.JoinColumns({@annot.JoinColumn(name=\"ADDRESS_ID0\"), null, @annot.JoinColumn(name=\"ADDRESS_ID2\"), @annot.JoinColumn(name=\"ADDRESS_ID3\")})"); - String expected = "@annot.JoinColumns({@annot.JoinColumn(name=\"ADDRESS_ID0\"), null, null, @annot.JoinColumn(name=\"ADDRESS_ID3\")})"; - DeclarationAnnotationAdapter daa = new CombinationIndexedDeclarationAnnotationAdapter( - "annot.JoinColumn", "annot.JoinColumns", "value", 2); - AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(), daa); - Annotation annotation = aa.getAnnotation(); - assertNotNull(annotation); - - aa.removeAnnotation(); - this.assertSourceContains(expected); - } - - public void testRemoveAnnotation16() throws Exception { - this.createAnnotationAndMembers("JoinColumn", "String name();"); - this.createAnnotationAndMembers("JoinColumns", "JoinColumn[] value();"); - this.createTestType("@annot.JoinColumns({@annot.JoinColumn(name=\"ADDRESS_ID0\"), null, @annot.JoinColumn(name=\"ADDRESS_ID2\"), @annot.JoinColumn(name=\"ADDRESS_ID3\")})"); - String expected = "@annot.JoinColumns({@annot.JoinColumn(name=\"ADDRESS_ID0\"), null, @annot.JoinColumn(name=\"ADDRESS_ID2\")})"; - DeclarationAnnotationAdapter daa = new CombinationIndexedDeclarationAnnotationAdapter( - "annot.JoinColumn", "annot.JoinColumns", "value", 3); - AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(), daa); - Annotation annotation = aa.getAnnotation(); - assertNotNull(annotation); - - aa.removeAnnotation(); - this.assertSourceContains(expected); - } - - public void testRemoveAnnotation17() throws Exception { - this.createAnnotationAndMembers("JoinColumn", "String name();"); - this.createAnnotationAndMembers("JoinColumns", "JoinColumn[] value();"); - this.createTestType("@annot.JoinColumns({null, null, @annot.JoinColumn(name=\"ADDRESS_ID2\")})"); - this.assertSourceContains("@annot.JoinColumn"); - DeclarationAnnotationAdapter daa = new CombinationIndexedDeclarationAnnotationAdapter( - "annot.JoinColumn", "annot.JoinColumns", "value", 2); - AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(), daa); - Annotation annotation = aa.getAnnotation(); - assertNotNull(annotation); - - aa.removeAnnotation(); - this.assertSourceDoesNotContain("JoinColumn"); - } - - public void testNewMarkerAnnotation1() throws Exception { - this.createAnnotationAndMembers("JoinColumn", "String name();"); - this.createAnnotationAndMembers("JoinColumns", "JoinColumn[] columns();"); - this.createTestType(); - this.assertSourceDoesNotContain("JoinColumn"); - DeclarationAnnotationAdapter daa = new CombinationIndexedDeclarationAnnotationAdapter( - "annot.JoinColumn", "annot.JoinColumns", "columns", 0); - AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(), daa); - Annotation annotation = aa.getAnnotation(); - assertNull(annotation); - - aa.newMarkerAnnotation(); - this.assertSourceContains("JoinColumn"); - this.assertSourceDoesNotContain("JoinColumns"); - } - - public void testNewMarkerAnnotation2() throws Exception { - this.createAnnotationAndMembers("JoinColumn", "String name();"); - this.createAnnotationAndMembers("JoinColumns", "JoinColumn[] columns();"); - this.createTestType("@annot.JoinColumn"); - this.assertSourceDoesNotContain("JoinColumns"); - DeclarationAnnotationAdapter daa = new CombinationIndexedDeclarationAnnotationAdapter( - "annot.JoinColumn", "annot.JoinColumns", "columns", 1); - AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(), daa); - Annotation annotation = aa.getAnnotation(); - assertNull(annotation); - - aa.newMarkerAnnotation(); - this.assertSourceContains("@JoinColumns(columns={@JoinColumn,@JoinColumn})"); - } - - public void testNewMarkerAnnotation3() throws Exception { - this.createAnnotationAndMembers("JoinColumn", "String name();"); - this.createAnnotationAndMembers("JoinColumns", "JoinColumn[] columns();"); - this.createTestType("@annot.JoinColumns(columns={@annot.JoinColumn, @annot.JoinColumn})"); - DeclarationAnnotationAdapter daa = new CombinationIndexedDeclarationAnnotationAdapter( - "annot.JoinColumn", "annot.JoinColumns", "columns", 2); - AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(), daa); - Annotation annotation = aa.getAnnotation(); - assertNull(annotation); - - aa.newMarkerAnnotation(); - this.assertSourceContains("@annot.JoinColumns(columns={@annot.JoinColumn, @annot.JoinColumn," + CR + " @JoinColumn})"); - } - - public void testNewMarkerAnnotation4() throws Exception { - this.createAnnotationAndMembers("JoinColumn", "String name();"); - this.createAnnotationAndMembers("JoinColumns", "JoinColumn[] columns();"); - this.createTestType("@annot.JoinColumn(77)"); - DeclarationAnnotationAdapter daa = new CombinationIndexedDeclarationAnnotationAdapter( - "annot.JoinColumn", "annot.JoinColumns", "columns", 0); - AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(), daa); - Annotation annotation = aa.getAnnotation(); - assertNotNull(annotation); - - aa.newMarkerAnnotation(); - this.assertSourceContains("JoinColumn"); - this.assertSourceDoesNotContain("JoinColumns"); - this.assertSourceDoesNotContain("77"); - } - - public void testNewMarkerAnnotation5() throws Exception { - this.createAnnotationAndMembers("JoinColumn", "String name();"); - this.createAnnotationAndMembers("JoinColumns", "JoinColumn[] columns();"); - this.createTestType("@annot.JoinColumns(columns=@annot.JoinColumn(77))"); - DeclarationAnnotationAdapter daa = new CombinationIndexedDeclarationAnnotationAdapter( - "annot.JoinColumn", "annot.JoinColumns", "columns", 0); - AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(), daa); - Annotation annotation = aa.getAnnotation(); - assertNotNull(annotation); - - aa.newMarkerAnnotation(); - this.assertSourceContains("@annot.JoinColumns(columns=@JoinColumn)"); - this.assertSourceDoesNotContain("77"); - } - - public void testNewMarkerAnnotation6() throws Exception { - this.createAnnotationAndMembers("JoinColumn", "String name();"); - this.createAnnotationAndMembers("JoinColumns", "JoinColumn[] columns();"); - this.createTestType("@annot.JoinColumns(columns=@annot.JoinColumn(77))"); - DeclarationAnnotationAdapter daa = new CombinationIndexedDeclarationAnnotationAdapter( - "annot.JoinColumn", "annot.JoinColumns", "columns", 1); - AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(), daa); - Annotation annotation = aa.getAnnotation(); - assertNull(annotation); - - aa.newMarkerAnnotation(); - this.assertSourceContains("@annot.JoinColumns(columns={@annot.JoinColumn(77),@JoinColumn})"); - } - - public void testNewMarkerAnnotation7() throws Exception { - this.createAnnotationAndMembers("JoinColumn", "String name();"); - this.createAnnotationAndMembers("JoinColumns", "JoinColumn[] columns();"); - this.createTestType("@annot.JoinColumn(77)"); - DeclarationAnnotationAdapter daa = new CombinationIndexedDeclarationAnnotationAdapter( - "annot.JoinColumn", "annot.JoinColumns", "columns", 1); - AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(), daa); - Annotation annotation = aa.getAnnotation(); - assertNull(annotation); - - aa.newMarkerAnnotation(); - this.assertSourceContains("@JoinColumns(columns={@JoinColumn(77),@JoinColumn})"); - } - - public void testNewMarkerAnnotation8() throws Exception { - this.createAnnotationAndMembers("JoinColumn", "String name();"); - this.createAnnotationAndMembers("JoinColumns", "JoinColumn[] columns();"); - this.createTestType("@annot.JoinColumns(columns={@annot.JoinColumn(77),@annot.JoinColumn(88)})"); - DeclarationAnnotationAdapter daa = new CombinationIndexedDeclarationAnnotationAdapter( - "annot.JoinColumn", "annot.JoinColumns", "columns", 1); - AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(), daa); - Annotation annotation = aa.getAnnotation(); - assertNotNull(annotation); - - aa.newMarkerAnnotation(); - this.assertSourceContains("@annot.JoinColumns(columns={@annot.JoinColumn(77),@JoinColumn})"); - } - - public void testNewMarkerAnnotation9() throws Exception { - this.createAnnotationAndMembers("JoinColumn", "String name(); String text(); int num();"); - this.createAnnotationAndMembers("JoinColumns", "JoinColumn[] columns();"); - this.createTestType("@annot.JoinColumn(text=\"blah\",num=42)"); - DeclarationAnnotationAdapter daa = new CombinationIndexedDeclarationAnnotationAdapter( - "annot.JoinColumn", "annot.JoinColumns", "columns", 1); - AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(), daa); - Annotation annotation = aa.getAnnotation(); - assertNull(annotation); - - aa.newMarkerAnnotation(); - this.assertSourceContains("@JoinColumns(columns={@JoinColumn(text=\"blah\", num=42),@JoinColumn})"); - } - - public void testNewMarkerAnnotation23() throws Exception { - this.createAnnotationAndMembers("JoinColumn", "String name(); String text(); int num();"); - this.createAnnotationAndMembers("JoinColumns", "JoinColumn[] columns();"); - this.createTestType("@annot.JoinColumn(text=\"blah\",num=42)"); - String expected = "@JoinColumns(columns={@JoinColumn(text=\"blah\", num=42),null,@JoinColumn})"; - this.assertSourceDoesNotContain(expected); - DeclarationAnnotationAdapter daa = new CombinationIndexedDeclarationAnnotationAdapter( - "annot.JoinColumn", "annot.JoinColumns", "columns", 2); - AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(), daa); - aa.newMarkerAnnotation(); - this.assertSourceContains(expected); - } - - public void testNewMarkerAnnotation24() throws Exception { - this.createAnnotationAndMembers("JoinColumn", "String name(); String text(); int num();"); - this.createAnnotationAndMembers("JoinColumns", "JoinColumn[] value();"); - this.createTestType("@annot.JoinColumn(text=\"blah\",num=42)"); - String expected1 = "@JoinColumns({"; - String expected2 = "@JoinColumn(text=\"blah\", num=42),null,"; - String expected3 = "@JoinColumn})"; - this.assertSourceDoesNotContain(expected1); - this.assertSourceDoesNotContain(expected2); - this.assertSourceDoesNotContain(expected3); - DeclarationAnnotationAdapter daa = new CombinationIndexedDeclarationAnnotationAdapter( - "annot.JoinColumn", "annot.JoinColumns", "value", 2); - AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(), daa); - aa.newMarkerAnnotation(); - this.assertSourceContains(expected1); - this.assertSourceContains(expected2); - this.assertSourceContains(expected3); - } - - public void testNewMarkerAnnotation25() throws Exception { - this.createAnnotationAndMembers("JoinColumn", "String name();"); - this.createAnnotationAndMembers("JoinColumns", "JoinColumn[] columns();"); - this.createTestType("@annot.JoinColumns(columns={@annot.JoinColumn(name=\"ADDRESS_ID0\"), @annot.JoinColumn(name=\"ADDRESS_ID1\")})"); - String expected1 = "@annot.JoinColumns(columns={@annot.JoinColumn(name=\"ADDRESS_ID0\"), @annot.JoinColumn(name=\"ADDRESS_ID1\"), null, null,"; // the line gets split - String expected2 = "@JoinColumn})"; - this.assertSourceDoesNotContain(expected1); - this.assertSourceDoesNotContain(expected2); - DeclarationAnnotationAdapter daa = new CombinationIndexedDeclarationAnnotationAdapter( - "annot.JoinColumn", "annot.JoinColumns", "columns", 4); - AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(), daa); - aa.newMarkerAnnotation(); - this.assertSourceContains(expected1); - this.assertSourceContains(expected2); - } - - public void testNewMarkerAnnotation26() throws Exception { - this.createAnnotationAndMembers("JoinColumn", "String name();"); - this.createAnnotationAndMembers("JoinColumns", "JoinColumn[] value();"); - this.createTestType("@annot.JoinColumns({@annot.JoinColumn(name=\"ADDRESS_ID0\"), @annot.JoinColumn(name=\"ADDRESS_ID1\")})"); - String expected1 = "@annot.JoinColumns({@annot.JoinColumn(name=\"ADDRESS_ID0\"), @annot.JoinColumn(name=\"ADDRESS_ID1\"), null, null,"; // the line gets split - String expected2 = "@JoinColumn})"; - this.assertSourceDoesNotContain(expected1); - this.assertSourceDoesNotContain(expected2); - DeclarationAnnotationAdapter daa = new CombinationIndexedDeclarationAnnotationAdapter( - "annot.JoinColumn", "annot.JoinColumns", "value", 4); - AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(), daa); - aa.newMarkerAnnotation(); - this.assertSourceContains(expected1); - this.assertSourceContains(expected2); - } - - public void testMoveAnnotation1() throws Exception { - this.createAnnotationAndMembers("JoinColumn", "String name();"); - this.createAnnotationAndMembers("JoinColumns", "JoinColumn[] columns();"); - this.createTestType("@annot.JoinColumn(name=\"ADDRESS_ID0\")"); - String expected = "@JoinColumns(columns={null,@JoinColumn(name=\"ADDRESS_ID0\")})"; - this.assertSourceDoesNotContain(expected); - IndexedDeclarationAnnotationAdapter cidaa = new CombinationIndexedDeclarationAnnotationAdapter( - "annot.JoinColumn", "annot.JoinColumns", "columns", 0); - IndexedAnnotationAdapter iaa = new MemberIndexedAnnotationAdapter(this.idField(), cidaa); - Annotation annotation = iaa.getAnnotation(); - assertNotNull(annotation); - - iaa.moveAnnotation(1); - this.assertSourceContains(expected); - } - - public void testMoveAnnotation2() throws Exception { - this.createAnnotationAndMembers("JoinColumn", "String name();"); - this.createAnnotationAndMembers("JoinColumns", "JoinColumn[] columns();"); - this.createTestType("@annot.JoinColumns(columns={null,@annot.JoinColumn(name=\"ADDRESS_ID1\")})"); - String expected = "@JoinColumn(name=\"ADDRESS_ID1\")"; - IndexedDeclarationAnnotationAdapter cidaa = new CombinationIndexedDeclarationAnnotationAdapter( - "annot.JoinColumn", "annot.JoinColumns", "columns", 1); - IndexedAnnotationAdapter iaa = new MemberIndexedAnnotationAdapter(this.idField(), cidaa); - Annotation annotation = iaa.getAnnotation(); - assertNotNull(annotation); - - iaa.moveAnnotation(0); - this.assertSourceContains(expected); - this.assertSourceDoesNotContain("JoinColumns"); - } - - public void testMoveAnnotation2a() throws Exception { - this.createAnnotationAndMembers("JoinColumn", "String name();"); - this.createAnnotationAndMembers("JoinColumns", "JoinColumn[] value();"); - this.createTestType("@annot.JoinColumns({null,@annot.JoinColumn(name=\"ADDRESS_ID1\")})"); - String expected = "@JoinColumn(name=\"ADDRESS_ID1\")"; - IndexedDeclarationAnnotationAdapter cidaa = new CombinationIndexedDeclarationAnnotationAdapter( - "annot.JoinColumn", "annot.JoinColumns", "value", 1); - IndexedAnnotationAdapter iaa = new MemberIndexedAnnotationAdapter(this.idField(), cidaa); - Annotation annotation = iaa.getAnnotation(); - assertNotNull(annotation); - - iaa.moveAnnotation(0); - this.assertSourceContains(expected); - this.assertSourceDoesNotContain("JoinColumns"); - } - - public void testMoveAnnotation3() throws Exception { - this.createAnnotationAndMembers("JoinColumn", "String name();"); - this.createAnnotationAndMembers("JoinColumns", "JoinColumn[] columns();"); - this.createTestType("@annot.JoinColumns(columns={@annot.JoinColumn(name=\"ADDRESS_ID0\"), @annot.JoinColumn(name=\"ADDRESS_ID1\"), @annot.JoinColumn(name=\"ADDRESS_ID2\"), @annot.JoinColumn(name=\"ADDRESS_ID3\")})"); - String expected = "@annot.JoinColumns(columns={@annot.JoinColumn(name=\"ADDRESS_ID3\"), @annot.JoinColumn(name=\"ADDRESS_ID1\"), @annot.JoinColumn(name=\"ADDRESS_ID2\")})"; - this.assertSourceDoesNotContain(expected); - IndexedDeclarationAnnotationAdapter cidaa = new CombinationIndexedDeclarationAnnotationAdapter( - "annot.JoinColumn", "annot.JoinColumns", "columns", 3); - IndexedAnnotationAdapter iaa = new MemberIndexedAnnotationAdapter(this.idField(), cidaa); - Annotation annotation = iaa.getAnnotation(); - assertNotNull(annotation); - - iaa.moveAnnotation(0); - this.assertSourceContains(expected); - } - - public void testMoveAnnotation4() throws Exception { - this.createAnnotationAndMembers("JoinColumn", "String name();"); - this.createAnnotationAndMembers("JoinColumns", "JoinColumn[] columns();"); - this.createTestType("@annot.JoinColumns(columns={@annot.JoinColumn(name=\"ADDRESS_ID0\"), @annot.JoinColumn(name=\"ADDRESS_ID1\"), @annot.JoinColumn(name=\"ADDRESS_ID2\"), @annot.JoinColumn(name=\"ADDRESS_ID3\"), @annot.JoinColumn(name=\"ADDRESS_ID4\")})"); - String expected = "@annot.JoinColumns(columns={@annot.JoinColumn(name=\"ADDRESS_ID3\"), @annot.JoinColumn(name=\"ADDRESS_ID1\"), @annot.JoinColumn(name=\"ADDRESS_ID2\"), null, @annot.JoinColumn(name=\"ADDRESS_ID4\")})"; - this.assertSourceDoesNotContain(expected); - IndexedDeclarationAnnotationAdapter cidaa = new CombinationIndexedDeclarationAnnotationAdapter( - "annot.JoinColumn", "annot.JoinColumns", "columns", 3); - IndexedAnnotationAdapter iaa = new MemberIndexedAnnotationAdapter(this.idField(), cidaa); - Annotation annotation = iaa.getAnnotation(); - assertNotNull(annotation); - - iaa.moveAnnotation(0); - this.assertSourceContains(expected); - } - - public void testMoveAnnotation5() throws Exception { - this.createAnnotationAndMembers("JoinColumn", "String name();"); - this.createAnnotationAndMembers("JoinColumns", "JoinColumn[] columns();"); - this.createTestType("@annot.JoinColumns(columns={@annot.JoinColumn(name=\"ADDRESS_ID0\"), @annot.JoinColumn(name=\"ADDRESS_ID1\"), @annot.JoinColumn(name=\"ADDRESS_ID2\")})"); - String expected = "@annot.JoinColumns(columns={@annot.JoinColumn(name=\"ADDRESS_ID0\"), @annot.JoinColumn(name=\"ADDRESS_ID1\"), null, @annot.JoinColumn(name=\"ADDRESS_ID2\")})"; - this.assertSourceDoesNotContain(expected); - IndexedDeclarationAnnotationAdapter cidaa = new CombinationIndexedDeclarationAnnotationAdapter( - "annot.JoinColumn", "annot.JoinColumns", "columns", 2); - IndexedAnnotationAdapter iaa = new MemberIndexedAnnotationAdapter(this.idField(), cidaa); - Annotation annotation = iaa.getAnnotation(); - assertNotNull(annotation); - - iaa.moveAnnotation(3); - this.assertSourceContains(expected); - } - - public void testMoveAnnotation6() throws Exception { - this.createAnnotationAndMembers("JoinColumn", "String name();"); - this.createAnnotationAndMembers("JoinColumns", "JoinColumn[] columns();"); - this.createTestType("@annot.JoinColumns(columns={@annot.JoinColumn(name=\"ADDRESS_ID0\"), @annot.JoinColumn(name=\"ADDRESS_ID1\"), @annot.JoinColumn(name=\"ADDRESS_ID2\")})"); - String expected = "@annot.JoinColumns(columns={null, @annot.JoinColumn(name=\"ADDRESS_ID1\"), @annot.JoinColumn(name=\"ADDRESS_ID2\"), @annot.JoinColumn(name=\"ADDRESS_ID0\")})"; - this.assertSourceDoesNotContain(expected); - IndexedDeclarationAnnotationAdapter cidaa = new CombinationIndexedDeclarationAnnotationAdapter( - "annot.JoinColumn", "annot.JoinColumns", "columns", 0); - IndexedAnnotationAdapter iaa = new MemberIndexedAnnotationAdapter(this.idField(), cidaa); - Annotation annotation = iaa.getAnnotation(); - assertNotNull(annotation); - - iaa.moveAnnotation(3); - this.assertSourceContains(expected); - } - - public void testMoveAnnotation7() throws Exception { - this.createAnnotationAndMembers("JoinColumn", "String name();"); - this.createAnnotationAndMembers("JoinColumns", "JoinColumn[] columns();"); - this.createTestType("@annot.JoinColumns(columns={@annot.JoinColumn(name=\"ADDRESS_ID0\"), @annot.JoinColumn(name=\"ADDRESS_ID1\"), @annot.JoinColumn(name=\"ADDRESS_ID2\")})"); - String expected = "@annot.JoinColumns(columns={null, @annot.JoinColumn(name=\"ADDRESS_ID1\"), @annot.JoinColumn(name=\"ADDRESS_ID2\")})"; - this.assertSourceDoesNotContain(expected); - IndexedDeclarationAnnotationAdapter cidaa = new CombinationIndexedDeclarationAnnotationAdapter( - "annot.JoinColumn", "annot.JoinColumns", "columns", 3); - IndexedAnnotationAdapter iaa = new MemberIndexedAnnotationAdapter(this.idField(), cidaa); - Annotation annotation = iaa.getAnnotation(); - assertNull(annotation); - - iaa.moveAnnotation(0); - this.assertSourceContains(expected); - } - - public void testMoveAnnotation8() throws Exception { - this.createAnnotationAndMembers("JoinColumn", "String name();"); - this.createAnnotationAndMembers("JoinColumns", "JoinColumn[] columns();"); - this.createTestType("@annot.JoinColumns(columns={@annot.JoinColumn(name=\"ADDRESS_ID0\"), @annot.JoinColumn(name=\"ADDRESS_ID1\"), @annot.JoinColumn(name=\"ADDRESS_ID2\"), null, @annot.JoinColumn(name=\"ADDRESS_ID4\")})"); - String expected = "@annot.JoinColumns(columns={null, @annot.JoinColumn(name=\"ADDRESS_ID1\"), @annot.JoinColumn(name=\"ADDRESS_ID2\"), null, @annot.JoinColumn(name=\"ADDRESS_ID4\")})"; - this.assertSourceDoesNotContain(expected); - IndexedDeclarationAnnotationAdapter cidaa = new CombinationIndexedDeclarationAnnotationAdapter( - "annot.JoinColumn", "annot.JoinColumns", "columns", 3); - IndexedAnnotationAdapter iaa = new MemberIndexedAnnotationAdapter(this.idField(), cidaa); - Annotation annotation = iaa.getAnnotation(); - assertNull(annotation); - - iaa.moveAnnotation(0); - this.assertSourceContains(expected); - } - - public void testMoveAnnotation9() throws Exception { - this.createAnnotationAndMembers("JoinColumn", "String name();"); - this.createAnnotationAndMembers("JoinColumns", "JoinColumn[] columns();"); - String expected = "@annot.JoinColumns(columns={null, @annot.JoinColumn(name=\"ADDRESS_ID1\"), @annot.JoinColumn(name=\"ADDRESS_ID2\")})"; - this.createTestType(expected); // the source should be unchanged - IndexedDeclarationAnnotationAdapter cidaa = new CombinationIndexedDeclarationAnnotationAdapter( - "annot.JoinColumn", "annot.JoinColumns", "columns", 0); - IndexedAnnotationAdapter iaa = new MemberIndexedAnnotationAdapter(this.idField(), cidaa); - Annotation annotation = iaa.getAnnotation(); - assertNull(annotation); - - iaa.moveAnnotation(3); - this.assertSourceContains(expected); - } - - public void testMoveAnnotation10() throws Exception { - this.createAnnotationAndMembers("JoinColumn", "String name();"); - this.createAnnotationAndMembers("JoinColumns", "JoinColumn[] columns();"); - this.createTestType("@annot.JoinColumns(columns={@annot.JoinColumn(name=\"ADDRESS_ID0\"), @annot.JoinColumn(name=\"ADDRESS_ID1\")})"); - String expected = "@JoinColumn(name=\"ADDRESS_ID0\")"; - IndexedDeclarationAnnotationAdapter cidaa = new CombinationIndexedDeclarationAnnotationAdapter( - "annot.JoinColumn", "annot.JoinColumns", "columns", 2); - IndexedAnnotationAdapter iaa = new MemberIndexedAnnotationAdapter(this.idField(), cidaa); - Annotation annotation = iaa.getAnnotation(); - assertNull(annotation); - - iaa.moveAnnotation(1); - this.assertSourceContains(expected); - this.assertSourceDoesNotContain("@annot.JoinColumns"); - } - - public void testMoveAnnotation10a() throws Exception { - this.createAnnotationAndMembers("JoinColumn", "String name();"); - this.createAnnotationAndMembers("JoinColumns", "JoinColumn[] value();"); - this.createTestType("@annot.JoinColumns({@annot.JoinColumn(name=\"ADDRESS_ID0\"), @annot.JoinColumn(name=\"ADDRESS_ID1\")})"); - String expected = "@JoinColumn(name=\"ADDRESS_ID0\")"; - IndexedDeclarationAnnotationAdapter cidaa = new CombinationIndexedDeclarationAnnotationAdapter( - "annot.JoinColumn", "annot.JoinColumns", "value", 2); - IndexedAnnotationAdapter iaa = new MemberIndexedAnnotationAdapter(this.idField(), cidaa); - Annotation annotation = iaa.getAnnotation(); - assertNull(annotation); - - iaa.moveAnnotation(1); - this.assertSourceContains(expected); - this.assertSourceDoesNotContain("@annot.JoinColumns"); - } - - public void testMoveAnnotation11() throws Exception { - this.createAnnotationAndMembers("JoinColumn", "String name();"); - this.createAnnotationAndMembers("JoinColumns", "JoinColumn[] columns();"); - this.createTestType("@annot.JoinColumn(name=\"ADDRESS_ID0\")"); - IndexedDeclarationAnnotationAdapter cidaa = new CombinationIndexedDeclarationAnnotationAdapter( - "annot.JoinColumn", "annot.JoinColumns", "columns", 1); - IndexedAnnotationAdapter iaa = new MemberIndexedAnnotationAdapter(this.idField(), cidaa); - Annotation annotation = iaa.getAnnotation(); - assertNull(annotation); - - iaa.moveAnnotation(0); - this.assertSourceDoesNotContain("JoinColumn"); - } - - public void testMoveAnnotation12() throws Exception { - this.createAnnotationAndMembers("JoinColumn", "String name();"); - this.createAnnotationAndMembers("JoinColumns", "JoinColumn[] columns();"); - this.createTestType("@annot.JoinColumns(columns={@annot.JoinColumn(name=\"ADDRESS_ID0\"), null, @annot.JoinColumn(name=\"ADDRESS_ID2\")})"); - String expected = "@JoinColumn(name=\"ADDRESS_ID2\")"; - IndexedDeclarationAnnotationAdapter cidaa = new CombinationIndexedDeclarationAnnotationAdapter( - "annot.JoinColumn", "annot.JoinColumns", "columns", 2); - IndexedAnnotationAdapter iaa = new MemberIndexedAnnotationAdapter(this.idField(), cidaa); - Annotation annotation = iaa.getAnnotation(); - assertNotNull(annotation); - - iaa.moveAnnotation(0); - this.assertSourceContains(expected); - this.assertSourceDoesNotContain("@annot.JoinColumns"); - } - - public void testMoveAnnotation13() throws Exception { - this.createAnnotationAndMembers("JoinColumn", "String name();"); - this.createAnnotationAndMembers("JoinColumns", "JoinColumn[] columns();"); - this.createTestType("@annot.JoinColumns(columns={@annot.JoinColumn(name=\"ADDRESS_ID0\"), @annot.JoinColumn(name=\"ADDRESS_ID1\"), null, @annot.JoinColumn(name=\"ADDRESS_ID3\")})"); - String expected = "@annot.JoinColumns(columns={@annot.JoinColumn(name=\"ADDRESS_ID3\"), @annot.JoinColumn(name=\"ADDRESS_ID1\")})"; - IndexedDeclarationAnnotationAdapter cidaa = new CombinationIndexedDeclarationAnnotationAdapter( - "annot.JoinColumn", "annot.JoinColumns", "columns", 3); - IndexedAnnotationAdapter iaa = new MemberIndexedAnnotationAdapter(this.idField(), cidaa); - Annotation annotation = iaa.getAnnotation(); - assertNotNull(annotation); - - iaa.moveAnnotation(0); - this.assertSourceContains(expected); - } - -} diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/jdtutility/JDTToolsTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/jdtutility/JDTToolsTests.java deleted file mode 100644 index 079f2f59f6..0000000000 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/jdtutility/JDTToolsTests.java +++ /dev/null @@ -1,164 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2007 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.core.tests.internal.jdtutility; - -import org.eclipse.jdt.core.Signature; -import org.eclipse.jpt.core.internal.jdtutility.ConversionDeclarationAnnotationElementAdapter; -import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationAdapter; -import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationElementAdapter; -import org.eclipse.jpt.core.internal.jdtutility.FieldAttribute; -import org.eclipse.jpt.core.internal.jdtutility.JDTTools; -import org.eclipse.jpt.core.internal.jdtutility.SimpleDeclarationAnnotationAdapter; - -public class JDTToolsTests extends AnnotationTestCase { - - public JDTToolsTests(String name) { - super(name); - } - - public void testResolveSignature1() throws Exception { - this.verifyResolveSignature("String", "java.lang.String"); - } - - public void testResolveSignature2() throws Exception { - this.verifyResolveSignature("List", null); - } - - public void testResolveSignature3() throws Exception { - this.verifyResolveSignature("int", "int"); - } - - public void testResolveSignature4() throws Exception { - this.verifyResolveSignature("void", "void"); - } - - public void testResolveSignature5() throws Exception { - this.verifyResolveSignature("int[]", "int[]"); - } - - public void testResolveSignature6() throws Exception { - this.verifyResolveSignature("String[]", "java.lang.String[]"); - } - - public void testResolveSignature7() throws Exception { - this.verifyResolveSignature("java.util.List[][][]", "java.util.List[][][]"); - } - - public void testResolveSignature8a() throws Exception { - // inner class - this.verifyResolveSignature("java.util.Map.Entry", "java.util.Map.Entry"); - } - - public void testResolveSignature8b() throws Exception { - // inner class - this.createTestType("java.util.Map", ""); - this.verifyResolveSignature2("Map.Entry", "java.util.Map.Entry"); - } - - public void testResolveSignature8c() throws Exception { - // inner class - this.createTestType("java.util.Map.Entry", ""); - this.verifyResolveSignature2("Entry", "java.util.Map.Entry"); - } - - public void testResolveSignature9() throws Exception { - // inner class - this.verifyResolveSignature("Character.Subset", "java.lang.Character.Subset"); - } - - public void testResolveSignature10() throws Exception { - // generic type - this.verifyResolveSignature("java.util.List<java.lang.String>", "java.util.List"); // ???? - } - - public void testResolveSignature11() throws Exception { - // annotation - this.createTestType("java.lang.annotation.Target", ""); - this.verifyResolveSignature2("Target", "java.lang.annotation.Target"); - } - - public void testResolveSignature12() throws Exception { - this.createTestType("java.lang.annotation.ElementType", ""); - this.verifyResolveSignature2("ElementType", "java.lang.annotation.ElementType"); - } - - private void verifyResolveSignature(String unresolvedTypeName, String expected) throws Exception { - this.createTestType(); - this.verifyResolveSignature2(unresolvedTypeName, expected); - } - - private void verifyResolveSignature2(String unresolvedTypeName, String expected) throws Exception { - String signature = Signature.createTypeSignature(unresolvedTypeName, false); - String actual = JDTTools.resolveSignature(signature, this.jdtType()); - assertEquals(expected, actual); - } - - - private void createEnumAndMembers(String enumName, String enumBody) throws Exception { - this.javaProject.createType("enums", enumName + ".java", "public enum " + enumName + " { " + enumBody + " }"); - } - - private void createAnnotationAndMembers(String annotationName, String annotationBody) throws Exception { - this.javaProject.createType("annot", annotationName + ".java", "public @interface " + annotationName + " { " + annotationBody + " }"); - } - - public void testResolveEnum1() throws Exception { - this.createEnumAndMembers("TestEnum", "FOO, BAR, BAZ"); - this.createAnnotationAndMembers("TestAnnotation", "TestEnum foo();"); - - this.createTestType("@annot.TestAnnotation(foo=enums.TestEnum.BAZ)"); - DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.TestAnnotation"); - DeclarationAnnotationElementAdapter daea = new ConversionDeclarationAnnotationElementAdapter(daa, "foo"); - FieldAttribute field = this.idField(); - - String actual = JDTTools.resolveEnum(this.jdtType().getCompilationUnit(), field.annotationElementExpression(daea)); - assertEquals("enums.TestEnum.BAZ", actual); - } - - public void testResolveEnum2() throws Exception { - this.createEnumAndMembers("TestEnum", "FOO, BAR, BAZ"); - this.createAnnotationAndMembers("TestAnnotation", "TestEnum foo();"); - - this.createTestType("static enums.TestEnum.BAZ", "@annot.TestAnnotation(foo=BAZ)"); - DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.TestAnnotation"); - DeclarationAnnotationElementAdapter daea = new ConversionDeclarationAnnotationElementAdapter(daa, "foo"); - FieldAttribute field = this.idField(); - - String actual = JDTTools.resolveEnum(this.jdtType().getCompilationUnit(), field.annotationElementExpression(daea)); - assertEquals("enums.TestEnum.BAZ", actual); - } - - public void testResolveEnum3() throws Exception { - this.createEnumAndMembers("TestEnum", "FOO, BAR, BAZ"); - this.createAnnotationAndMembers("TestAnnotation", "TestEnum foo();"); - - this.createTestType("static enums.TestEnum.*", "@annot.TestAnnotation(foo=BAZ)"); - DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.TestAnnotation"); - DeclarationAnnotationElementAdapter daea = new ConversionDeclarationAnnotationElementAdapter(daa, "foo"); - FieldAttribute field = this.idField(); - - String actual = JDTTools.resolveEnum(this.jdtType().getCompilationUnit(), field.annotationElementExpression(daea)); - assertEquals("enums.TestEnum.BAZ", actual); - } - - public void testResolveEnum4() throws Exception { - this.createEnumAndMembers("TestEnum", "FOO, BAR, BAZ"); - this.createAnnotationAndMembers("TestAnnotation", "TestEnum foo();"); - - this.createTestType("enums.TestEnum", "@annot.TestAnnotation(foo=TestEnum.BAZ)"); - DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.TestAnnotation"); - DeclarationAnnotationElementAdapter daea = new ConversionDeclarationAnnotationElementAdapter(daa, "foo"); - FieldAttribute field = this.idField(); - - String actual = JDTTools.resolveEnum(this.jdtType().getCompilationUnit(), field.annotationElementExpression(daea)); - assertEquals("enums.TestEnum.BAZ", actual); - } - -} diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/jdtutility/JptCoreJdtUtilityTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/jdtutility/JptCoreJdtUtilityTests.java deleted file mode 100644 index a6a0fb6b52..0000000000 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/jdtutility/JptCoreJdtUtilityTests.java +++ /dev/null @@ -1,34 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2007 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.core.tests.internal.jdtutility; - -import junit.framework.Test; -import junit.framework.TestSuite; - -public class JptCoreJdtUtilityTests { - - public static Test suite() { - TestSuite suite = new TestSuite(JptCoreJdtUtilityTests.class.getName()); - suite.addTestSuite(MemberAnnotationElementAdapterTests.class); - suite.addTestSuite(CombinationIndexedDeclarationAnnotationAdapterTests.class); - suite.addTestSuite(JDTToolsTests.class); - suite.addTestSuite(NestedDeclarationAnnotationAdapterTests.class); - suite.addTestSuite(NestedIndexedDeclarationAnnotationAdapterTests.class); - suite.addTestSuite(SimpleDeclarationAnnotationAdapterTests.class); - suite.addTestSuite(TypeTests.class); - return suite; - } - - private JptCoreJdtUtilityTests() { - super(); - throw new UnsupportedOperationException(); - } - -} diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/jdtutility/MemberAnnotationElementAdapterTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/jdtutility/MemberAnnotationElementAdapterTests.java deleted file mode 100644 index 90ca36671b..0000000000 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/jdtutility/MemberAnnotationElementAdapterTests.java +++ /dev/null @@ -1,542 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2007 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.core.tests.internal.jdtutility; - -import org.eclipse.jpt.core.internal.ITextRange; -import org.eclipse.jpt.core.internal.jdtutility.ASTNodeTextRange; -import org.eclipse.jpt.core.internal.jdtutility.AnnotationElementAdapter; -import org.eclipse.jpt.core.internal.jdtutility.BooleanStringExpressionConverter; -import org.eclipse.jpt.core.internal.jdtutility.CharacterStringExpressionConverter; -import org.eclipse.jpt.core.internal.jdtutility.ConversionDeclarationAnnotationElementAdapter; -import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationAdapter; -import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationElementAdapter; -import org.eclipse.jpt.core.internal.jdtutility.EnumDeclarationAnnotationElementAdapter; -import org.eclipse.jpt.core.internal.jdtutility.MemberAnnotationElementAdapter; -import org.eclipse.jpt.core.internal.jdtutility.NestedDeclarationAnnotationAdapter; -import org.eclipse.jpt.core.internal.jdtutility.NestedIndexedDeclarationAnnotationAdapter; -import org.eclipse.jpt.core.internal.jdtutility.NumberStringExpressionConverter; -import org.eclipse.jpt.core.internal.jdtutility.PrimitiveTypeStringExpressionConverter; -import org.eclipse.jpt.core.internal.jdtutility.SimpleDeclarationAnnotationAdapter; -import org.eclipse.jpt.core.internal.jdtutility.SimpleTypeStringExpressionConverter; - -public class MemberAnnotationElementAdapterTests extends AnnotationTestCase { - - public MemberAnnotationElementAdapterTests(String name) { - super(name); - } - - private void createAnnotationAndMembers(String annotationName, String annotationBody) throws Exception { - this.javaProject.createType("annot", annotationName + ".java", "public @interface " + annotationName + " { " + annotationBody + " }"); - } - - private void createEnum(String enumName, String enumBody) throws Exception { - this.javaProject.createType("enums", enumName + ".java", "public enum " + enumName + " { " + enumBody + " }"); - } - - public void testGetValue1() throws Exception { - this.createAnnotationAndMembers("Foo", "String bar();"); - this.createTestType("@annot.Foo(bar=\"xxx\")"); - DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - DeclarationAnnotationElementAdapter daea = new ConversionDeclarationAnnotationElementAdapter(daa, "bar"); - AnnotationElementAdapter aea = new MemberAnnotationElementAdapter(this.idField(), daea); - assertEquals("xxx", aea.getValue()); - } - - public void testGetValue2() throws Exception { - this.createAnnotationAndMembers("Foo", "int bar();"); - this.createTestType("@annot.Foo(bar=48)"); - DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - DeclarationAnnotationElementAdapter daea = new ConversionDeclarationAnnotationElementAdapter(daa, "bar", NumberStringExpressionConverter.instance()); - AnnotationElementAdapter aea = new MemberAnnotationElementAdapter(this.idField(), daea); - assertEquals("48", aea.getValue()); - } - - public void testGetValue3() throws Exception { - this.createAnnotationAndMembers("Foo", "char bar();"); - this.createTestType("@annot.Foo(bar='c')"); - DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - DeclarationAnnotationElementAdapter daea = new ConversionDeclarationAnnotationElementAdapter(daa, "bar", CharacterStringExpressionConverter.instance()); - AnnotationElementAdapter aea = new MemberAnnotationElementAdapter(this.idField(), daea); - assertEquals("c", aea.getValue()); - } - - public void testGetValue4() throws Exception { - this.createAnnotationAndMembers("Foo", "boolean bar();"); - this.createTestType("@annot.Foo(bar=false)"); - DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - DeclarationAnnotationElementAdapter daea = new ConversionDeclarationAnnotationElementAdapter(daa, "bar", BooleanStringExpressionConverter.instance()); - AnnotationElementAdapter aea = new MemberAnnotationElementAdapter(this.idField(), daea); - assertEquals("false", aea.getValue()); - } - - public void testGetValue5() throws Exception { - this.createAnnotationAndMembers("Baz", "boolean fred();"); - this.createAnnotationAndMembers("Bar", "annot.Baz jimmy();"); - this.createAnnotationAndMembers("Foo", "annot.Bar value();"); - this.createTestType("@annot.Foo(@annot.Bar(jimmy=@annot.Baz(fred=false)))"); - DeclarationAnnotationAdapter daa1 = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - DeclarationAnnotationAdapter daa2 = new NestedDeclarationAnnotationAdapter(daa1, "value", "annot.Bar"); - DeclarationAnnotationAdapter daa3 = new NestedDeclarationAnnotationAdapter(daa2, "jimmy", "annot.Baz"); - DeclarationAnnotationElementAdapter daea = new ConversionDeclarationAnnotationElementAdapter(daa3, "fred", BooleanStringExpressionConverter.instance()); - AnnotationElementAdapter aea = new MemberAnnotationElementAdapter(this.idField(), daea); - assertEquals("false", aea.getValue()); - } - - public void testGetValue6() throws Exception { - this.createAnnotationAndMembers("Foo", "boolean value();"); - this.createTestType("@annot.Foo(false)"); - DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - DeclarationAnnotationElementAdapter daea = new ConversionDeclarationAnnotationElementAdapter(daa, BooleanStringExpressionConverter.instance()); - AnnotationElementAdapter aea = new MemberAnnotationElementAdapter(this.idField(), daea); - assertEquals("false", aea.getValue()); - } - - public void testGetValueNull1() throws Exception { - this.createAnnotationAndMembers("Foo", "String bar();"); - this.createTestType("@annot.Foo"); - DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - DeclarationAnnotationElementAdapter daea = new ConversionDeclarationAnnotationElementAdapter(daa, "bar"); - AnnotationElementAdapter aea = new MemberAnnotationElementAdapter(this.idField(), daea); - assertNull(aea.getValue()); - } - - public void testGetValueNull2() throws Exception { - this.createAnnotationAndMembers("Foo", "String bar();"); - this.createTestType(); - DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("Foo"); - DeclarationAnnotationElementAdapter daea = new ConversionDeclarationAnnotationElementAdapter(daa, "bar"); - AnnotationElementAdapter aea = new MemberAnnotationElementAdapter(this.idField(), daea); - assertNull(aea.getValue()); - } - - public void testGetValueNull3() throws Exception { - this.createAnnotationAndMembers("Baz", "String fred();"); - this.createAnnotationAndMembers("Bar", "annot.Baz jimmy();"); - this.createAnnotationAndMembers("Foo", "annot.Bar value();"); - this.createTestType("@annot.Foo(@annot.Bar(jimmy=@annot.Baz))"); - DeclarationAnnotationAdapter daa1 = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - DeclarationAnnotationAdapter daa2 = new NestedDeclarationAnnotationAdapter(daa1, "value", "annot.Bar"); - DeclarationAnnotationAdapter daa3 = new NestedDeclarationAnnotationAdapter(daa2, "jimmy", "annot.Baz"); - DeclarationAnnotationElementAdapter daea = new ConversionDeclarationAnnotationElementAdapter(daa3, "fred"); - AnnotationElementAdapter aea = new MemberAnnotationElementAdapter(this.idField(), daea); - assertNull(aea.getValue()); - } - - public void testASTNode1() throws Exception { - this.createAnnotationAndMembers("Foo", "String bar();"); - String value = "\"xxx\""; - String element = "bar=" + value; - String annotation = "@annot.Foo(" + element + ")"; - this.createTestType(annotation); - DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - DeclarationAnnotationElementAdapter daea = new ConversionDeclarationAnnotationElementAdapter(daa, "bar"); - AnnotationElementAdapter aea = new MemberAnnotationElementAdapter(this.idField(), daea); - - ITextRange textRange = new ASTNodeTextRange(aea.astNode()); - assertEquals(this.source().indexOf(value), textRange.getOffset()); - assertEquals(value.length(), textRange.getLength()); - assertEquals(7, textRange.getLineNumber()); - } - - public void testASTNode2() throws Exception { - this.createAnnotationAndMembers("Baz", "boolean fred();"); - this.createAnnotationAndMembers("Bar", "annot.Baz jimmy();"); - this.createAnnotationAndMembers("Foo", "annot.Bar value();"); - String value = "false"; - String element = "fred=" + value; - String annotation = "@annot.Foo(@annot.Bar(jimmy=@annot.Baz(" + element + ")))"; - this.createTestType(annotation); - DeclarationAnnotationAdapter daa1 = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - DeclarationAnnotationAdapter daa2 = new NestedDeclarationAnnotationAdapter(daa1, "value", "annot.Bar"); - DeclarationAnnotationAdapter daa3 = new NestedDeclarationAnnotationAdapter(daa2, "jimmy", "annot.Baz"); - DeclarationAnnotationElementAdapter daea = new ConversionDeclarationAnnotationElementAdapter(daa3, "fred", BooleanStringExpressionConverter.instance()); - AnnotationElementAdapter aea = new MemberAnnotationElementAdapter(this.idField(), daea); - assertEquals("false", aea.getValue()); - ITextRange textRange = new ASTNodeTextRange(aea.astNode()); - assertEquals(value.length(), textRange.getLength()); - } - - public void testASTNode3() throws Exception { - this.createAnnotationAndMembers("Foo", "String value();"); - String element = "\"xxx\""; - String annotation = "@annot.Foo(" + element + ")"; - this.createTestType(annotation); - DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - DeclarationAnnotationElementAdapter daea = new ConversionDeclarationAnnotationElementAdapter(daa); - AnnotationElementAdapter aea = new MemberAnnotationElementAdapter(this.idField(), daea); - - ITextRange textRange = new ASTNodeTextRange(aea.astNode()); - assertEquals(this.source().indexOf(element), textRange.getOffset()); - assertEquals(element.length(), textRange.getLength()); - } - - public void testASTNode4() throws Exception { - this.createAnnotationAndMembers("Foo", "String value();"); - String annotation = "@annot.Foo"; - this.createTestType(annotation); - DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - DeclarationAnnotationElementAdapter daea = new ConversionDeclarationAnnotationElementAdapter(daa); - AnnotationElementAdapter aea = new MemberAnnotationElementAdapter(this.idField(), daea); - - ITextRange textRange = new ASTNodeTextRange(aea.astNode()); - assertEquals(this.source().indexOf(annotation), textRange.getOffset()); - assertEquals(annotation.length(), textRange.getLength()); - } - - public void testSetValue1() throws Exception { - this.createAnnotationAndMembers("Foo", "String bar();"); - String annotation = "@annot.Foo(bar=\"xxx\")"; - this.createTestType(annotation); - this.assertSourceContains(annotation); - DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - DeclarationAnnotationElementAdapter daea = new ConversionDeclarationAnnotationElementAdapter(daa, "bar"); - AnnotationElementAdapter aea = new MemberAnnotationElementAdapter(this.idField(), daea); - - aea.setValue(null); - this.assertSourceDoesNotContain("Foo"); - } - - public void testSetValue2() throws Exception { - this.createAnnotationAndMembers("Foo", "String bar();"); - String annotation = "@annot.Foo(bar=\"xxx\")"; - this.createTestType(annotation); - this.assertSourceContains(annotation); - DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - DeclarationAnnotationElementAdapter daea = new ConversionDeclarationAnnotationElementAdapter(daa, "bar", false); - AnnotationElementAdapter aea = new MemberAnnotationElementAdapter(this.idField(), daea); - - aea.setValue(null); - this.assertSourceDoesNotContain(annotation); - this.assertSourceContains("@Foo"); - } - - public void testSetValue3() throws Exception { - this.createAnnotationAndMembers("Baz", "boolean fred();"); - this.createAnnotationAndMembers("Bar", "annot.Baz jimmy();"); - this.createAnnotationAndMembers("Foo", "annot.Bar value();"); - String annotation = "@annot.Foo(@annot.Bar(jimmy=@annot.Baz(fred=false)))"; - this.createTestType(annotation); - this.assertSourceContains(annotation); - DeclarationAnnotationAdapter daa1 = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - DeclarationAnnotationAdapter daa2 = new NestedDeclarationAnnotationAdapter(daa1, "value", "annot.Bar"); - DeclarationAnnotationAdapter daa3 = new NestedDeclarationAnnotationAdapter(daa2, "jimmy", "annot.Baz"); - DeclarationAnnotationElementAdapter daea = new ConversionDeclarationAnnotationElementAdapter(daa3, "fred", BooleanStringExpressionConverter.instance()); - AnnotationElementAdapter aea = new MemberAnnotationElementAdapter(this.idField(), daea); - - aea.setValue(null); - this.assertSourceDoesNotContain(annotation); - this.assertSourceDoesNotContain("Foo"); - this.assertSourceDoesNotContain("Bar"); - } - - public void testSetValue3a() throws Exception { - this.createAnnotationAndMembers("Baz", "boolean fred();"); - this.createAnnotationAndMembers("Bar", "annot.Baz jimmy();"); - this.createAnnotationAndMembers("Foo", "annot.Bar value();"); - String annotation = "@annot.Foo(@annot.Bar(jimmy=@annot.Baz(fred=false)))"; - this.createTestType(annotation); - this.assertSourceContains(annotation); - DeclarationAnnotationAdapter daa1 = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - DeclarationAnnotationAdapter daa2 = new NestedDeclarationAnnotationAdapter(daa1, "value", "annot.Bar", false); - DeclarationAnnotationAdapter daa3 = new NestedDeclarationAnnotationAdapter(daa2, "jimmy", "annot.Baz", false); - DeclarationAnnotationElementAdapter daea = new ConversionDeclarationAnnotationElementAdapter(daa3, "fred", BooleanStringExpressionConverter.instance()); - AnnotationElementAdapter aea = new MemberAnnotationElementAdapter(this.idField(), daea); - - aea.setValue(null); - this.assertSourceDoesNotContain(annotation); - this.assertSourceContains("@annot.Foo(@Bar)"); - } - - public void testSetValue4() throws Exception { - this.createAnnotationAndMembers("Foo", "String bar();"); - this.createTestType(); - DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("Foo"); - DeclarationAnnotationElementAdapter daea = new ConversionDeclarationAnnotationElementAdapter(daa, "bar"); - AnnotationElementAdapter aea = new MemberAnnotationElementAdapter(this.idField(), daea); - - aea.setValue("xxx"); - this.assertSourceContains("@Foo(bar=\"xxx\")"); - } - - public void testSetValue5() throws Exception { - this.createAnnotationAndMembers("Baz", "boolean fred();"); - this.createAnnotationAndMembers("Bar", "annot.Baz jimmy();"); - this.createAnnotationAndMembers("Foo", "annot.Bar value();"); - String annotation = "@annot.Foo(@annot.Bar(jimmy=@annot.Baz(fred=false)))"; - this.createTestType(annotation); - this.assertSourceContains(annotation); - DeclarationAnnotationAdapter daa1 = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - DeclarationAnnotationAdapter daa2 = new NestedDeclarationAnnotationAdapter(daa1, "value", "annot.Bar"); - DeclarationAnnotationAdapter daa3 = new NestedDeclarationAnnotationAdapter(daa2, "jimmy", "annot.Baz"); - DeclarationAnnotationElementAdapter daea = new ConversionDeclarationAnnotationElementAdapter(daa3, "fred", BooleanStringExpressionConverter.instance()); - AnnotationElementAdapter aea = new MemberAnnotationElementAdapter(this.idField(), daea); - - aea.setValue("true"); - this.assertSourceDoesNotContain(annotation); - this.assertSourceContains("@annot.Foo(@annot.Bar(jimmy=@annot.Baz(fred=true)))"); - } - - public void testSetValue6() throws Exception { - this.createAnnotationAndMembers("Baz", "boolean fred();"); - this.createAnnotationAndMembers("Bar", "annot.Baz jimmy();"); - this.createAnnotationAndMembers("Foo", "annot.Bar value();"); - this.createTestType(); - DeclarationAnnotationAdapter daa1 = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - DeclarationAnnotationAdapter daa2 = new NestedDeclarationAnnotationAdapter(daa1, "value", "annot.Bar"); - DeclarationAnnotationAdapter daa3 = new NestedDeclarationAnnotationAdapter(daa2, "jimmy", "annot.Baz"); - DeclarationAnnotationElementAdapter daea = new ConversionDeclarationAnnotationElementAdapter(daa3, "fred", BooleanStringExpressionConverter.instance()); - AnnotationElementAdapter aea = new MemberAnnotationElementAdapter(this.idField(), daea); - - aea.setValue("true"); - this.assertSourceContains("@Foo(@Bar(jimmy=@Baz(fred=true)))"); - } - - public void testSetValue7() throws Exception { - this.createAnnotationAndMembers("Foo", "String bar();"); - String annotation = "@annot.Foo(bar=\"xxx\")"; - this.createTestType(annotation); - this.assertSourceContains(annotation); - DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - DeclarationAnnotationElementAdapter daea = new ConversionDeclarationAnnotationElementAdapter(daa, "bar"); - AnnotationElementAdapter aea = new MemberAnnotationElementAdapter(this.idField(), daea); - - aea.setValue("yyy"); - this.assertSourceDoesNotContain(annotation); - this.assertSourceContains("@annot.Foo(bar=\"yyy\")"); - } - - public void testSetValue8() throws Exception { - this.createAnnotationAndMembers("Foo", "String bar();"); - String annotation = "@annot.Foo"; - this.createTestType(annotation); - this.assertSourceContains(annotation); - DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - DeclarationAnnotationElementAdapter daea = new ConversionDeclarationAnnotationElementAdapter(daa, "bar"); - AnnotationElementAdapter aea = new MemberAnnotationElementAdapter(this.idField(), daea); - - aea.setValue("xxx"); - this.assertSourceContains("@Foo(bar=\"xxx\")"); - } - - public void testSetValue9() throws Exception { - this.createAnnotationAndMembers("Foo", "String value(); String bar();"); - String annotation = "@annot.Foo(\"zzz\")"; - this.createTestType(annotation); - this.assertSourceContains(annotation); - DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - DeclarationAnnotationElementAdapter daea = new ConversionDeclarationAnnotationElementAdapter(daa, "bar"); - AnnotationElementAdapter aea = new MemberAnnotationElementAdapter(this.idField(), daea); - - aea.setValue("xxx"); - this.assertSourceDoesNotContain(annotation); - this.assertSourceContains("@Foo(value=\"zzz\", bar=\"xxx\")"); - } - - public void testSetValue10() throws Exception { - this.createAnnotationAndMembers("Foo", "String bar(); String baz();"); - String annotation = "@annot.Foo(bar=\"xxx\")"; - this.createTestType(annotation); - this.assertSourceContains(annotation); - DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - DeclarationAnnotationElementAdapter daea = new ConversionDeclarationAnnotationElementAdapter(daa, "baz"); - AnnotationElementAdapter aea = new MemberAnnotationElementAdapter(this.idField(), daea); - - aea.setValue("yyy"); - this.assertSourceDoesNotContain(annotation); - this.assertSourceContains("@annot.Foo(bar=\"xxx\", baz = \"yyy\")"); - } - - public void testSetValue11() throws Exception { - this.createAnnotationAndMembers("Baz", "int fred();"); - this.createAnnotationAndMembers("Bar", "annot.Baz[] jimmy();"); - this.createAnnotationAndMembers("Foo", "annot.Bar value();"); - String annotation = "@annot.Foo(@annot.Bar(jimmy={@annot.Baz(fred=0), @annot.Baz(fred=1), @annot.Baz(fred=2), @annot.Baz(fred=3)}))"; - this.createTestType(annotation); - this.assertSourceContains(annotation); - DeclarationAnnotationAdapter daa1 = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - DeclarationAnnotationAdapter daa2 = new NestedDeclarationAnnotationAdapter(daa1, "value", "annot.Bar"); - DeclarationAnnotationAdapter daa3 = new NestedIndexedDeclarationAnnotationAdapter(daa2, "jimmy", 2, "annot.Baz"); - DeclarationAnnotationElementAdapter daea = new ConversionDeclarationAnnotationElementAdapter(daa3, "fred", NumberStringExpressionConverter.instance()); - AnnotationElementAdapter aea = new MemberAnnotationElementAdapter(this.idField(), daea); - - assertEquals("2", aea.getValue()); - aea.setValue("48"); - this.assertSourceContains("@annot.Foo(@annot.Bar(jimmy={@annot.Baz(fred=0), @annot.Baz(fred=1), @annot.Baz(fred=48), @annot.Baz(fred=3)}))"); - } - - public void testSetValue12() throws Exception { - this.createAnnotationAndMembers("Foo", "String value();"); - String annotation = "@annot.Foo"; - this.createTestType(annotation); - this.assertSourceContains(annotation); - DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - DeclarationAnnotationElementAdapter daea = new ConversionDeclarationAnnotationElementAdapter(daa, "value"); - AnnotationElementAdapter aea = new MemberAnnotationElementAdapter(this.idField(), daea); - - aea.setValue("xxx"); - this.assertSourceContains("@Foo(\"xxx\")"); - } - - public void testSetValue13() throws Exception { - this.createAnnotationAndMembers("Foo", "String value();"); - String annotation = "@annot.Foo(\"zzz\")"; - this.createTestType(annotation); - this.assertSourceContains(annotation); - DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - DeclarationAnnotationElementAdapter daea = new ConversionDeclarationAnnotationElementAdapter(daa, "value"); - AnnotationElementAdapter aea = new MemberAnnotationElementAdapter(this.idField(), daea); - - aea.setValue("xxx"); - this.assertSourceDoesNotContain(annotation); - this.assertSourceContains("@annot.Foo(\"xxx\")"); - } - - public void testSimpleTypeLiteral1() throws Exception { - this.createAnnotationAndMembers("Foo", "Class bar();"); - this.createTestType("@annot.Foo(bar=java.lang.Object.class)"); - DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - DeclarationAnnotationElementAdapter daea = new ConversionDeclarationAnnotationElementAdapter(daa, "bar", SimpleTypeStringExpressionConverter.instance()); - AnnotationElementAdapter aea = new MemberAnnotationElementAdapter(this.idField(), daea); - assertEquals("java.lang.Object", aea.getValue()); - } - - public void testSimpleTypeLiteral2() throws Exception { - this.createAnnotationAndMembers("Foo", "Class bar();"); - this.createTestType(); - DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - DeclarationAnnotationElementAdapter daea = new ConversionDeclarationAnnotationElementAdapter(daa, "bar", SimpleTypeStringExpressionConverter.instance()); - AnnotationElementAdapter aea = new MemberAnnotationElementAdapter(this.idField(), daea); - aea.setValue("java.lang.Object"); - this.assertSourceContains("@Foo(bar=java.lang.Object.class)"); - } - - public void testSimpleTypeLiteral3() throws Exception { - this.createAnnotationAndMembers("Foo", "Class bar();"); - this.createTestType("@annot.Foo(bar=int.class)"); - DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - DeclarationAnnotationElementAdapter daea = new ConversionDeclarationAnnotationElementAdapter(daa, "bar", SimpleTypeStringExpressionConverter.instance()); - AnnotationElementAdapter aea = new MemberAnnotationElementAdapter(this.idField(), daea); - assertNull(aea.getValue()); - } - - public void testSimpleTypeLiteral4() throws Exception { - this.createAnnotationAndMembers("Foo", "Class bar();"); - this.createTestType("@annot.Foo(bar=java.util.Map.Entry.class)"); - DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - DeclarationAnnotationElementAdapter daea = new ConversionDeclarationAnnotationElementAdapter(daa, "bar", SimpleTypeStringExpressionConverter.instance()); - AnnotationElementAdapter aea = new MemberAnnotationElementAdapter(this.idField(), daea); - assertEquals("java.util.Map.Entry", aea.getValue()); - } - - public void testPrimitiveTypeLiteral1() throws Exception { - this.createAnnotationAndMembers("Foo", "Class bar();"); - this.createTestType("@annot.Foo(bar=int.class)"); - DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - DeclarationAnnotationElementAdapter daea = new ConversionDeclarationAnnotationElementAdapter(daa, "bar", PrimitiveTypeStringExpressionConverter.instance()); - AnnotationElementAdapter aea = new MemberAnnotationElementAdapter(this.idField(), daea); - assertEquals("int", aea.getValue()); - } - - public void testPrimitiveTypeLiteral2() throws Exception { - this.createAnnotationAndMembers("Foo", "Class bar();"); - this.createTestType(); - DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - DeclarationAnnotationElementAdapter daea = new ConversionDeclarationAnnotationElementAdapter(daa, "bar", PrimitiveTypeStringExpressionConverter.instance()); - AnnotationElementAdapter aea = new MemberAnnotationElementAdapter(this.idField(), daea); - aea.setValue("int"); - this.assertSourceContains("@Foo(bar=int.class)"); - } - - public void testPrimitiveTypeLiteral3() throws Exception { - this.createAnnotationAndMembers("Foo", "Class bar();"); - this.createTestType("@annot.Foo(bar=java.lang.Object.class)"); - DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - DeclarationAnnotationElementAdapter daea = new ConversionDeclarationAnnotationElementAdapter(daa, "bar", PrimitiveTypeStringExpressionConverter.instance()); - AnnotationElementAdapter aea = new MemberAnnotationElementAdapter(this.idField(), daea); - assertNull(aea.getValue()); - } - - public void testPrimitiveTypeLiteral4() throws Exception { - this.createAnnotationAndMembers("Foo", "Class bar();"); - this.createTestType("@annot.Foo(bar=void.class)"); - DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - DeclarationAnnotationElementAdapter daea = new ConversionDeclarationAnnotationElementAdapter(daa, "bar", PrimitiveTypeStringExpressionConverter.instance()); - AnnotationElementAdapter aea = new MemberAnnotationElementAdapter(this.idField(), daea); - assertEquals("void", aea.getValue()); - } - - public void testGetValueEnum1() throws Exception { - this.createEnum("TestEnum", "XXX, YYY, ZZZ"); - this.createAnnotationAndMembers("Foo", "enums.TestEnum bar();"); - this.createTestType("@annot.Foo(bar=enums.TestEnum.XXX)"); - DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - DeclarationAnnotationElementAdapter daea = new EnumDeclarationAnnotationElementAdapter(daa, "bar"); - AnnotationElementAdapter aea = new MemberAnnotationElementAdapter(this.idField(), daea); - assertEquals("enums.TestEnum.XXX", aea.getValue()); - } - - public void testGetValueEnum2() throws Exception { - this.createEnum("TestEnum", "XXX, YYY, ZZZ"); - this.createAnnotationAndMembers("Foo", "enums.TestEnum bar();"); - this.createTestType("static enums.TestEnum.XXX", "@annot.Foo(bar=XXX)"); - DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - DeclarationAnnotationElementAdapter daea = new EnumDeclarationAnnotationElementAdapter(daa, "bar"); - AnnotationElementAdapter aea = new MemberAnnotationElementAdapter(this.idField(), daea); - assertEquals("enums.TestEnum.XXX", aea.getValue()); - } - - public void testGetValueEnum3() throws Exception { - this.createEnum("TestEnum", "XXX, YYY, ZZZ"); - this.createAnnotationAndMembers("Foo", "enums.TestEnum bar();"); - this.createTestType("@annot.Foo"); - DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - DeclarationAnnotationElementAdapter daea = new EnumDeclarationAnnotationElementAdapter(daa, "bar"); - AnnotationElementAdapter aea = new MemberAnnotationElementAdapter(this.idField(), daea); - assertNull(aea.getValue()); - } - - public void testGetValueEnum4() throws Exception { - this.createEnum("TestEnum", "XXX, YYY, ZZZ"); - this.createAnnotationAndMembers("Foo", "enums.TestEnum bar();"); - this.createTestType("enums.TestEnum", "@annot.Foo(bar=TestEnum.XXX)"); - DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - DeclarationAnnotationElementAdapter daea = new EnumDeclarationAnnotationElementAdapter(daa, "bar"); - AnnotationElementAdapter aea = new MemberAnnotationElementAdapter(this.idField(), daea); - assertEquals("enums.TestEnum.XXX", aea.getValue()); - } - - public void testSetValueEnum1() throws Exception { - this.createEnum("TestEnum", "XXX, YYY, ZZZ"); - this.createAnnotationAndMembers("Foo", "enums.TestEnum bar();"); - String annotation = "@annot.Foo(bar=XXX)"; - this.createTestType("static enums.TestEnum.XXX", annotation); - this.assertSourceContains(annotation); - DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - DeclarationAnnotationElementAdapter daea = new EnumDeclarationAnnotationElementAdapter(daa, "bar"); - AnnotationElementAdapter aea = new MemberAnnotationElementAdapter(this.idField(), daea); - aea.setValue(null); - this.assertSourceDoesNotContain("Foo"); - } - - public void testSetValueEnum2() throws Exception { - this.createEnum("TestEnum", "XXX, YYY, ZZZ"); - this.createAnnotationAndMembers("Foo", "enums.TestEnum bar();"); - String annotation = "@Foo(bar=XXX)"; - this.createTestType(); - this.assertSourceDoesNotContain(annotation); - DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - DeclarationAnnotationElementAdapter daea = new EnumDeclarationAnnotationElementAdapter(daa, "bar"); - AnnotationElementAdapter aea = new MemberAnnotationElementAdapter(this.idField(), daea); - aea.setValue("enums.TestEnum.XXX"); - this.assertSourceContains("import static enums.TestEnum.XXX;"); - this.assertSourceContains(annotation); - } - -} diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/jdtutility/NestedDeclarationAnnotationAdapterTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/jdtutility/NestedDeclarationAnnotationAdapterTests.java deleted file mode 100644 index e82d42c7c4..0000000000 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/jdtutility/NestedDeclarationAnnotationAdapterTests.java +++ /dev/null @@ -1,763 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2007 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.core.tests.internal.jdtutility; - -import org.eclipse.jdt.core.dom.Annotation; -import org.eclipse.jdt.core.dom.NormalAnnotation; -import org.eclipse.jdt.core.dom.SingleMemberAnnotation; -import org.eclipse.jdt.core.dom.StringLiteral; -import org.eclipse.jpt.core.internal.jdtutility.AnnotationAdapter; -import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationAdapter; -import org.eclipse.jpt.core.internal.jdtutility.Member; -import org.eclipse.jpt.core.internal.jdtutility.MemberAnnotationAdapter; -import org.eclipse.jpt.core.internal.jdtutility.ModifiedDeclaration; -import org.eclipse.jpt.core.internal.jdtutility.NestedDeclarationAnnotationAdapter; -import org.eclipse.jpt.core.internal.jdtutility.SimpleDeclarationAnnotationAdapter; - -public class NestedDeclarationAnnotationAdapterTests extends AnnotationTestCase { - - public NestedDeclarationAnnotationAdapterTests(String name) { - super(name); - } - - private void createAnnotationAndMembers(String annotationName, String annotationBody) throws Exception { - this.javaProject.createType("annot", annotationName + ".java", "public @interface " + annotationName + " { " + annotationBody + " }"); - } - - public void testGetAnnotation1() throws Exception { - this.createAnnotationAndMembers("Bar", "String value();"); - this.createAnnotationAndMembers("Foo", "annot.Bar nestedAnnotation();"); - this.createTestType("@annot.Foo(nestedAnnotation=@annot.Bar)"); - - DeclarationAnnotationAdapter daa = new NestedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotation", "annot.Bar"); - AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(), daa); - Annotation annotation = aa.getAnnotation(); - assertNotNull(annotation); - assertEquals("annot.Bar", annotation.getTypeName().getFullyQualifiedName()); - assertTrue(annotation.isMarkerAnnotation()); - } - - public void testGetAnnotation2() throws Exception { - this.createAnnotationAndMembers("Baz", "String value();"); - this.createAnnotationAndMembers("Bar", "annot.Baz yana();"); - this.createAnnotationAndMembers("Foo", "annot.Bar nestedAnnotation();"); - this.createTestType("@annot.Foo(nestedAnnotation=@annot.Bar(yana=@annot.Baz))"); - - DeclarationAnnotationAdapter daa1 = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - DeclarationAnnotationAdapter daa2 = new NestedDeclarationAnnotationAdapter(daa1, "nestedAnnotation", "annot.Bar"); - DeclarationAnnotationAdapter daa3 = new NestedDeclarationAnnotationAdapter(daa2, "yana", "annot.Baz"); - AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(), daa3); - Annotation annotation = aa.getAnnotation(); - assertNotNull(annotation); - assertEquals("annot.Baz", annotation.getTypeName().getFullyQualifiedName()); - assertTrue(annotation.isMarkerAnnotation()); - } - - public void testGetAnnotationNull1() throws Exception { - this.createAnnotationAndMembers("Bar", "String value();"); - this.createAnnotationAndMembers("Foo", "annot.Bar nestedAnnotation();"); - this.createTestType("@annot.Foo()"); - - DeclarationAnnotationAdapter daa = new NestedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotation", "annot.Bar"); - AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(), daa); - Annotation annotation = aa.getAnnotation(); - assertNull(annotation); - } - - public void testGetAnnotationNull2() throws Exception { - this.createAnnotationAndMembers("Bar", "String value();"); - this.createAnnotationAndMembers("Foo", "annot.Bar nestedAnnotation();"); - this.createTestType(); - - DeclarationAnnotationAdapter daa = new NestedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotation", "annot.Bar"); - AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(), daa); - Annotation annotation = aa.getAnnotation(); - assertNull(annotation); - } - - public void testGetAnnotationNull3() throws Exception { - this.createAnnotationAndMembers("Bar", "String value();"); - this.createAnnotationAndMembers("Foo", "String nestedAnnotation();"); - this.createTestType("@annot.Foo(nestedAnnotation=\"annot.Bar\")"); - - DeclarationAnnotationAdapter daa = new NestedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotation", "annot.Bar"); - AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(), daa); - Annotation annotation = aa.getAnnotation(); - assertNull(annotation); - } - - public void testGetAnnotationNull4() throws Exception { - this.createAnnotationAndMembers("Bar", "String value();"); - this.createAnnotationAndMembers("Bar2", "String value();"); - this.createAnnotationAndMembers("Foo", "annot.Bar2 nestedAnnotation();"); - this.createTestType("@annot.Foo(nestedAnnotation=@annot.Bar2)"); - - DeclarationAnnotationAdapter daa = new NestedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotation", "annot.Bar"); - AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(), daa); - Annotation annotation = aa.getAnnotation(); - assertNull(annotation); - } - - public void testRemoveAnnotation1() throws Exception { - this.createAnnotationAndMembers("Bar", "String value();"); - this.createAnnotationAndMembers("Foo", "annot.Bar nestedAnnotation();"); - String na = "@annot.Foo(nestedAnnotation=@annot.Bar)"; - this.createTestType(na); - this.assertSourceContains(na); - - DeclarationAnnotationAdapter daa = new NestedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotation", "annot.Bar"); - AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(), daa); - Annotation annotation = aa.getAnnotation(); - assertNotNull(annotation); - - aa.removeAnnotation(); - this.assertSourceDoesNotContain(na); - this.assertSourceDoesNotContain("Foo"); - } - - public void testRemoveAnnotation1a() throws Exception { - this.createAnnotationAndMembers("Bar", "String value();"); - this.createAnnotationAndMembers("Foo", "annot.Bar nestedAnnotation();"); - String na = "@annot.Foo(nestedAnnotation=@annot.Bar)"; - this.createTestType(na); - this.assertSourceContains(na); - - DeclarationAnnotationAdapter daa = new NestedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotation", "annot.Bar", false); - AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(), daa); - Annotation annotation = aa.getAnnotation(); - assertNotNull(annotation); - - aa.removeAnnotation(); - this.assertSourceDoesNotContain(na); - this.assertSourceContains("Foo"); - } - - public void testRemoveAnnotation2() throws Exception { - this.createAnnotationAndMembers("Bar", "String value();"); - this.createAnnotationAndMembers("Foo", "annot.Bar nestedAnnotation();"); - this.createTestType(); - this.assertSourceDoesNotContain("Foo"); - - DeclarationAnnotationAdapter daa = new NestedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotation", "annot.Bar"); - AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(), daa); - Annotation annotation = aa.getAnnotation(); - assertNull(annotation); - - aa.removeAnnotation(); - this.assertSourceDoesNotContain("Foo"); - } - - public void testRemoveAnnotation3() throws Exception { - this.createAnnotationAndMembers("Bar", "String value();"); - this.createAnnotationAndMembers("Foo", "String nestedAnnotation();"); - String na = "@annot.Foo(nestedAnnotation=\"annot.Bar\")"; - this.createTestType(na); - this.assertSourceContains(na); - - DeclarationAnnotationAdapter daa = new NestedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotation", "annot.Bar"); - AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(), daa); - Annotation annotation = aa.getAnnotation(); - assertNull(annotation); - - aa.removeAnnotation(); - this.assertSourceContains(na); - } - - public void testRemoveAnnotation4() throws Exception { - this.createAnnotationAndMembers("Bar", "String value();"); - this.createAnnotationAndMembers("Bar2", "String value();"); - this.createAnnotationAndMembers("Foo", "annot.Bar2 nestedAnnotation();"); - String na = "@annot.Foo(nestedAnnotation=@annot.Bar2)"; - this.createTestType(na); - this.assertSourceContains(na); - - DeclarationAnnotationAdapter daa = new NestedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotation", "annot.Bar"); - AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(), daa); - Annotation annotation = aa.getAnnotation(); - assertNull(annotation); - - aa.removeAnnotation(); - this.assertSourceContains(na); - } - - public void testRemoveAnnotation5() throws Exception { - this.createAnnotationAndMembers("Baz", "String value();"); - this.createAnnotationAndMembers("Bar", "annot.Baz nestedAnnotation2();"); - this.createAnnotationAndMembers("Foo", "annot.Bar nestedAnnotation1();"); - String na = "@annot.Foo(nestedAnnotation1=@annot.Bar(nestedAnnotation2=@annot.Baz))"; - this.createTestType(na); - this.assertSourceContains(na); - - DeclarationAnnotationAdapter daaFoo = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - DeclarationAnnotationAdapter daaBar = new NestedDeclarationAnnotationAdapter(daaFoo, "nestedAnnotation1", "annot.Bar"); - DeclarationAnnotationAdapter daa = new NestedDeclarationAnnotationAdapter(daaBar, "nestedAnnotation2", "annot.Baz"); - AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(), daa); - Annotation annotation = aa.getAnnotation(); - assertNotNull(annotation); - - aa.removeAnnotation(); - this.assertSourceDoesNotContain(na); - this.assertSourceDoesNotContain("Foo"); - this.assertSourceDoesNotContain("Bar"); - this.assertSourceDoesNotContain("Baz"); - } - - public void testRemoveAnnotation5a() throws Exception { - this.createAnnotationAndMembers("Baz", "String value();"); - this.createAnnotationAndMembers("Bar", "annot.Baz nestedAnnotation2();"); - this.createAnnotationAndMembers("Foo", "annot.Bar nestedAnnotation1();"); - String na = "@annot.Foo(nestedAnnotation1=@annot.Bar(nestedAnnotation2=@annot.Baz))"; - this.createTestType(na); - this.assertSourceContains(na); - - DeclarationAnnotationAdapter daaFoo = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - DeclarationAnnotationAdapter daaBar = new NestedDeclarationAnnotationAdapter(daaFoo, "nestedAnnotation1", "annot.Bar", false); - DeclarationAnnotationAdapter daa = new NestedDeclarationAnnotationAdapter(daaBar, "nestedAnnotation2", "annot.Baz", false); - AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(), daa); - Annotation annotation = aa.getAnnotation(); - assertNotNull(annotation); - - aa.removeAnnotation(); - this.assertSourceDoesNotContain(na); - this.assertSourceContains("@annot.Foo(nestedAnnotation1=@Bar)"); - } - - public void testNewMarkerAnnotation1() throws Exception { - this.createAnnotationAndMembers("Bar", "String value();"); - this.createAnnotationAndMembers("Foo", "annot.Bar nestedAnnotation();"); - this.createTestType(); - this.assertSourceDoesNotContain("Foo"); - - DeclarationAnnotationAdapter daa = new NestedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotation", "annot.Bar"); - AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(), daa); - Annotation annotation = aa.getAnnotation(); - assertNull(annotation); - - aa.newMarkerAnnotation(); - this.assertSourceContains("@Foo(nestedAnnotation=@Bar)"); - } - - public void testNewMarkerAnnotation2() throws Exception { - this.createAnnotationAndMembers("Bar", "String value();"); - this.createAnnotationAndMembers("Foo", "annot.Bar value();"); - this.createTestType(); - this.assertSourceDoesNotContain("Foo"); - - DeclarationAnnotationAdapter daa = new NestedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "value", "annot.Bar"); - AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(), daa); - Annotation annotation = aa.getAnnotation(); - assertNull(annotation); - - aa.newMarkerAnnotation(); - this.assertSourceContains("@Foo(@Bar)"); - } - - public void testNewMarkerAnnotation3() throws Exception { - this.createAnnotationAndMembers("Bar", "String value();"); - this.createAnnotationAndMembers("Foo", "annot.Bar nestedAnnotation();"); - this.createTestType("@annot.Foo"); - String expected = "@Foo(nestedAnnotation=@Bar)"; - this.assertSourceDoesNotContain(expected); - - DeclarationAnnotationAdapter daa = new NestedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotation", "annot.Bar"); - AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(), daa); - Annotation annotation = aa.getAnnotation(); - assertNull(annotation); - - aa.newMarkerAnnotation(); - this.assertSourceContains(expected); - } - - public void testNewMarkerAnnotation4() throws Exception { - this.createAnnotationAndMembers("Bar", "String value();"); - this.createAnnotationAndMembers("Foo", "annot.Bar value();"); - this.createTestType("@annot.Foo"); - String expected = "@Foo(@Bar)"; - this.assertSourceDoesNotContain(expected); - - DeclarationAnnotationAdapter daa = new NestedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "value", "annot.Bar"); - AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(), daa); - Annotation annotation = aa.getAnnotation(); - assertNull(annotation); - - aa.newMarkerAnnotation(); - this.assertSourceContains(expected); - } - - public void testNewMarkerAnnotation5() throws Exception { - this.createAnnotationAndMembers("Bar", "String value();"); - this.createAnnotationAndMembers("Foo", "annot.Bar nestedAnnotation(); String value();"); - this.createTestType("@annot.Foo(\"something\")"); - String expected = "@Foo(value=\"something\", nestedAnnotation=@Bar)"; - this.assertSourceDoesNotContain(expected); - - DeclarationAnnotationAdapter daa = new NestedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotation", "annot.Bar"); - AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(), daa); - Annotation annotation = aa.getAnnotation(); - assertNull(annotation); - - aa.newMarkerAnnotation(); - this.assertSourceContains(expected); - } - - public void testNewMarkerAnnotation6() throws Exception { - this.createAnnotationAndMembers("Bar", "String value();"); - this.createAnnotationAndMembers("Foo", "Object value();"); - this.createTestType("@annot.Foo(\"something\")"); - String expected = "@annot.Foo(@Bar)"; - this.assertSourceDoesNotContain(expected); - - DeclarationAnnotationAdapter daa = new NestedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "value", "annot.Bar"); - AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(), daa); - Annotation annotation = aa.getAnnotation(); - assertNull(annotation); - - aa.newMarkerAnnotation(); - this.assertSourceContains(expected); - } - - public void testNewMarkerAnnotation7() throws Exception { - this.createAnnotationAndMembers("Bar", "String value();"); - this.createAnnotationAndMembers("Foo", "String xxx(); annot.Bar nestedAnnotation();"); - this.createTestType("@annot.Foo(xxx=\"something\")"); - String expected = "@annot.Foo(xxx=\"something\", nestedAnnotation = @Bar)"; - this.assertSourceDoesNotContain(expected); - - DeclarationAnnotationAdapter daa = new NestedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotation", "annot.Bar"); - AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(), daa); - Annotation annotation = aa.getAnnotation(); - assertNull(annotation); - - aa.newMarkerAnnotation(); - this.assertSourceContains(expected); - } - - public void testNewMarkerAnnotation8() throws Exception { - this.createAnnotationAndMembers("Bar", "String value();"); - this.createAnnotationAndMembers("Foo", "String xxx(); annot.Bar value();"); - this.createTestType("@annot.Foo(xxx=\"something\")"); - String expected = "@annot.Foo(xxx=\"something\", value = @Bar)"; - this.assertSourceDoesNotContain(expected); - - DeclarationAnnotationAdapter daa = new NestedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "value", "annot.Bar"); - AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(), daa); - Annotation annotation = aa.getAnnotation(); - assertNull(annotation); - - aa.newMarkerAnnotation(); - this.assertSourceContains(expected); - } - - public void testNewSingleMemberAnnotation1() throws Exception { - this.createAnnotationAndMembers("Bar", "String value();"); - this.createAnnotationAndMembers("Foo", "annot.Bar nestedAnnotation();"); - this.createTestType(); - this.assertSourceDoesNotContain("Foo"); - this.idField().edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - NestedDeclarationAnnotationAdapterTests.this.editNewSingleMemberAnnotation1(declaration); - } - }); - this.assertSourceContains("@Foo(nestedAnnotation=@Bar(\"test string literal\"))"); - } - - void editNewSingleMemberAnnotation1(ModifiedDeclaration declaration) { - DeclarationAnnotationAdapter daa = new NestedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotation", "annot.Bar"); - SingleMemberAnnotation annotation = (SingleMemberAnnotation) daa.getAnnotation(declaration); - assertNull(annotation); - annotation = daa.newSingleMemberAnnotation(declaration); - StringLiteral stringLiteral = annotation.getAST().newStringLiteral(); - stringLiteral.setLiteralValue("test string literal"); - annotation.setValue(stringLiteral); - } - - public void testNewSingleMemberAnnotation2() throws Exception { - this.createAnnotationAndMembers("Bar", "String value();"); - this.createAnnotationAndMembers("Foo", "annot.Bar nestedAnnotation();"); - this.createTestType(); - this.assertSourceDoesNotContain("Foo"); - - DeclarationAnnotationAdapter daa = new NestedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "value", "annot.Bar"); - AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(), daa); - SingleMemberAnnotation annotation = (SingleMemberAnnotation) aa.getAnnotation(); - assertNull(annotation); - - this.idField().edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - NestedDeclarationAnnotationAdapterTests.this.editNewSingleMemberAnnotation2(declaration); - } - }); - this.assertSourceContains("@Foo(@Bar(\"test string literal\"))"); - } - - void editNewSingleMemberAnnotation2(ModifiedDeclaration declaration) { - DeclarationAnnotationAdapter daa = new NestedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "value", "annot.Bar"); - SingleMemberAnnotation annotation = (SingleMemberAnnotation) daa.getAnnotation(declaration); - assertNull(annotation); - annotation = daa.newSingleMemberAnnotation(declaration); - StringLiteral stringLiteral = annotation.getAST().newStringLiteral(); - stringLiteral.setLiteralValue("test string literal"); - annotation.setValue(stringLiteral); - } - - public void testNewSingleMemberAnnotation3() throws Exception { - this.createAnnotationAndMembers("Bar", "String value();"); - this.createAnnotationAndMembers("Foo", "annot.Bar nestedAnnotation();"); - this.createTestType("@annot.Foo"); - String expected = "@Foo(nestedAnnotation=@Bar(\"test string literal\"))"; - this.assertSourceDoesNotContain(expected); - this.idField().edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - NestedDeclarationAnnotationAdapterTests.this.editNewSingleMemberAnnotation3(declaration); - } - }); - this.assertSourceContains(expected); - } - - void editNewSingleMemberAnnotation3(ModifiedDeclaration declaration) { - DeclarationAnnotationAdapter daa = new NestedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotation", "annot.Bar"); - SingleMemberAnnotation annotation = (SingleMemberAnnotation) daa.getAnnotation(declaration); - assertNull(annotation); - annotation = daa.newSingleMemberAnnotation(declaration); - StringLiteral stringLiteral = annotation.getAST().newStringLiteral(); - stringLiteral.setLiteralValue("test string literal"); - annotation.setValue(stringLiteral); - } - - public void testNewSingleMemberAnnotation4() throws Exception { - this.createAnnotationAndMembers("Bar", "String value();"); - this.createAnnotationAndMembers("Foo", "annot.Bar value();"); - this.createTestType("@annot.Foo"); - String expected = "@Foo(@Bar(\"test string literal\"))"; - this.assertSourceDoesNotContain(expected); - this.idField().edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - NestedDeclarationAnnotationAdapterTests.this.editNewSingleMemberAnnotation4(declaration); - } - }); - this.assertSourceContains(expected); - } - - void editNewSingleMemberAnnotation4(ModifiedDeclaration declaration) { - DeclarationAnnotationAdapter daa = new NestedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "value", "annot.Bar"); - SingleMemberAnnotation annotation = (SingleMemberAnnotation) daa.getAnnotation(declaration); - assertNull(annotation); - annotation = daa.newSingleMemberAnnotation(declaration); - StringLiteral stringLiteral = annotation.getAST().newStringLiteral(); - stringLiteral.setLiteralValue("test string literal"); - annotation.setValue(stringLiteral); - } - - public void testNewSingleMemberAnnotation5() throws Exception { - this.createAnnotationAndMembers("Bar", "String value();"); - this.createAnnotationAndMembers("Foo", "annot.Bar nestedAnnotation(); String value();"); - this.createTestType("@annot.Foo(\"something\")"); - String expected = "@Foo(value=\"something\", nestedAnnotation=@Bar(\"test string literal\"))"; - this.assertSourceDoesNotContain(expected); - this.idField().edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - NestedDeclarationAnnotationAdapterTests.this.editNewSingleMemberAnnotation5(declaration); - } - }); - this.assertSourceContains(expected); - } - - void editNewSingleMemberAnnotation5(ModifiedDeclaration declaration) { - DeclarationAnnotationAdapter daa = new NestedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotation", "annot.Bar"); - SingleMemberAnnotation annotation = (SingleMemberAnnotation) daa.getAnnotation(declaration); - assertNull(annotation); - annotation = daa.newSingleMemberAnnotation(declaration); - StringLiteral stringLiteral = annotation.getAST().newStringLiteral(); - stringLiteral.setLiteralValue("test string literal"); - annotation.setValue(stringLiteral); - } - - public void testNewSingleMemberAnnotation6() throws Exception { - this.createAnnotationAndMembers("Bar", "String value();"); - this.createAnnotationAndMembers("Foo", "Object value();"); - this.createTestType("@annot.Foo(\"something\")"); - String expected = "@annot.Foo(@Bar(\"test string literal\"))"; - this.assertSourceDoesNotContain(expected); - this.idField().edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - NestedDeclarationAnnotationAdapterTests.this.editNewSingleMemberAnnotation6(declaration); - } - }); - this.assertSourceContains(expected); - } - - void editNewSingleMemberAnnotation6(ModifiedDeclaration declaration) { - DeclarationAnnotationAdapter daa = new NestedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "value", "annot.Bar"); - SingleMemberAnnotation annotation = (SingleMemberAnnotation) daa.getAnnotation(declaration); - assertNull(annotation); - annotation = daa.newSingleMemberAnnotation(declaration); - StringLiteral stringLiteral = annotation.getAST().newStringLiteral(); - stringLiteral.setLiteralValue("test string literal"); - annotation.setValue(stringLiteral); - } - - public void testNewSingleMemberAnnotation7() throws Exception { - this.createAnnotationAndMembers("Bar", "String value();"); - this.createAnnotationAndMembers("Foo", "annot.Bar nestedAnnotation(); String xxx();"); - this.createTestType("@annot.Foo(xxx=\"something\")"); - String expected = "@annot.Foo(xxx=\"something\", nestedAnnotation = @Bar(\"test string literal\"))"; - this.assertSourceDoesNotContain(expected); - this.idField().edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - NestedDeclarationAnnotationAdapterTests.this.editNewSingleMemberAnnotation7(declaration); - } - }); - this.assertSourceContains(expected); - } - - void editNewSingleMemberAnnotation7(ModifiedDeclaration declaration) { - DeclarationAnnotationAdapter daa = new NestedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotation", "annot.Bar"); - SingleMemberAnnotation annotation = (SingleMemberAnnotation) daa.getAnnotation(declaration); - assertNull(annotation); - annotation = daa.newSingleMemberAnnotation(declaration); - StringLiteral stringLiteral = annotation.getAST().newStringLiteral(); - stringLiteral.setLiteralValue("test string literal"); - annotation.setValue(stringLiteral); - } - - public void testNewSingleMemberAnnotation8() throws Exception { - this.createAnnotationAndMembers("Bar", "String value();"); - this.createAnnotationAndMembers("Foo", "annot.Bar value(); String xxx();"); - this.createTestType("@annot.Foo(xxx=\"something\")"); - String expected = "@annot.Foo(xxx=\"something\", value = @Bar(\"test string literal\"))"; - this.assertSourceDoesNotContain(expected); - this.idField().edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - NestedDeclarationAnnotationAdapterTests.this.editNewSingleMemberAnnotation8(declaration); - } - }); - this.assertSourceContains(expected); - } - - void editNewSingleMemberAnnotation8(ModifiedDeclaration declaration) { - DeclarationAnnotationAdapter daa = new NestedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "value", "annot.Bar"); - SingleMemberAnnotation annotation = (SingleMemberAnnotation) daa.getAnnotation(declaration); - assertNull(annotation); - annotation = daa.newSingleMemberAnnotation(declaration); - StringLiteral stringLiteral = annotation.getAST().newStringLiteral(); - stringLiteral.setLiteralValue("test string literal"); - annotation.setValue(stringLiteral); - } - - public void testNewNormalAnnotation1() throws Exception { - this.createAnnotationAndMembers("Bar", "String yyy();"); - this.createAnnotationAndMembers("Foo", "annot.Bar nestedAnnotation();"); - this.createTestType(); - this.assertSourceDoesNotContain("Foo"); - this.idField().edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - NestedDeclarationAnnotationAdapterTests.this.editNewNormalAnnotation1(declaration); - } - }); - this.assertSourceContains("@Foo(nestedAnnotation=@Bar(yyy=\"test string literal\"))"); - } - - void editNewNormalAnnotation1(ModifiedDeclaration declaration) { - DeclarationAnnotationAdapter daa = new NestedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotation", "annot.Bar"); - NormalAnnotation annotation = (NormalAnnotation) daa.getAnnotation(declaration); - assertNull(annotation); - annotation = daa.newNormalAnnotation(declaration); - this.addMemberValuePair(annotation, "yyy", "test string literal"); - } - - public void testNewNormalAnnotation2() throws Exception { - this.createAnnotationAndMembers("Bar", "String yyy();"); - this.createAnnotationAndMembers("Foo", "annot.Bar value();"); - this.createTestType(); - this.assertSourceDoesNotContain("Foo"); - this.idField().edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - NestedDeclarationAnnotationAdapterTests.this.editNewNormalAnnotation2(declaration); - } - }); - this.assertSourceContains("@Foo(@Bar(yyy=\"test string literal\"))"); - } - - void editNewNormalAnnotation2(ModifiedDeclaration declaration) { - DeclarationAnnotationAdapter daa = new NestedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "value", "annot.Bar"); - NormalAnnotation annotation = (NormalAnnotation) daa.getAnnotation(declaration); - assertNull(annotation); - annotation = daa.newNormalAnnotation(declaration); - this.addMemberValuePair(annotation, "yyy", "test string literal"); - } - - public void testNewNormalAnnotation3() throws Exception { - this.createAnnotationAndMembers("Bar", "String yyy();"); - this.createAnnotationAndMembers("Foo", "annot.Bar nestedAnnotation();"); - this.createTestType("@annot.Foo"); - String expected = "@Foo(nestedAnnotation=@Bar(yyy=\"test string literal\"))"; - this.assertSourceDoesNotContain(expected); - this.idField().edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - NestedDeclarationAnnotationAdapterTests.this.editNewNormalAnnotation3(declaration); - } - }); - this.assertSourceContains(expected); - } - - void editNewNormalAnnotation3(ModifiedDeclaration declaration) { - DeclarationAnnotationAdapter daa = new NestedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotation", "annot.Bar"); - NormalAnnotation annotation = (NormalAnnotation) daa.getAnnotation(declaration); - assertNull(annotation); - annotation = daa.newNormalAnnotation(declaration); - this.addMemberValuePair(annotation, "yyy", "test string literal"); - } - - public void testNewNormalAnnotation4() throws Exception { - this.createAnnotationAndMembers("Bar", "String yyy();"); - this.createAnnotationAndMembers("Foo", "annot.Bar value();"); - this.createTestType("@annot.Foo"); - String expected = "@Foo(@Bar(yyy=\"test string literal\"))"; - this.assertSourceDoesNotContain(expected); - this.idField().edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - NestedDeclarationAnnotationAdapterTests.this.editNewNormalAnnotation4(declaration); - } - }); - this.assertSourceContains(expected); - } - - void editNewNormalAnnotation4(ModifiedDeclaration declaration) { - DeclarationAnnotationAdapter daa = new NestedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "value", "annot.Bar"); - NormalAnnotation annotation = (NormalAnnotation) daa.getAnnotation(declaration); - assertNull(annotation); - annotation = daa.newNormalAnnotation(declaration); - this.addMemberValuePair(annotation, "yyy", "test string literal"); - } - - public void testNewNormalAnnotation5() throws Exception { - this.createAnnotationAndMembers("Bar", "String yyy();"); - this.createAnnotationAndMembers("Foo", "annot.Bar nestedAnnotation(); String value();"); - this.createTestType("@annot.Foo(\"something\")"); - String expected = "@Foo(value=\"something\", nestedAnnotation=@Bar(yyy=\"test string literal\"))"; - this.assertSourceDoesNotContain(expected); - this.idField().edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - NestedDeclarationAnnotationAdapterTests.this.editNewNormalAnnotation5(declaration); - } - }); - this.assertSourceContains(expected); - } - - void editNewNormalAnnotation5(ModifiedDeclaration declaration) { - DeclarationAnnotationAdapter daa = new NestedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotation", "annot.Bar"); - NormalAnnotation annotation = (NormalAnnotation) daa.getAnnotation(declaration); - assertNull(annotation); - annotation = daa.newNormalAnnotation(declaration); - this.addMemberValuePair(annotation, "yyy", "test string literal"); - } - - public void testNewNormalAnnotation6() throws Exception { - this.createAnnotationAndMembers("Bar", "String yyy();"); - this.createAnnotationAndMembers("Foo", "Object value();"); - this.createTestType("@annot.Foo(\"something\")"); - String expected = "@annot.Foo(@Bar(yyy=\"test string literal\"))"; - this.assertSourceDoesNotContain(expected); - this.idField().edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - NestedDeclarationAnnotationAdapterTests.this.editNewNormalAnnotation6(declaration); - } - }); - this.assertSourceContains(expected); - } - - void editNewNormalAnnotation6(ModifiedDeclaration declaration) { - DeclarationAnnotationAdapter daa = new NestedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "value", "annot.Bar"); - NormalAnnotation annotation = (NormalAnnotation) daa.getAnnotation(declaration); - assertNull(annotation); - annotation = daa.newNormalAnnotation(declaration); - this.addMemberValuePair(annotation, "yyy", "test string literal"); - } - - public void testNewNormalAnnotation7() throws Exception { - this.createAnnotationAndMembers("Bar", "String yyy();"); - this.createAnnotationAndMembers("Foo", "String xxx(); annot.Bar nestedAnnotation();"); - this.createTestType("@annot.Foo(xxx=\"something\")"); - String expected = "@annot.Foo(xxx=\"something\", nestedAnnotation = @Bar(yyy = \"test string literal\"))"; - this.assertSourceDoesNotContain(expected); - this.idField().edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - NestedDeclarationAnnotationAdapterTests.this.editNewNormalAnnotation7(declaration); - } - }); - this.assertSourceContains(expected); - } - - void editNewNormalAnnotation7(ModifiedDeclaration declaration) { - DeclarationAnnotationAdapter daa = new NestedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotation", "annot.Bar"); - NormalAnnotation annotation = (NormalAnnotation) daa.getAnnotation(declaration); - assertNull(annotation); - annotation = daa.newNormalAnnotation(declaration); - this.addMemberValuePair(annotation, "yyy", "test string literal"); - } - - public void testNewNormalAnnotation8() throws Exception { - this.createAnnotationAndMembers("Bar", "String yyy();"); - this.createAnnotationAndMembers("Foo", "String xxx(); annot.Bar value();"); - this.createTestType("@annot.Foo(xxx=\"something\")"); - String expected = "@annot.Foo(xxx=\"something\", value = @Bar(yyy = \"test string literal\"))"; - this.assertSourceDoesNotContain(expected); - this.idField().edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - NestedDeclarationAnnotationAdapterTests.this.editNewNormalAnnotation8(declaration); - } - }); - this.assertSourceContains(expected); - } - - void editNewNormalAnnotation8(ModifiedDeclaration declaration) { - DeclarationAnnotationAdapter daa = new NestedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "value", "annot.Bar"); - NormalAnnotation annotation = (NormalAnnotation) daa.getAnnotation(declaration); - assertNull(annotation); - annotation = daa.newNormalAnnotation(declaration); - this.addMemberValuePair(annotation, "yyy", "test string literal"); - } - -} diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/jdtutility/NestedIndexedDeclarationAnnotationAdapterTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/jdtutility/NestedIndexedDeclarationAnnotationAdapterTests.java deleted file mode 100644 index e361b43ff7..0000000000 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/jdtutility/NestedIndexedDeclarationAnnotationAdapterTests.java +++ /dev/null @@ -1,2209 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2007 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.core.tests.internal.jdtutility; - -import org.eclipse.jdt.core.dom.ASTNode; -import org.eclipse.jdt.core.dom.Annotation; -import org.eclipse.jdt.core.dom.NormalAnnotation; -import org.eclipse.jdt.core.dom.NumberLiteral; -import org.eclipse.jdt.core.dom.SingleMemberAnnotation; -import org.eclipse.jpt.core.internal.jdtutility.AnnotationAdapter; -import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationAdapter; -import org.eclipse.jpt.core.internal.jdtutility.IndexedAnnotationAdapter; -import org.eclipse.jpt.core.internal.jdtutility.IndexedDeclarationAnnotationAdapter; -import org.eclipse.jpt.core.internal.jdtutility.Member; -import org.eclipse.jpt.core.internal.jdtutility.MemberAnnotationAdapter; -import org.eclipse.jpt.core.internal.jdtutility.MemberIndexedAnnotationAdapter; -import org.eclipse.jpt.core.internal.jdtutility.ModifiedDeclaration; -import org.eclipse.jpt.core.internal.jdtutility.NestedIndexedDeclarationAnnotationAdapter; -import org.eclipse.jpt.core.internal.jdtutility.SimpleDeclarationAnnotationAdapter; - -public class NestedIndexedDeclarationAnnotationAdapterTests extends AnnotationTestCase { - - public NestedIndexedDeclarationAnnotationAdapterTests(String name) { - super(name); - } - - private void createAnnotation(String annotationName) throws Exception { - this.createAnnotationAndMembers(annotationName, ""); - } - - private void createAnnotationAndMembers(String annotationName, String annotationBody) throws Exception { - this.javaProject.createType("annot", annotationName + ".java", "public @interface " + annotationName + " { " + annotationBody + " }"); - } - - public void testGetAnnotation1() throws Exception { - this.createAnnotationAndMembers("Bar", "String value();"); - this.createAnnotationAndMembers("Foo", "annot.Bar[] nestedAnnotations();"); - this.createTestType("@annot.Foo(nestedAnnotations={@annot.Bar, @annot.Bar(\"two\")})"); - // 0 - DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotations", 0, "annot.Bar"); - AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(), daa); - Annotation annotation = aa.getAnnotation(); - assertNotNull(annotation); - assertEquals("annot.Bar", annotation.getTypeName().getFullyQualifiedName()); - assertTrue(annotation.isMarkerAnnotation()); - - // 1 - daa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotations", 1, "annot.Bar"); - aa = new MemberAnnotationAdapter(this.idField(), daa); - annotation = aa.getAnnotation(); - assertNotNull(annotation); - assertEquals("annot.Bar", annotation.getTypeName().getFullyQualifiedName()); - assertTrue(annotation.isSingleMemberAnnotation()); - } - - public void testGetAnnotation2() throws Exception { - this.createAnnotation("Baz"); - this.createAnnotationAndMembers("Bar", "annot.Baz[] yana();"); - this.createAnnotationAndMembers("Foo", "annot.Bar[] nestedAnnotations();"); - this.createTestType("@annot.Foo(nestedAnnotations=@annot.Bar(yana=@annot.Baz))"); - DeclarationAnnotationAdapter daa1 = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - DeclarationAnnotationAdapter daa2 = new NestedIndexedDeclarationAnnotationAdapter(daa1, "nestedAnnotations", 0, "annot.Bar"); - DeclarationAnnotationAdapter daa3 = new NestedIndexedDeclarationAnnotationAdapter(daa2, "yana", 0, "annot.Baz"); - AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(), daa3); - Annotation annotation = aa.getAnnotation(); - assertNotNull(annotation); - assertEquals("annot.Baz", annotation.getTypeName().getFullyQualifiedName()); - assertTrue(annotation.isMarkerAnnotation()); - } - - public void testGetAnnotation3() throws Exception { - this.createAnnotation("Baz"); - this.createAnnotationAndMembers("Bar", "annot.Baz[] yana();"); - this.createAnnotationAndMembers("Foo", "annot.Bar[] nestedAnnotations();"); - this.createTestType("@annot.Foo(nestedAnnotations=@annot.Bar(yana={@annot.Baz}))"); - DeclarationAnnotationAdapter daa1 = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - DeclarationAnnotationAdapter daa2 = new NestedIndexedDeclarationAnnotationAdapter(daa1, "nestedAnnotations", 0, "annot.Bar"); - DeclarationAnnotationAdapter daa3 = new NestedIndexedDeclarationAnnotationAdapter(daa2, "yana", 0, "annot.Baz"); - AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(), daa3); - Annotation annotation = aa.getAnnotation(); - assertNotNull(annotation); - assertEquals("annot.Baz", annotation.getTypeName().getFullyQualifiedName()); - assertTrue(annotation.isMarkerAnnotation()); - - // name mismatch - daa3 = new NestedIndexedDeclarationAnnotationAdapter(daa2, "yana", 0, "annot.Xyz"); - aa = new MemberAnnotationAdapter(this.idField(), daa3); - annotation = aa.getAnnotation(); - assertNull(annotation); - } - - public void testGetAnnotationNull1() throws Exception { - this.createAnnotation("Bar"); - this.createAnnotationAndMembers("Foo", "annot.Bar[] nestedAnnotations();"); - this.createTestType("@annot.Foo()"); - DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotations", 0, "annot.Bar"); - AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(), daa); - Annotation annotation = aa.getAnnotation(); - assertNull(annotation); - } - - public void testGetAnnotationNull2() throws Exception { - this.createAnnotation("Bar"); - this.createAnnotationAndMembers("Foo", "annot.Bar[] nestedAnnotations();"); - this.createTestType(); - DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotations", 0, "annot.Bar"); - AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(), daa); - Annotation annotation = aa.getAnnotation(); - assertNull(annotation); - } - - public void testGetAnnotationNull3() throws Exception { - this.createAnnotation("Bar"); - this.createAnnotationAndMembers("Foo", "annot.Bar[] nestedAnnotations();"); - this.createTestType("@annot.Foo(nestedAnnotations=\"annot.Bar\")"); - DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotations", 0, "annot.Bar"); - AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(), daa); - Annotation annotation = aa.getAnnotation(); - assertNull(annotation); - } - - public void testGetAnnotationNull4() throws Exception { - this.createAnnotation("NotBar"); - this.createAnnotation("Bar"); - this.createAnnotationAndMembers("Foo", "annot.Bar[] nestedAnnotations();"); - this.createTestType("@annot.Foo(nestedAnnotations=@annot.NotBar)"); - DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotations", 0, "annot.Bar"); - AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(), daa); - Annotation annotation = aa.getAnnotation(); - assertNull(annotation); - } - - public void testGetAnnotationNull5() throws Exception { - this.createAnnotationAndMembers("Bar", "String value();"); - this.createAnnotationAndMembers("Foo", "annot.Bar[] nestedAnnotations();"); - this.createTestType("@annot.Foo(nestedAnnotations={@annot.Bar, @annot.Bar(\"two\")})"); - DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotations", 2, "annot.Bar"); - AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(), daa); - Annotation annotation = aa.getAnnotation(); - assertNull(annotation); - } - - public void testGetAnnotationNull6() throws Exception { - this.createAnnotation("Xyz"); - this.createAnnotation("Baz"); - this.createAnnotationAndMembers("Bar", "annot.Baz[] yana();"); - this.createAnnotationAndMembers("Foo", "annot.Bar[] nestedAnnotations();"); - this.createTestType("@annot.Foo(nestedAnnotations=@annot.Bar(yana={@annot.Baz}))"); - DeclarationAnnotationAdapter daa1 = new SimpleDeclarationAnnotationAdapter("Foo"); - DeclarationAnnotationAdapter daa2 = new NestedIndexedDeclarationAnnotationAdapter(daa1, "nestedAnnotations", 0, "annot.Bar"); - DeclarationAnnotationAdapter daa3 = new NestedIndexedDeclarationAnnotationAdapter(daa2, "yana", 0, "annot.Xyz"); - AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(), daa3); - Annotation annotation = aa.getAnnotation(); - assertNull(annotation); - } - - public void testRemoveAnnotation1() throws Exception { - this.createAnnotationAndMembers("Bar", "int value();"); - this.createAnnotationAndMembers("Foo", "annot.Bar[] nestedAnnotations();"); - String na = "@annot.Foo(nestedAnnotations={@annot.Bar(0), @annot.Bar(1)})"; - String expected = "@annot.Foo(nestedAnnotations={null, @annot.Bar(1)})"; - this.createTestType(na); - this.assertSourceDoesNotContain(expected); - this.assertSourceContains(na); - - DeclarationAnnotationAdapter daa1 = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - DeclarationAnnotationAdapter daa2 = new NestedIndexedDeclarationAnnotationAdapter(daa1, "nestedAnnotations", 0, "annot.Bar"); - AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(), daa2); - Annotation annotation = aa.getAnnotation(); - assertNotNull(annotation); - - aa.removeAnnotation(); - this.assertSourceDoesNotContain(na); - this.assertSourceContains(expected); - } - - public void testRemoveAnnotation2() throws Exception { - this.createAnnotationAndMembers("Bar", "int value();"); - this.createAnnotationAndMembers("Foo", "annot.Bar[] nestedAnnotations();"); - this.createTestType(); - this.assertSourceDoesNotContain("Foo"); - - DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotations", 0, "annot.Bar"); - AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(), daa); - Annotation annotation = aa.getAnnotation(); - assertNull(annotation); - - aa.removeAnnotation(); - this.assertSourceDoesNotContain("Foo"); - } - - public void testRemoveAnnotation3() throws Exception { - this.createAnnotationAndMembers("Bar", "int value();"); - this.createAnnotationAndMembers("Foo", "String[] nestedAnnotations();"); - String na = "@annot.Foo(nestedAnnotations={\"annot.Bar1\", \"annot.Bar2\", \"annot.Bar3\"})"; - this.createTestType(na); - this.assertSourceContains(na); - - DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotations", 0, "annot.Bar"); - AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(), daa); - Annotation annotation = aa.getAnnotation(); - assertNull(annotation); - - aa.removeAnnotation(); - this.assertSourceContains(na); - } - - public void testRemoveAnnotation4() throws Exception { - this.createAnnotationAndMembers("NotBar", "int value();"); - this.createAnnotationAndMembers("Bar", "int value();"); - this.createAnnotationAndMembers("Foo", "annot.NotBar[] nestedAnnotations();"); - String na = "@annot.Foo(nestedAnnotations={@annot.NotBar(0), @annot.NotBar(1)})"; - this.createTestType(na); - this.assertSourceContains(na); - - DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotations", 0, "annot.Bar"); - AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(), daa); - Annotation annotation = aa.getAnnotation(); - assertNull(annotation); - - aa.removeAnnotation(); - this.assertSourceContains(na); - } - - public void testRemoveAnnotation5() throws Exception { - this.createAnnotationAndMembers("Bar", "int value();"); - this.createAnnotationAndMembers("Foo", "annot.Bar[] nestedAnnotations();"); - String na = "@annot.Foo(nestedAnnotations=@annot.Bar)"; - this.createTestType(na); - this.assertSourceContains(na); - - DeclarationAnnotationAdapter daa1 = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - DeclarationAnnotationAdapter daa2 = new NestedIndexedDeclarationAnnotationAdapter(daa1, "nestedAnnotations", 0, "annot.Bar"); - AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(), daa2); - Annotation annotation = aa.getAnnotation(); - assertNotNull(annotation); - - aa.removeAnnotation(); - assertNull(aa.getAnnotation()); - this.assertSourceDoesNotContain(na); - this.assertSourceDoesNotContain("Foo"); - } - - public void testRemoveAnnotation5a() throws Exception { - this.createAnnotationAndMembers("Bar", "int value();"); - this.createAnnotationAndMembers("Foo", "annot.Bar[] nestedAnnotations();"); - String na = "@annot.Foo(nestedAnnotations=@annot.Bar)"; - this.createTestType(na); - this.assertSourceContains(na); - - DeclarationAnnotationAdapter daa1 = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - AnnotationAdapter aa1 = new MemberAnnotationAdapter(this.idField(), daa1); - DeclarationAnnotationAdapter daa2 = new NestedIndexedDeclarationAnnotationAdapter(daa1, "nestedAnnotations", 0, "annot.Bar", false); - AnnotationAdapter aa2 = new MemberAnnotationAdapter(this.idField(), daa2); - Annotation annotation = aa2.getAnnotation(); - assertNotNull(annotation); - - aa2.removeAnnotation(); - assertTrue(aa1.getAnnotation().isMarkerAnnotation()); - this.assertSourceDoesNotContain(na); - this.assertSourceContains("import annot.Foo;"); - this.assertSourceContains("@Foo"); - } - - public void testRemoveAnnotation6() throws Exception { - this.createAnnotationAndMembers("Bar", "int value();"); - this.createAnnotationAndMembers("Foo", "String[] nestedAnnotations();"); - String na = "@annot.Foo(nestedAnnotations=\"annot.Bar\")"; - this.createTestType(na); - this.assertSourceContains(na); - - DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotations", 0, "annot.Bar"); - AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(), daa); - Annotation annotation = aa.getAnnotation(); - assertNull(annotation); - - aa.removeAnnotation(); - this.assertSourceContains(na); - } - - public void testRemoveAnnotation7() throws Exception { - this.createAnnotationAndMembers("NotBar", "int value();"); - this.createAnnotationAndMembers("Bar", "int value();"); - this.createAnnotationAndMembers("Foo", "annot.NotBar[] nestedAnnotations();"); - String na = "@annot.Foo(nestedAnnotations=@annot.NotBar)"; - this.createTestType(na); - this.assertSourceContains(na); - - DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotations", 0, "annot.Bar"); - AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(), daa); - Annotation annotation = aa.getAnnotation(); - assertNull(annotation); - - aa.removeAnnotation(); - this.assertSourceContains(na); - } - - public void testRemoveAnnotation8() throws Exception { - this.createAnnotationAndMembers("Bar", "int value();"); - this.createAnnotationAndMembers("Foo", "annot.Bar[] nestedAnnotations();"); - String na = "@annot.Foo(nestedAnnotations={@annot.Bar(0), @annot.Bar(1), @annot.Bar(2), @annot.Bar(3)})"; - this.createTestType(na); - this.assertSourceContains(na); - - DeclarationAnnotationAdapter daa1 = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - AnnotationAdapter aa1 = new MemberAnnotationAdapter(this.idField(), daa1); - DeclarationAnnotationAdapter daa2 = new NestedIndexedDeclarationAnnotationAdapter(daa1, "nestedAnnotations", 2, "annot.Bar"); - AnnotationAdapter aa2 = new MemberAnnotationAdapter(this.idField(), daa2); - Annotation annotation = aa2.getAnnotation(); - assertNotNull(annotation); - - aa2.removeAnnotation(); - assertTrue(aa1.getAnnotation().isNormalAnnotation()); - assertEquals(ASTNode.ARRAY_INITIALIZER, this.annotationElementValue(aa1.getAnnotation(), "nestedAnnotations").getNodeType()); - this.assertSourceDoesNotContain(na); - this.assertSourceContains("@annot.Foo(nestedAnnotations={@annot.Bar(0), @annot.Bar(1), null, @annot.Bar(3)})"); - } - - public void testRemoveAnnotation9() throws Exception { - this.createAnnotationAndMembers("Bar", "int value();"); - this.createAnnotationAndMembers("Foo", "annot.Bar[] value();"); - String na = "@annot.Foo({@annot.Bar(0), @annot.Bar(1), @annot.Bar(2), @annot.Bar(3)})"; - this.createTestType(na); - this.assertSourceContains(na); - - DeclarationAnnotationAdapter daa1 = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - AnnotationAdapter aa1 = new MemberAnnotationAdapter(this.idField(), daa1); - DeclarationAnnotationAdapter daa2 = new NestedIndexedDeclarationAnnotationAdapter(daa1, "value", 2, "annot.Bar"); - AnnotationAdapter aa2 = new MemberAnnotationAdapter(this.idField(), daa2); - Annotation annotation = aa2.getAnnotation(); - assertNotNull(annotation); - - aa2.removeAnnotation(); - assertTrue(aa1.getAnnotation().isSingleMemberAnnotation()); - assertEquals(ASTNode.ARRAY_INITIALIZER, this.annotationElementValue(aa1.getAnnotation(), "value").getNodeType()); - this.assertSourceDoesNotContain(na); - this.assertSourceContains("@annot.Foo({@annot.Bar(0), @annot.Bar(1), null, @annot.Bar(3)})"); - } - - public void testRemoveAnnotation10() throws Exception { - this.createAnnotationAndMembers("Bar", "int value();"); - this.createAnnotationAndMembers("Foo", "annot.Bar[] value();"); - String na = "@annot.Foo({@annot.Bar(0), @annot.Bar(1)})"; - String expected = "@annot.Foo({null, @annot.Bar(1)})"; - this.createTestType(na); - this.assertSourceDoesNotContain(expected); - this.assertSourceContains(na); - - DeclarationAnnotationAdapter daa1 = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - DeclarationAnnotationAdapter daa2 = new NestedIndexedDeclarationAnnotationAdapter(daa1, "value", 0, "annot.Bar"); - AnnotationAdapter aa2 = new MemberAnnotationAdapter(this.idField(), daa2); - Annotation annotation = aa2.getAnnotation(); - assertNotNull(annotation); - - aa2.removeAnnotation(); - this.assertSourceDoesNotContain(na); - this.assertSourceContains(expected); - } - - public void testRemoveAnnotation11() throws Exception { - this.createAnnotationAndMembers("Bar", "int value();"); - this.createAnnotationAndMembers("Foo", "annot.Bar[] value();"); - String na = "@annot.Foo({@annot.Bar(0), @annot.Bar(1)})"; - String expected = "@annot.Foo(@annot.Bar(0))"; - this.createTestType(na); - this.assertSourceDoesNotContain(expected); - this.assertSourceContains(na); - - DeclarationAnnotationAdapter daa1 = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - AnnotationAdapter aa1 = new MemberAnnotationAdapter(this.idField(), daa1); - DeclarationAnnotationAdapter daa2 = new NestedIndexedDeclarationAnnotationAdapter(daa1, "value", 1, "annot.Bar"); - AnnotationAdapter aa2 = new MemberAnnotationAdapter(this.idField(), daa2); - Annotation annotation = aa2.getAnnotation(); - assertNotNull(annotation); - - aa2.removeAnnotation(); - assertEquals(ASTNode.SINGLE_MEMBER_ANNOTATION, this.annotationElementValue(aa1.getAnnotation(), "value").getNodeType()); - this.assertSourceDoesNotContain(na); - this.assertSourceContains(expected); - } - - public void testRemoveAnnotation12() throws Exception { - this.createAnnotationAndMembers("Bar", "int value();"); - this.createAnnotationAndMembers("Foo", "annot.Bar[] value();"); - String na = "@annot.Foo({@annot.Bar(0), null, @annot.Bar(2)})"; - String expected = "@annot.Foo(@annot.Bar(0))"; - this.createTestType(na); - this.assertSourceDoesNotContain(expected); - this.assertSourceContains(na); - - DeclarationAnnotationAdapter daa1 = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - AnnotationAdapter aa1 = new MemberAnnotationAdapter(this.idField(), daa1); - DeclarationAnnotationAdapter daa2 = new NestedIndexedDeclarationAnnotationAdapter(daa1, "value", 2, "annot.Bar"); - AnnotationAdapter aa2 = new MemberAnnotationAdapter(this.idField(), daa2); - Annotation annotation = aa2.getAnnotation(); - assertNotNull(annotation); - - aa2.removeAnnotation(); - assertEquals(ASTNode.SINGLE_MEMBER_ANNOTATION, this.annotationElementValue(aa1.getAnnotation(), "value").getNodeType()); - this.assertSourceDoesNotContain(na); - this.assertSourceContains(expected); - } - - public void testRemoveAnnotation13() throws Exception { - this.createAnnotationAndMembers("Bar", "int value();"); - this.createAnnotationAndMembers("Foo", "annot.Bar[] value();"); - String na = "@annot.Foo({null, @annot.Bar(1)})"; - this.createTestType(na); - this.assertSourceContains(na); - - DeclarationAnnotationAdapter daa1 = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - DeclarationAnnotationAdapter daa2 = new NestedIndexedDeclarationAnnotationAdapter(daa1, "value", 1, "annot.Bar"); - AnnotationAdapter aa2 = new MemberAnnotationAdapter(this.idField(), daa2); - Annotation annotation = aa2.getAnnotation(); - assertNotNull(annotation); - - aa2.removeAnnotation(); - this.assertSourceDoesNotContain("Foo"); - } - - public void testRemoveAnnotation14() throws Exception { - this.createAnnotationAndMembers("Bar", "int value();"); - this.createAnnotationAndMembers("Foo", "annot.Bar[] value();"); - String na = "@annot.Foo({@annot.Bar(0), null, @annot.Bar(2), null})"; - String expected = "@annot.Foo(@annot.Bar(0))"; - this.createTestType(na); - this.assertSourceDoesNotContain(expected); - this.assertSourceContains(na); - - DeclarationAnnotationAdapter daa1 = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - AnnotationAdapter aa1 = new MemberAnnotationAdapter(this.idField(), daa1); - DeclarationAnnotationAdapter daa2 = new NestedIndexedDeclarationAnnotationAdapter(daa1, "value", 2, "annot.Bar"); - AnnotationAdapter aa2 = new MemberAnnotationAdapter(this.idField(), daa2); - Annotation annotation = aa2.getAnnotation(); - assertNotNull(annotation); - - aa2.removeAnnotation(); - assertEquals(ASTNode.SINGLE_MEMBER_ANNOTATION, this.annotationElementValue(aa1.getAnnotation(), "value").getNodeType()); - this.assertSourceDoesNotContain(na); - this.assertSourceContains(expected); - } - - public void testRemoveAnnotation15() throws Exception { - this.createAnnotationAndMembers("Bar", "int value();"); - this.createAnnotationAndMembers("Foo", "annot.Bar[] value();"); - String na = "@annot.Foo({@annot.Bar(0), null, @annot.Bar(2), @annot.Bar(3)})"; - String expected = "@annot.Foo({@annot.Bar(0), null, null, @annot.Bar(3)})"; - this.createTestType(na); - this.assertSourceDoesNotContain(expected); - this.assertSourceContains(na); - - DeclarationAnnotationAdapter daa1 = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - AnnotationAdapter aa1 = new MemberAnnotationAdapter(this.idField(), daa1); - DeclarationAnnotationAdapter daa2 = new NestedIndexedDeclarationAnnotationAdapter(daa1, "value", 2, "annot.Bar"); - AnnotationAdapter aa2 = new MemberAnnotationAdapter(this.idField(), daa2); - Annotation annotation = aa2.getAnnotation(); - assertNotNull(annotation); - - aa2.removeAnnotation(); - assertEquals(ASTNode.ARRAY_INITIALIZER, this.annotationElementValue(aa1.getAnnotation(), "value").getNodeType()); - this.assertSourceDoesNotContain(na); - this.assertSourceContains(expected); - } - - public void testRemoveAnnotation16() throws Exception { - this.createAnnotationAndMembers("Bar", "int value();"); - this.createAnnotationAndMembers("Foo", "annot.Bar[] value();"); - String na = "@annot.Foo({@annot.Bar(0), null, @annot.Bar(2), @annot.Bar(3)})"; - String expected = "@annot.Foo({@annot.Bar(0), null, @annot.Bar(2)})"; - this.createTestType(na); - this.assertSourceDoesNotContain(expected); - this.assertSourceContains(na); - - DeclarationAnnotationAdapter daa1 = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - AnnotationAdapter aa1 = new MemberAnnotationAdapter(this.idField(), daa1); - DeclarationAnnotationAdapter daa2 = new NestedIndexedDeclarationAnnotationAdapter(daa1, "value", 3, "annot.Bar"); - AnnotationAdapter aa2 = new MemberAnnotationAdapter(this.idField(), daa2); - Annotation annotation = aa2.getAnnotation(); - assertNotNull(annotation); - - aa2.removeAnnotation(); - assertEquals(ASTNode.ARRAY_INITIALIZER, this.annotationElementValue(aa1.getAnnotation(), "value").getNodeType()); - this.assertSourceDoesNotContain(na); - this.assertSourceContains(expected); - } - - public void testRemoveAnnotation17() throws Exception { - this.createAnnotationAndMembers("Bar", "int value();"); - this.createAnnotationAndMembers("Foo", "annot.Bar[] nestedAnnotations();"); - String na = "@annot.Foo(nestedAnnotations={@annot.Bar(0), null, @annot.Bar(2)})"; - String expected = "@annot.Foo(nestedAnnotations=@annot.Bar(0))"; - this.createTestType(na); - this.assertSourceDoesNotContain(expected); - this.assertSourceContains(na); - - DeclarationAnnotationAdapter daa1 = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - AnnotationAdapter aa1 = new MemberAnnotationAdapter(this.idField(), daa1); - DeclarationAnnotationAdapter daa2 = new NestedIndexedDeclarationAnnotationAdapter(daa1, "nestedAnnotations", 2, "annot.Bar"); - AnnotationAdapter aa2 = new MemberAnnotationAdapter(this.idField(), daa2); - Annotation annotation = aa2.getAnnotation(); - assertNotNull(annotation); - - aa2.removeAnnotation(); - assertEquals(ASTNode.SINGLE_MEMBER_ANNOTATION, this.annotationElementValue(aa1.getAnnotation(), "nestedAnnotations").getNodeType()); - this.assertSourceDoesNotContain(na); - this.assertSourceContains(expected); - } - - public void testRemoveAnnotation18() throws Exception { - this.createAnnotationAndMembers("Bar", "int value();"); - this.createAnnotationAndMembers("Foo", "annot.Bar[] nestedAnnotations();"); - String na = "@annot.Foo(nestedAnnotations={null, @annot.Bar(1)})"; - this.createTestType(na); - this.assertSourceContains(na); - - DeclarationAnnotationAdapter daa1 = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - DeclarationAnnotationAdapter daa2 = new NestedIndexedDeclarationAnnotationAdapter(daa1, "nestedAnnotations", 1, "annot.Bar"); - AnnotationAdapter aa2 = new MemberAnnotationAdapter(this.idField(), daa2); - Annotation annotation = aa2.getAnnotation(); - assertNotNull(annotation); - - aa2.removeAnnotation(); - this.assertSourceDoesNotContain("Foo"); - } - - public void testRemoveAnnotation19() throws Exception { - this.createAnnotationAndMembers("Bar", "int value();"); - this.createAnnotationAndMembers("Foo", "annot.Bar[] nestedAnnotations();"); - String na = "@annot.Foo(nestedAnnotations={@annot.Bar(0), null, @annot.Bar(2), null})"; - String expected = "@annot.Foo(nestedAnnotations=@annot.Bar(0))"; - this.createTestType(na); - this.assertSourceDoesNotContain(expected); - this.assertSourceContains(na); - - DeclarationAnnotationAdapter daa1 = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - AnnotationAdapter aa1 = new MemberAnnotationAdapter(this.idField(), daa1); - DeclarationAnnotationAdapter daa2 = new NestedIndexedDeclarationAnnotationAdapter(daa1, "nestedAnnotations", 2, "annot.Bar"); - AnnotationAdapter aa2 = new MemberAnnotationAdapter(this.idField(), daa2); - Annotation annotation = aa2.getAnnotation(); - assertNotNull(annotation); - - aa2.removeAnnotation(); - assertEquals(ASTNode.SINGLE_MEMBER_ANNOTATION, this.annotationElementValue(aa1.getAnnotation(), "nestedAnnotations").getNodeType()); - this.assertSourceDoesNotContain(na); - this.assertSourceContains(expected); - } - - public void testRemoveAnnotation20() throws Exception { - this.createAnnotationAndMembers("Bar", "int value();"); - this.createAnnotationAndMembers("Foo", "annot.Bar[] nestedAnnotations();"); - String na = "@annot.Foo(nestedAnnotations={@annot.Bar(0), null, @annot.Bar(2), @annot.Bar(3)})"; - String expected = "@annot.Foo(nestedAnnotations={@annot.Bar(0), null, null, @annot.Bar(3)})"; - this.createTestType(na); - this.assertSourceDoesNotContain(expected); - this.assertSourceContains(na); - - DeclarationAnnotationAdapter daa1 = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - AnnotationAdapter aa1 = new MemberAnnotationAdapter(this.idField(), daa1); - DeclarationAnnotationAdapter daa2 = new NestedIndexedDeclarationAnnotationAdapter(daa1, "nestedAnnotations", 2, "annot.Bar"); - AnnotationAdapter aa2 = new MemberAnnotationAdapter(this.idField(), daa2); - Annotation annotation = aa2.getAnnotation(); - assertNotNull(annotation); - - aa2.removeAnnotation(); - assertEquals(ASTNode.ARRAY_INITIALIZER, this.annotationElementValue(aa1.getAnnotation(), "nestedAnnotations").getNodeType()); - this.assertSourceDoesNotContain(na); - this.assertSourceContains(expected); - } - - public void testRemoveAnnotation21() throws Exception { - this.createAnnotationAndMembers("Bar", "int value();"); - this.createAnnotationAndMembers("Foo", "annot.Bar[] nestedAnnotations();"); - String na = "@annot.Foo(nestedAnnotations={@annot.Bar(0), null, @annot.Bar(2), @annot.Bar(3)})"; - String expected = "@annot.Foo(nestedAnnotations={@annot.Bar(0), null, @annot.Bar(2)})"; - this.createTestType(na); - this.assertSourceDoesNotContain(expected); - this.assertSourceContains(na); - - DeclarationAnnotationAdapter daa1 = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - AnnotationAdapter aa1 = new MemberAnnotationAdapter(this.idField(), daa1); - DeclarationAnnotationAdapter daa2 = new NestedIndexedDeclarationAnnotationAdapter(daa1, "nestedAnnotations", 3, "annot.Bar"); - AnnotationAdapter aa2 = new MemberAnnotationAdapter(this.idField(), daa2); - Annotation annotation = aa2.getAnnotation(); - assertNotNull(annotation); - - aa2.removeAnnotation(); - assertEquals(ASTNode.ARRAY_INITIALIZER, this.annotationElementValue(aa1.getAnnotation(), "nestedAnnotations").getNodeType()); - this.assertSourceDoesNotContain(na); - this.assertSourceContains(expected); - } - - public void testNewMarkerAnnotation1() throws Exception { - this.createAnnotationAndMembers("Bar", "int value();"); - this.createAnnotationAndMembers("Foo", "annot.Bar[] nestedAnnotations();"); - this.createTestType(); - this.assertSourceDoesNotContain("Foo"); - - DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotations", 0, "annot.Bar"); - AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(), daa); - Annotation annotation = aa.getAnnotation(); - assertNull(annotation); - - aa.newMarkerAnnotation(); - this.assertSourceContains("@Foo(nestedAnnotations=@Bar)"); - } - - public void testNewMarkerAnnotation2() throws Exception { - this.createAnnotationAndMembers("Bar", "int value();"); - this.createAnnotationAndMembers("Foo", "annot.Bar[] value();"); - this.createTestType(); - this.assertSourceDoesNotContain("Foo"); - - DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "value", 0, "annot.Bar"); - AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(), daa); - Annotation annotation = aa.getAnnotation(); - assertNull(annotation); - - aa.newMarkerAnnotation(); - this.assertSourceContains("@Foo(@Bar)"); - } - - public void testNewMarkerAnnotation3() throws Exception { - this.createAnnotationAndMembers("Bar", "int value();"); - this.createAnnotationAndMembers("Foo", "annot.Bar[] nestedAnnotations();"); - this.createTestType("@annot.Foo"); - String expected = "@Foo(nestedAnnotations=@Bar)"; - this.assertSourceDoesNotContain(expected); - - DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotations", 0, "annot.Bar"); - AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(), daa); - Annotation annotation = aa.getAnnotation(); - assertNull(annotation); - - aa.newMarkerAnnotation(); - this.assertSourceContains(expected); - } - - public void testNewMarkerAnnotation4() throws Exception { - this.createAnnotationAndMembers("Bar", "int value();"); - this.createAnnotationAndMembers("Foo", "annot.Bar[] value();"); - this.createTestType("@annot.Foo"); - String expected = "@Foo(@Bar)"; - this.assertSourceDoesNotContain(expected); - - DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "value", 0, "annot.Bar"); - AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(), daa); - Annotation annotation = aa.getAnnotation(); - assertNull(annotation); - - aa.newMarkerAnnotation(); - this.assertSourceContains(expected); - } - - public void testNewMarkerAnnotation5() throws Exception { - this.createAnnotationAndMembers("Bar", "int value();"); - this.createAnnotationAndMembers("Foo", "String value(); annot.Bar[] nestedAnnotations();"); - this.createTestType("@annot.Foo(\"something\")"); - String expected = "@Foo(value=\"something\", nestedAnnotations=@Bar)"; - this.assertSourceDoesNotContain(expected); - - DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotations", 0, "annot.Bar"); - AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(), daa); - Annotation annotation = aa.getAnnotation(); - assertNull(annotation); - - aa.newMarkerAnnotation(); - this.assertSourceContains(expected); - } - - public void testNewMarkerAnnotation6() throws Exception { - this.createAnnotationAndMembers("Bar", "int value();"); - this.createAnnotationAndMembers("Foo", "annot.Bar[] value();"); - this.createTestType("@annot.Foo(\"something\")"); - String expected = "@annot.Foo(@Bar)"; - this.assertSourceDoesNotContain(expected); - - DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "value", 0, "annot.Bar"); - AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(), daa); - Annotation annotation = aa.getAnnotation(); - assertNull(annotation); - - aa.newMarkerAnnotation(); - this.assertSourceContains(expected); - } - - public void testNewMarkerAnnotation7() throws Exception { - this.createAnnotationAndMembers("Bar", "int value();"); - this.createAnnotationAndMembers("Foo", "String xxx(); annot.Bar[] nestedAnnotations();"); - this.createTestType("@annot.Foo(xxx=\"something\")"); - String expected = "@annot.Foo(xxx=\"something\", nestedAnnotations = @Bar)"; - this.assertSourceDoesNotContain(expected); - - DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotations", 0, "annot.Bar"); - AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(), daa); - Annotation annotation = aa.getAnnotation(); - assertNull(annotation); - - aa.newMarkerAnnotation(); - this.assertSourceContains(expected); - } - - public void testNewMarkerAnnotation8() throws Exception { - this.createAnnotationAndMembers("Bar", "int value();"); - this.createAnnotationAndMembers("Foo", "String xxx(); annot.Bar[] value();"); - this.createTestType("@annot.Foo(xxx=\"something\")"); - String expected = "@annot.Foo(xxx=\"something\", value = @Bar)"; - this.assertSourceDoesNotContain(expected); - - DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "value", 0, "annot.Bar"); - AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(), daa); - Annotation annotation = aa.getAnnotation(); - assertNull(annotation); - - aa.newMarkerAnnotation(); - this.assertSourceContains(expected); - } - - public void testNewMarkerAnnotation9() throws Exception { - this.createAnnotationAndMembers("Bar", "int value();"); - this.createAnnotationAndMembers("Foo", "annot.Bar[] nestedAnnotations();"); - this.createTestType(); - - DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotations", 5, "annot.Bar"); - AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(), daa); - assertNull(aa.getAnnotation()); - - aa.newMarkerAnnotation(); - this.assertSourceContains("@Foo(nestedAnnotations={null,null,null,null,null,@Bar})"); - } - - public void testNewMarkerAnnotation10() throws Exception { - this.createAnnotationAndMembers("Bar", "int value();"); - this.createAnnotationAndMembers("Foo", "String value(); annot.Bar[] nestedAnnotations();"); - this.createTestType("@annot.Foo(\"something\")"); - this.assertSourceDoesNotContain("Bar"); - - DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotations", 5, "annot.Bar"); - AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(), daa); - Annotation annotation = aa.getAnnotation(); - assertNull(annotation); - - aa.newMarkerAnnotation(); - this.assertSourceContains("@Foo(value=\"something\", nestedAnnotations={null,null,null,null,null,@Bar})"); - } - - public void testNewMarkerAnnotation11() throws Exception { - this.createAnnotationAndMembers("Bar", "int value();"); - this.createAnnotationAndMembers("Foo", "Object[] value();"); - this.createTestType("@annot.Foo({\"one\", \"two\"})"); - String expected = "@annot.Foo({@Bar, \"two\"})"; - this.assertSourceDoesNotContain(expected); - - DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "value", 0, "annot.Bar"); - AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(), daa); - Annotation annotation = aa.getAnnotation(); - assertNull(annotation); - - aa.newMarkerAnnotation(); - this.assertSourceContains(expected); - } - - public void testNewMarkerAnnotation12() throws Exception { - this.createAnnotationAndMembers("Bar", "int value();"); - this.createAnnotationAndMembers("Foo", "Object[] value();"); - this.createTestType("@annot.Foo({\"one\", \"two\"})"); - this.assertSourceDoesNotContain("Bar"); - - DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "value", 5, "annot.Bar"); - AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(), daa); - Annotation annotation = aa.getAnnotation(); - assertNull(annotation); - - aa.newMarkerAnnotation(); - this.assertSourceContains("Bar})"); // split line - } - - public void testNewMarkerAnnotation13() throws Exception { - this.createAnnotationAndMembers("Bar", "int value();"); - this.createAnnotationAndMembers("Foo", "annot.Bar[] value();"); - this.createTestType("@annot.Foo(7)"); - String expected = "@annot.Foo(@Bar)"; - this.assertSourceDoesNotContain(expected); - - DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "value", 0, "annot.Bar"); - AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(), daa); - Annotation annotation = aa.getAnnotation(); - assertNull(annotation); - - aa.newMarkerAnnotation(); - this.assertSourceContains(expected); - } - - public void testNewMarkerAnnotation14() throws Exception { - this.createAnnotationAndMembers("Bar", "int value();"); - this.createAnnotationAndMembers("Foo", "annot.Bar[] value();"); - this.createTestType("@annot.Foo(7)"); - this.assertSourceDoesNotContain("Bar"); - - DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "value", 5, "annot.Bar"); - AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(), daa); - Annotation annotation = aa.getAnnotation(); - assertNull(annotation); - - aa.newMarkerAnnotation(); - this.assertSourceContains("@annot.Foo({7,null,null,null,null,@Bar})"); - } - - public void testNewMarkerAnnotation15() throws Exception { - this.createAnnotationAndMembers("NotBar", "int value();"); - this.createAnnotationAndMembers("Bar", "int value();"); - this.createAnnotationAndMembers("Foo", "annot.Bar[] value();"); - this.createTestType("@annot.Foo(@annot.NotBar)"); - String expected = "@annot.Foo(@Bar)"; - this.assertSourceDoesNotContain(expected); - - DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "value", 0, "annot.Bar"); - AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(), daa); - Annotation annotation = aa.getAnnotation(); - assertNull(annotation); - - aa.newMarkerAnnotation(); - this.assertSourceContains(expected); - } - - public void testNewMarkerAnnotation16() throws Exception { - this.createAnnotationAndMembers("Bar", "int value();"); - this.createAnnotationAndMembers("Foo", "annot.Bar[] value();"); - this.createTestType("@annot.Foo(@annot.Bar(55))"); - String expected = "@annot.Foo({@annot.Bar(55),@Bar})"; - this.assertSourceDoesNotContain(expected); - - DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "value", 1, "annot.Bar"); - AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(), daa); - Annotation annotation = aa.getAnnotation(); - assertNull(annotation); - - aa.newMarkerAnnotation(); - this.assertSourceContains(expected); - } - - public void testNewMarkerAnnotation17() throws Exception { - this.createAnnotationAndMembers("Bar", "int value();"); - this.createAnnotationAndMembers("Foo", "annot.Bar[] nestedAnnotations();"); - this.createTestType("@annot.Foo(nestedAnnotations={\"something\"})"); - String expected = "@annot.Foo(nestedAnnotations={@Bar})"; - this.assertSourceDoesNotContain(expected); - - DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotations", 0, "annot.Bar"); - AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(), daa); - Annotation annotation = aa.getAnnotation(); - assertNull(annotation); - - aa.newMarkerAnnotation(); - this.assertSourceContains(expected); - } - - public void testNewMarkerAnnotation18() throws Exception { - this.createAnnotationAndMembers("Bar", "int value();"); - this.createAnnotationAndMembers("Foo", "annot.Bar[] nestedAnnotations();"); - this.createTestType("@annot.Foo(nestedAnnotations={\"something\"})"); - this.assertSourceDoesNotContain("Bar"); - - DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotations", 5, "annot.Bar"); - AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(), daa); - Annotation annotation = aa.getAnnotation(); - assertNull(annotation); - - aa.newMarkerAnnotation(); - this.assertSourceContains("Bar})"); // split line - } - - public void testNewMarkerAnnotation19() throws Exception { - this.createAnnotationAndMembers("Bar", "int value();"); - this.createAnnotationAndMembers("Foo", "annot.Bar[] nestedAnnotations();"); - this.createTestType("@annot.Foo(nestedAnnotations=\"something\")"); - String expected = "@annot.Foo(nestedAnnotations=@Bar)"; - this.assertSourceDoesNotContain(expected); - - DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotations", 0, "annot.Bar"); - AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(), daa); - Annotation annotation = aa.getAnnotation(); - assertNull(annotation); - - aa.newMarkerAnnotation(); - this.assertSourceContains(expected); - } - - public void testNewMarkerAnnotation20() throws Exception { - this.createAnnotationAndMembers("NotBar", "int value();"); - this.createAnnotationAndMembers("Bar", "int value();"); - this.createAnnotationAndMembers("Foo", "annot.Bar[] nestedAnnotations();"); - this.createTestType("@annot.Foo(nestedAnnotations=@annot.NotBar)"); - String expected = "@annot.Foo(nestedAnnotations=@Bar)"; - this.assertSourceDoesNotContain(expected); - - DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotations", 0, "annot.Bar"); - AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(), daa); - Annotation annotation = aa.getAnnotation(); - assertNull(annotation); - - aa.newMarkerAnnotation(); - this.assertSourceContains(expected); - } - - public void testNewMarkerAnnotation21() throws Exception { - this.createAnnotationAndMembers("NotBar", "int value();"); - this.createAnnotationAndMembers("Bar", "int value();"); - this.createAnnotationAndMembers("Foo", "Object[] nestedAnnotations();"); - this.createTestType("@annot.Foo(nestedAnnotations=@annot.NotBar)"); - this.assertSourceDoesNotContain("@Bar"); - - DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotations", 5, "annot.Bar"); - AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(), daa); - Annotation annotation = aa.getAnnotation(); - assertNull(annotation); - - aa.newMarkerAnnotation(); - this.assertSourceContains("@annot.Foo(nestedAnnotations={@annot.NotBar,null,null,null,null,@Bar})"); - } - - public void testNewMarkerAnnotation22() throws Exception { - this.createAnnotationAndMembers("Bar", "int value();"); - this.createAnnotationAndMembers("Foo", "Object[] nestedAnnotations();"); - this.createTestType("@annot.Foo(nestedAnnotations=@annot.Bar(88))"); - String expected = "@annot.Foo(nestedAnnotations=@Bar)"; - this.assertSourceDoesNotContain(expected); - - DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotations", 0, "annot.Bar"); - AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(), daa); - aa.newMarkerAnnotation(); - this.assertSourceContains(expected); - } - - public void testNewMarkerAnnotation23() throws Exception { - this.createAnnotationAndMembers("Bar", "int value();"); - this.createAnnotationAndMembers("Foo", "Object[] nestedAnnotations();"); - this.createTestType("@annot.Foo(nestedAnnotations=@annot.Bar(88))"); - String expected = "@annot.Foo(nestedAnnotations={@annot.Bar(88),null,@Bar})"; - this.assertSourceDoesNotContain(expected); - - DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotations", 2, "annot.Bar"); - AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(), daa); - aa.newMarkerAnnotation(); - this.assertSourceContains(expected); - } - - public void testNewMarkerAnnotation24() throws Exception { - this.createAnnotationAndMembers("Bar", "int value();"); - this.createAnnotationAndMembers("Foo", "Object[] value();"); - this.createTestType("@annot.Foo(@annot.Bar(88))"); - String expected = "@annot.Foo({@annot.Bar(88),null,@Bar})"; - this.assertSourceDoesNotContain(expected); - - DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "value", 2, "annot.Bar"); - AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(), daa); - aa.newMarkerAnnotation(); - this.assertSourceContains(expected); - } - - public void testNewMarkerAnnotation25() throws Exception { - this.createAnnotationAndMembers("Bar", "int value();"); - this.createAnnotationAndMembers("Foo", "Object[] nestedAnnotations();"); - this.createTestType("@annot.Foo(nestedAnnotations={@annot.Bar(88), @annot.Bar(77)})"); - String expected1 = "@annot.Foo(nestedAnnotations={@annot.Bar(88), @annot.Bar(77), null, null,"; // the line gets split - String expected2 = "@Bar})"; - this.assertSourceDoesNotContain(expected1); - this.assertSourceDoesNotContain(expected2); - - DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotations", 4, "annot.Bar"); - AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(), daa); - aa.newMarkerAnnotation(); - this.assertSourceContains(expected1); - this.assertSourceContains(expected2); - } - - public void testNewMarkerAnnotation26() throws Exception { - this.createAnnotationAndMembers("Bar", "int value();"); - this.createAnnotationAndMembers("Foo", "Object[] value();"); - this.createTestType("@annot.Foo({@annot.Bar(88), @annot.Bar(77)})"); - String expected1 = "@annot.Foo({@annot.Bar(88), @annot.Bar(77), null, null,"; // the line gets split - String expected2 = "@Bar})"; - this.assertSourceDoesNotContain(expected1); - this.assertSourceDoesNotContain(expected2); - - DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "value", 4, "annot.Bar"); - AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(), daa); - aa.newMarkerAnnotation(); - this.assertSourceContains(expected1); - this.assertSourceContains(expected2); - } - - public void testNewSingleMemberAnnotation1() throws Exception { - this.createAnnotationAndMembers("Bar", "int value();"); - this.createAnnotationAndMembers("Foo", "annot.Bar[] nestedAnnotations();"); - this.createTestType(); - this.assertSourceDoesNotContain("@Foo"); - this.idField().edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - NestedIndexedDeclarationAnnotationAdapterTests.this.editNewSingleMemberAnnotation1(declaration); - } - }); - this.assertSourceContains("@Foo(nestedAnnotations=@Bar(88))"); - } - - void editNewSingleMemberAnnotation1(ModifiedDeclaration declaration) { - DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotations", 0, "annot.Bar"); - SingleMemberAnnotation annotation = (SingleMemberAnnotation) daa.getAnnotation(declaration); - assertNull(annotation); - annotation = daa.newSingleMemberAnnotation(declaration); - NumberLiteral numberLiteral = annotation.getAST().newNumberLiteral(); - numberLiteral.setToken("88"); - annotation.setValue(numberLiteral); - } - - public void testNewSingleMemberAnnotation2() throws Exception { - this.createAnnotationAndMembers("Bar", "int value();"); - this.createAnnotationAndMembers("Foo", "annot.Bar[] value();"); - this.createTestType(); - this.assertSourceDoesNotContain("@Foo"); - this.idField().edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - NestedIndexedDeclarationAnnotationAdapterTests.this.editNewSingleMemberAnnotation2(declaration); - } - }); - this.assertSourceContains("@Foo(@Bar(88))"); - } - - void editNewSingleMemberAnnotation2(ModifiedDeclaration declaration) { - DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "value", 0, "annot.Bar"); - SingleMemberAnnotation annotation = (SingleMemberAnnotation) daa.getAnnotation(declaration); - assertNull(annotation); - annotation = daa.newSingleMemberAnnotation(declaration); - NumberLiteral numberLiteral = annotation.getAST().newNumberLiteral(); - numberLiteral.setToken("88"); - annotation.setValue(numberLiteral); - } - - public void testNewSingleMemberAnnotation3() throws Exception { - this.createAnnotationAndMembers("Bar", "int value();"); - this.createAnnotationAndMembers("Foo", "annot.Bar[] nestedAnnotations();"); - this.createTestType("@annot.Foo"); - String expected = "@Foo(nestedAnnotations=@Bar(88))"; - this.assertSourceDoesNotContain(expected); - this.idField().edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - NestedIndexedDeclarationAnnotationAdapterTests.this.editNewSingleMemberAnnotation3(declaration); - } - }); - this.assertSourceContains(expected); - } - - void editNewSingleMemberAnnotation3(ModifiedDeclaration declaration) { - DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotations", 0, "annot.Bar"); - SingleMemberAnnotation annotation = (SingleMemberAnnotation) daa.getAnnotation(declaration); - assertNull(annotation); - annotation = daa.newSingleMemberAnnotation(declaration); - NumberLiteral numberLiteral = annotation.getAST().newNumberLiteral(); - numberLiteral.setToken("88"); - annotation.setValue(numberLiteral); - } - - public void testNewSingleMemberAnnotation4() throws Exception { - this.createAnnotationAndMembers("Bar", "int value();"); - this.createAnnotationAndMembers("Foo", "annot.Bar[] value();"); - this.createTestType("@annot.Foo"); - String expected = "@Foo(@Bar(88))"; - this.assertSourceDoesNotContain(expected); - this.idField().edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - NestedIndexedDeclarationAnnotationAdapterTests.this.editNewSingleMemberAnnotation4(declaration); - } - }); - this.assertSourceContains(expected); - } - - void editNewSingleMemberAnnotation4(ModifiedDeclaration declaration) { - DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "value", 0, "annot.Bar"); - SingleMemberAnnotation annotation = (SingleMemberAnnotation) daa.getAnnotation(declaration); - assertNull(annotation); - annotation = daa.newSingleMemberAnnotation(declaration); - NumberLiteral numberLiteral = annotation.getAST().newNumberLiteral(); - numberLiteral.setToken("88"); - annotation.setValue(numberLiteral); - } - - public void testNewSingleMemberAnnotation5() throws Exception { - this.createAnnotationAndMembers("Bar", "int value();"); - this.createAnnotationAndMembers("Foo", "String value(); annot.Bar[] nestedAnnotations();"); - this.createTestType("@annot.Foo(\"something\")"); - String expected = "@Foo(value=\"something\", nestedAnnotations=@Bar(88))"; - this.assertSourceDoesNotContain(expected); - this.idField().edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - NestedIndexedDeclarationAnnotationAdapterTests.this.editNewSingleMemberAnnotation5(declaration); - } - }); - this.assertSourceContains(expected); - } - - void editNewSingleMemberAnnotation5(ModifiedDeclaration declaration) { - DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotations", 0, "annot.Bar"); - SingleMemberAnnotation annotation = (SingleMemberAnnotation) daa.getAnnotation(declaration); - assertNull(annotation); - annotation = daa.newSingleMemberAnnotation(declaration); - NumberLiteral numberLiteral = annotation.getAST().newNumberLiteral(); - numberLiteral.setToken("88"); - annotation.setValue(numberLiteral); - } - - public void testNewSingleMemberAnnotation6() throws Exception { - this.createAnnotationAndMembers("Bar", "int value();"); - this.createAnnotationAndMembers("Foo", "Object[] value();"); - this.createTestType("@annot.Foo(\"something\")"); - String expected = "@annot.Foo(@Bar(88))"; - this.assertSourceDoesNotContain(expected); - this.idField().edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - NestedIndexedDeclarationAnnotationAdapterTests.this.editNewSingleMemberAnnotation6(declaration); - } - }); - this.assertSourceContains(expected); - } - - void editNewSingleMemberAnnotation6(ModifiedDeclaration declaration) { - DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "value", 0, "annot.Bar"); - SingleMemberAnnotation annotation = (SingleMemberAnnotation) daa.getAnnotation(declaration); - assertNull(annotation); - annotation = daa.newSingleMemberAnnotation(declaration); - NumberLiteral numberLiteral = annotation.getAST().newNumberLiteral(); - numberLiteral.setToken("88"); - annotation.setValue(numberLiteral); - } - - public void testNewSingleMemberAnnotation7() throws Exception { - this.createAnnotationAndMembers("Bar", "int value();"); - this.createAnnotationAndMembers("Foo", "String xxx(); annot.Bar[] nestedAnnotations();"); - this.createTestType("@annot.Foo(xxx=\"something\")"); - String expected = "@annot.Foo(xxx=\"something\", nestedAnnotations = @Bar(88))"; - this.assertSourceDoesNotContain(expected); - this.idField().edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - NestedIndexedDeclarationAnnotationAdapterTests.this.editNewSingleMemberAnnotation7(declaration); - } - }); - this.assertSourceContains(expected); - } - - void editNewSingleMemberAnnotation7(ModifiedDeclaration declaration) { - DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotations", 0, "annot.Bar"); - SingleMemberAnnotation annotation = (SingleMemberAnnotation) daa.getAnnotation(declaration); - assertNull(annotation); - annotation = daa.newSingleMemberAnnotation(declaration); - NumberLiteral numberLiteral = annotation.getAST().newNumberLiteral(); - numberLiteral.setToken("88"); - annotation.setValue(numberLiteral); - } - - public void testNewSingleMemberAnnotation8() throws Exception { - this.createAnnotationAndMembers("Bar", "int value();"); - this.createAnnotationAndMembers("Foo", "String xxx(); annot.Bar[] value();"); - this.createTestType("@annot.Foo(xxx=\"something\")"); - String expected = "@annot.Foo(xxx=\"something\", value = @Bar(88))"; - this.assertSourceDoesNotContain(expected); - this.idField().edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - NestedIndexedDeclarationAnnotationAdapterTests.this.editNewSingleMemberAnnotation8(declaration); - } - }); - this.assertSourceContains(expected); - } - - void editNewSingleMemberAnnotation8(ModifiedDeclaration declaration) { - DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "value", 0, "annot.Bar"); - SingleMemberAnnotation annotation = (SingleMemberAnnotation) daa.getAnnotation(declaration); - assertNull(annotation); - annotation = daa.newSingleMemberAnnotation(declaration); - NumberLiteral numberLiteral = annotation.getAST().newNumberLiteral(); - numberLiteral.setToken("88"); - annotation.setValue(numberLiteral); - } - - public void testNewSingleMemberAnnotation9() throws Exception { - this.createAnnotationAndMembers("Bar", "int value();"); - this.createAnnotationAndMembers("Foo", "annot.Bar[] nestedAnnotations();"); - this.createTestType(); - this.assertSourceDoesNotContain("@Bar"); - - DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotations", 5, "annot.Bar"); - AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(), daa); - Annotation annotation = aa.getAnnotation(); - assertNull(annotation); - - aa.newSingleMemberAnnotation(); - this.assertSourceContains("@Foo(nestedAnnotations={null,null,null,null,null,@Bar(MISSING)})"); // ??? - } - - public void testNewSingleMemberAnnotation10() throws Exception { - this.createAnnotationAndMembers("Bar", "int value();"); - this.createAnnotationAndMembers("Foo", "String value(); annot.Bar[] nestedAnnotations();"); - this.createTestType("@annot.Foo(\"something\")"); - this.assertSourceDoesNotContain("@Bar"); - - DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotations", 5, "annot.Bar"); - AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(), daa); - Annotation annotation = aa.getAnnotation(); - assertNull(annotation); - - aa.newSingleMemberAnnotation(); - this.assertSourceContains("@Foo(value=\"something\", nestedAnnotations={null,null,null,null,null,@Bar(MISSING)})"); // ??? - } - - public void testNewSingleMemberAnnotation11() throws Exception { - this.createAnnotationAndMembers("Bar", "int value();"); - this.createAnnotationAndMembers("Foo", "Object[] value();"); - this.createTestType("@annot.Foo({\"one\", \"two\"})"); - String expected = "@annot.Foo({@Bar(88), \"two\"})"; - this.assertSourceDoesNotContain(expected); - this.idField().edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - NestedIndexedDeclarationAnnotationAdapterTests.this.editNewSingleMemberAnnotation11(declaration); - } - }); - this.assertSourceContains(expected); - } - - void editNewSingleMemberAnnotation11(ModifiedDeclaration declaration) { - DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "value", 0, "annot.Bar"); - SingleMemberAnnotation annotation = (SingleMemberAnnotation) daa.getAnnotation(declaration); - assertNull(annotation); - annotation = daa.newSingleMemberAnnotation(declaration); - NumberLiteral numberLiteral = annotation.getAST().newNumberLiteral(); - numberLiteral.setToken("88"); - annotation.setValue(numberLiteral); - } - - public void testNewSingleMemberAnnotation12() throws Exception { - this.createAnnotationAndMembers("Bar", "int value();"); - this.createAnnotationAndMembers("Foo", "Object[] value();"); - this.createTestType("@annot.Foo({\"one\", \"two\"})"); - this.assertSourceDoesNotContain("@Bar"); - - DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "value", 5, "annot.Bar"); - AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(), daa); - Annotation annotation = aa.getAnnotation(); - assertNull(annotation); - - aa.newSingleMemberAnnotation(); - this.assertSourceContains("@Bar(MISSING)})"); // split line - } - - public void testNewSingleMemberAnnotation13() throws Exception { - this.createAnnotationAndMembers("Bar", "int value();"); - this.createAnnotationAndMembers("Foo", "Object[] value();"); - this.createTestType("@annot.Foo(7)"); - String expected = "@annot.Foo(@Bar(88))"; - this.assertSourceDoesNotContain(expected); - this.idField().edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - NestedIndexedDeclarationAnnotationAdapterTests.this.editNewSingleMemberAnnotation13(declaration); - } - }); - this.assertSourceContains(expected); - } - - void editNewSingleMemberAnnotation13(ModifiedDeclaration declaration) { - DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "value", 0, "annot.Bar"); - SingleMemberAnnotation annotation = (SingleMemberAnnotation) daa.getAnnotation(declaration); - assertNull(annotation); - annotation = daa.newSingleMemberAnnotation(declaration); - NumberLiteral numberLiteral = annotation.getAST().newNumberLiteral(); - numberLiteral.setToken("88"); - annotation.setValue(numberLiteral); - } - - public void testNewSingleMemberAnnotation14() throws Exception { - this.createAnnotationAndMembers("Bar", "int value();"); - this.createAnnotationAndMembers("Foo", "Object[] value();"); - this.createTestType("@annot.Foo(7)"); - this.assertSourceDoesNotContain("@Bar"); - - DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "value", 5, "annot.Bar"); - AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(), daa); - Annotation annotation = aa.getAnnotation(); - assertNull(annotation); - - aa.newSingleMemberAnnotation(); - this.assertSourceContains("@annot.Foo({7,null,null,null,null,@Bar(MISSING)})"); - } - - public void testNewSingleMemberAnnotation15() throws Exception { - this.createAnnotationAndMembers("NotBar", "int value();"); - this.createAnnotationAndMembers("Bar", "int value();"); - this.createAnnotationAndMembers("Foo", "Object[] value();"); - this.createTestType("@annot.Foo(@annot.NotBar)"); - String expected = "@annot.Foo(@Bar(88))"; - this.assertSourceDoesNotContain(expected); - this.idField().edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - NestedIndexedDeclarationAnnotationAdapterTests.this.editNewSingleMemberAnnotation15(declaration); - } - }); - this.assertSourceContains(expected); - } - - void editNewSingleMemberAnnotation15(ModifiedDeclaration declaration) { - DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "value", 0, "annot.Bar"); - SingleMemberAnnotation annotation = (SingleMemberAnnotation) daa.getAnnotation(declaration); - assertNull(annotation); - annotation = daa.newSingleMemberAnnotation(declaration); - NumberLiteral numberLiteral = annotation.getAST().newNumberLiteral(); - numberLiteral.setToken("88"); - annotation.setValue(numberLiteral); - } - - public void testNewSingleMemberAnnotation16() throws Exception { - this.createAnnotationAndMembers("Bar", "int value();"); - this.createAnnotationAndMembers("Foo", "annot.Bar[] value();"); - this.createTestType("@annot.Foo(@annot.Bar(55))"); - String expected = "@annot.Foo({@annot.Bar(55),@Bar(88)})"; - this.assertSourceDoesNotContain(expected); - this.idField().edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - NestedIndexedDeclarationAnnotationAdapterTests.this.editNewSingleMemberAnnotation16(declaration); - } - }); - this.assertSourceContains(expected); - } - - void editNewSingleMemberAnnotation16(ModifiedDeclaration declaration) { - DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "value", 1, "annot.Bar"); - SingleMemberAnnotation annotation = (SingleMemberAnnotation) daa.getAnnotation(declaration); - assertNull(annotation); - annotation = daa.newSingleMemberAnnotation(declaration); - NumberLiteral numberLiteral = annotation.getAST().newNumberLiteral(); - numberLiteral.setToken("88"); - annotation.setValue(numberLiteral); - } - - public void testNewSingleMemberAnnotation17() throws Exception { - this.createAnnotationAndMembers("Bar", "int value();"); - this.createAnnotationAndMembers("Foo", "annot.Bar[] nestedAnnotations();"); - this.createTestType("@annot.Foo(nestedAnnotations={\"something\"})"); - String expected = "@annot.Foo(nestedAnnotations={@Bar(88)})"; - this.assertSourceDoesNotContain(expected); - this.idField().edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - NestedIndexedDeclarationAnnotationAdapterTests.this.editNewSingleMemberAnnotation17(declaration); - } - }); - this.assertSourceContains(expected); - } - - void editNewSingleMemberAnnotation17(ModifiedDeclaration declaration) { - DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotations", 0, "annot.Bar"); - SingleMemberAnnotation annotation = (SingleMemberAnnotation) daa.getAnnotation(declaration); - assertNull(annotation); - annotation = daa.newSingleMemberAnnotation(declaration); - NumberLiteral numberLiteral = annotation.getAST().newNumberLiteral(); - numberLiteral.setToken("88"); - annotation.setValue(numberLiteral); - } - - public void testNewSingleMemberAnnotation18() throws Exception { - this.createAnnotationAndMembers("Bar", "int value();"); - this.createAnnotationAndMembers("Foo", "Object[] nestedAnnotations();"); - this.createTestType("@annot.Foo(nestedAnnotations={\"something\"})"); - this.assertSourceDoesNotContain("@Bar"); - - DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotations", 5, "annot.Bar"); - AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(), daa); - Annotation annotation = aa.getAnnotation(); - assertNull(annotation); - - aa.newSingleMemberAnnotation(); - this.assertSourceContains("@Bar(MISSING)})"); // ??? - } - - public void testNewSingleMemberAnnotation19() throws Exception { - this.createAnnotationAndMembers("Bar", "int value();"); - this.createAnnotationAndMembers("Foo", "Object[] nestedAnnotations();"); - this.createTestType("@annot.Foo(nestedAnnotations=\"something\")"); - String expected = "@annot.Foo(nestedAnnotations=@Bar(88))"; - this.assertSourceDoesNotContain(expected); - this.idField().edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - NestedIndexedDeclarationAnnotationAdapterTests.this.editNewSingleMemberAnnotation19(declaration); - } - }); - this.assertSourceContains(expected); - } - - void editNewSingleMemberAnnotation19(ModifiedDeclaration declaration) { - DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotations", 0, "annot.Bar"); - SingleMemberAnnotation annotation = (SingleMemberAnnotation) daa.getAnnotation(declaration); - assertNull(annotation); - annotation = daa.newSingleMemberAnnotation(declaration); - NumberLiteral numberLiteral = annotation.getAST().newNumberLiteral(); - numberLiteral.setToken("88"); - annotation.setValue(numberLiteral); - } - - public void testNewSingleMemberAnnotation20() throws Exception { - this.createAnnotationAndMembers("NotBar", "int value();"); - this.createAnnotationAndMembers("Bar", "int value();"); - this.createAnnotationAndMembers("Foo", "Object[] nestedAnnotations();"); - this.createTestType("@annot.Foo(nestedAnnotations=@annot.NotBar)"); - String expected = "@annot.Foo(nestedAnnotations=@Bar(88))"; - this.assertSourceDoesNotContain(expected); - this.idField().edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - NestedIndexedDeclarationAnnotationAdapterTests.this.editNewSingleMemberAnnotation20(declaration); - } - }); - this.assertSourceContains(expected); - } - - void editNewSingleMemberAnnotation20(ModifiedDeclaration declaration) { - DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotations", 0, "annot.Bar"); - SingleMemberAnnotation annotation = (SingleMemberAnnotation) daa.getAnnotation(declaration); - assertNull(annotation); - annotation = daa.newSingleMemberAnnotation(declaration); - NumberLiteral numberLiteral = annotation.getAST().newNumberLiteral(); - numberLiteral.setToken("88"); - annotation.setValue(numberLiteral); - } - - public void testNewSingleMemberAnnotation21() throws Exception { - this.createAnnotationAndMembers("NotBar", "int value();"); - this.createAnnotationAndMembers("Bar", "int value();"); - this.createAnnotationAndMembers("Foo", "Object[] nestedAnnotations();"); - this.createTestType("@annot.Foo(nestedAnnotations=@annot.NotBar)"); - this.assertSourceDoesNotContain("@Bar"); - - DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotations", 5, "annot.Bar"); - AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(), daa); - Annotation annotation = aa.getAnnotation(); - assertNull(annotation); - - aa.newSingleMemberAnnotation(); - this.assertSourceContains("@annot.Foo(nestedAnnotations={@annot.NotBar,null,null,null,null,@Bar(MISSING)})"); - } - - public void testNewSingleMemberAnnotation22() throws Exception { - this.createAnnotationAndMembers("Bar", "int value();"); - this.createAnnotationAndMembers("Foo", "annot.Bar[] nestedAnnotations();"); - this.createTestType("@annot.Foo(nestedAnnotations=@annot.Bar(77))"); - String expected = "@annot.Foo(nestedAnnotations=@Bar(88))"; - this.assertSourceDoesNotContain(expected); - this.idField().edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - NestedIndexedDeclarationAnnotationAdapterTests.this.editNewSingleMemberAnnotation22(declaration); - } - }); - this.assertSourceContains(expected); - } - - void editNewSingleMemberAnnotation22(ModifiedDeclaration declaration) { - DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotations", 0, "annot.Bar"); - SingleMemberAnnotation annotation = daa.newSingleMemberAnnotation(declaration); - NumberLiteral numberLiteral = annotation.getAST().newNumberLiteral(); - numberLiteral.setToken("88"); - annotation.setValue(numberLiteral); - } - - public void testNewNormalAnnotation1() throws Exception { - this.createAnnotationAndMembers("Bar", "int value();"); - this.createAnnotationAndMembers("Foo", "annot.Bar[] nestedAnnotations();"); - this.createTestType(); - this.assertSourceDoesNotContain("@Foo"); - this.idField().edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - NestedIndexedDeclarationAnnotationAdapterTests.this.editNewNormalAnnotation1(declaration); - } - }); - this.assertSourceContains("@Foo(nestedAnnotations=@Bar(xxx=88))"); - } - - void editNewNormalAnnotation1(ModifiedDeclaration declaration) { - DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotations", 0, "annot.Bar"); - NormalAnnotation annotation = (NormalAnnotation) daa.getAnnotation(declaration); - assertNull(annotation); - annotation = daa.newNormalAnnotation(declaration); - this.addMemberValuePair(annotation, "xxx", 88); - } - - public void testNewNormalAnnotation2() throws Exception { - this.createAnnotationAndMembers("Bar", "int xxx();"); - this.createAnnotationAndMembers("Foo", "annot.Bar[] nestedAnnotations();"); - this.createTestType(); - this.assertSourceDoesNotContain("@Foo"); - this.idField().edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - NestedIndexedDeclarationAnnotationAdapterTests.this.editNewNormalAnnotation2(declaration); - } - }); - this.assertSourceContains("@Foo(@Bar(xxx=88))"); - } - - void editNewNormalAnnotation2(ModifiedDeclaration declaration) { - DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "value", 0, "annot.Bar"); - NormalAnnotation annotation = (NormalAnnotation) daa.getAnnotation(declaration); - assertNull(annotation); - annotation = daa.newNormalAnnotation(declaration); - this.addMemberValuePair(annotation, "xxx", 88); - } - - public void testNewNormalAnnotation3() throws Exception { - this.createAnnotationAndMembers("Bar", "int xxx();"); - this.createAnnotationAndMembers("Foo", "annot.Bar[] nestedAnnotations();"); - this.createTestType("@annot.Foo"); - String expected = "@Foo(nestedAnnotations=@Bar(xxx=88))"; - this.assertSourceDoesNotContain(expected); - this.idField().edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - NestedIndexedDeclarationAnnotationAdapterTests.this.editNewNormalAnnotation3(declaration); - } - }); - this.assertSourceContains(expected); - } - - void editNewNormalAnnotation3(ModifiedDeclaration declaration) { - DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotations", 0, "annot.Bar"); - NormalAnnotation annotation = (NormalAnnotation) daa.getAnnotation(declaration); - assertNull(annotation); - annotation = daa.newNormalAnnotation(declaration); - this.addMemberValuePair(annotation, "xxx", 88); - } - - public void testNewNormalAnnotation4() throws Exception { - this.createAnnotationAndMembers("Bar", "int xxx();"); - this.createAnnotationAndMembers("Foo", "annot.Bar[] nestedAnnotations();"); - this.createTestType("@annot.Foo"); - String expected = "@Foo(@Bar(xxx=88))"; - this.assertSourceDoesNotContain(expected); - this.idField().edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - NestedIndexedDeclarationAnnotationAdapterTests.this.editNewNormalAnnotation4(declaration); - } - }); - this.assertSourceContains(expected); - } - - void editNewNormalAnnotation4(ModifiedDeclaration declaration) { - DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "value", 0, "annot.Bar"); - NormalAnnotation annotation = (NormalAnnotation) daa.getAnnotation(declaration); - assertNull(annotation); - annotation = daa.newNormalAnnotation(declaration); - this.addMemberValuePair(annotation, "xxx", 88); - } - - public void testNewNormalAnnotation5() throws Exception { - this.createAnnotationAndMembers("Bar", "int xxx();"); - this.createAnnotationAndMembers("Foo", "annot.Bar[] nestedAnnotations(); String value();"); - this.createTestType("@annot.Foo(\"something\")"); - String expected = "@Foo(value=\"something\", nestedAnnotations=@Bar(xxx=88))"; - this.assertSourceDoesNotContain(expected); - this.idField().edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - NestedIndexedDeclarationAnnotationAdapterTests.this.editNewNormalAnnotation5(declaration); - } - }); - this.assertSourceContains(expected); - } - - void editNewNormalAnnotation5(ModifiedDeclaration declaration) { - DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotations", 0, "annot.Bar"); - NormalAnnotation annotation = (NormalAnnotation) daa.getAnnotation(declaration); - assertNull(annotation); - annotation = daa.newNormalAnnotation(declaration); - this.addMemberValuePair(annotation, "xxx", 88); - } - - public void testNewNormalAnnotation6() throws Exception { - this.createAnnotationAndMembers("Bar", "int xxx();"); - this.createAnnotationAndMembers("Foo", "annot.Bar[] value();"); - this.createTestType("@annot.Foo(\"something\")"); - String expected = "@annot.Foo(@Bar(xxx=88))"; - this.assertSourceDoesNotContain(expected); - this.idField().edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - NestedIndexedDeclarationAnnotationAdapterTests.this.editNewNormalAnnotation6(declaration); - } - }); - this.assertSourceContains(expected); - } - - void editNewNormalAnnotation6(ModifiedDeclaration declaration) { - DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "value", 0, "annot.Bar"); - NormalAnnotation annotation = (NormalAnnotation) daa.getAnnotation(declaration); - assertNull(annotation); - annotation = daa.newNormalAnnotation(declaration); - this.addMemberValuePair(annotation, "xxx", 88); - } - - public void testNewNormalAnnotation7() throws Exception { - this.createAnnotationAndMembers("Bar", "int xxx();"); - this.createAnnotationAndMembers("Foo", "annot.Bar[] nestedAnnotations(); String xxx();"); - this.createTestType("@annot.Foo(xxx=\"something\")"); - String expected = "@annot.Foo(xxx=\"something\", nestedAnnotations = @Bar(xxx = 88))"; - this.assertSourceDoesNotContain(expected); - this.idField().edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - NestedIndexedDeclarationAnnotationAdapterTests.this.editNewNormalAnnotation7(declaration); - } - }); - this.assertSourceContains(expected); - } - - void editNewNormalAnnotation7(ModifiedDeclaration declaration) { - DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotations", 0, "annot.Bar"); - NormalAnnotation annotation = (NormalAnnotation) daa.getAnnotation(declaration); - assertNull(annotation); - annotation = daa.newNormalAnnotation(declaration); - this.addMemberValuePair(annotation, "xxx", 88); - } - - public void testNewNormalAnnotation8() throws Exception { - this.createAnnotationAndMembers("Bar", "int xxx();"); - this.createAnnotationAndMembers("Foo", "annot.Bar[] value(); String xxx();"); - this.createTestType("@annot.Foo(xxx=\"something\")"); - String expected = "@annot.Foo(xxx=\"something\", value = @Bar(xxx = 88))"; - this.assertSourceDoesNotContain(expected); - this.idField().edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - NestedIndexedDeclarationAnnotationAdapterTests.this.editNewNormalAnnotation8(declaration); - } - }); - this.assertSourceContains(expected); - } - - void editNewNormalAnnotation8(ModifiedDeclaration declaration) { - DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "value", 0, "annot.Bar"); - NormalAnnotation annotation = (NormalAnnotation) daa.getAnnotation(declaration); - assertNull(annotation); - annotation = daa.newNormalAnnotation(declaration); - this.addMemberValuePair(annotation, "xxx", 88); - } - - public void testNewNormalAnnotation9() throws Exception { - this.createAnnotationAndMembers("Bar", "int xxx();"); - this.createAnnotationAndMembers("Foo", "annot.Bar[] nestedAnnotations(); String xxx();"); - this.createTestType(); - this.assertSourceDoesNotContain("@Bar"); - - DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotations", 5, "annot.Bar"); - AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(), daa); - Annotation annotation = aa.getAnnotation(); - assertNull(annotation); - - aa.newNormalAnnotation(); - this.assertSourceContains("@Foo(nestedAnnotations={null,null,null,null,null,@Bar()})"); - } - - public void testNewNormalAnnotation10() throws Exception { - this.createAnnotationAndMembers("Bar", "int xxx();"); - this.createAnnotationAndMembers("Foo", "annot.Bar[] nestedAnnotations(); String value();"); - this.createTestType("@annot.Foo(\"something\")"); - this.assertSourceDoesNotContain("@Bar"); - - DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotations", 5, "annot.Bar"); - AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(), daa); - Annotation annotation = aa.getAnnotation(); - assertNull(annotation); - - aa.newNormalAnnotation(); - this.assertSourceContains("@Foo(value=\"something\", nestedAnnotations={null,null,null,null,null,@Bar()})"); - } - - public void testNewNormalAnnotation11() throws Exception { - this.createAnnotationAndMembers("Bar", "int xxx();"); - this.createAnnotationAndMembers("Foo", "Object[] value();"); - this.createTestType("@annot.Foo({\"one\", \"two\"})"); - String expected = "@annot.Foo({@Bar(xxx=88), \"two\"})"; - this.assertSourceDoesNotContain(expected); - this.idField().edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - NestedIndexedDeclarationAnnotationAdapterTests.this.editNewNormalAnnotation11(declaration); - } - }); - this.assertSourceContains(expected); - } - - void editNewNormalAnnotation11(ModifiedDeclaration declaration) { - DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "value", 0, "annot.Bar"); - NormalAnnotation annotation = (NormalAnnotation) daa.getAnnotation(declaration); - assertNull(annotation); - annotation = daa.newNormalAnnotation(declaration); - this.addMemberValuePair(annotation, "xxx", 88); - } - - public void testNewNormalAnnotation12() throws Exception { - this.createAnnotationAndMembers("Bar", "int xxx();"); - this.createAnnotationAndMembers("Foo", "Object[] value();"); - this.createTestType("@annot.Foo({\"one\", \"two\"})"); - this.assertSourceDoesNotContain("@Bar"); - - DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "value", 5, "annot.Bar"); - AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(), daa); - Annotation annotation = aa.getAnnotation(); - assertNull(annotation); - - aa.newNormalAnnotation(); - this.assertSourceContains("@Bar()})"); // split line - } - - public void testNewNormalAnnotation13() throws Exception { - this.createAnnotationAndMembers("Bar", "int xxx();"); - this.createAnnotationAndMembers("Foo", "Object[] value();"); - this.createTestType("@annot.Foo(7)"); - String expected = "@annot.Foo(@Bar(xxx=88))"; - this.assertSourceDoesNotContain(expected); - this.idField().edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - NestedIndexedDeclarationAnnotationAdapterTests.this.editNewNormalAnnotation13(declaration); - } - }); - this.assertSourceContains(expected); - } - - void editNewNormalAnnotation13(ModifiedDeclaration declaration) { - DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "value", 0, "annot.Bar"); - NormalAnnotation annotation = (NormalAnnotation) daa.getAnnotation(declaration); - assertNull(annotation); - annotation = daa.newNormalAnnotation(declaration); - this.addMemberValuePair(annotation, "xxx", 88); - } - - public void testNewNormalAnnotation14() throws Exception { - this.createAnnotationAndMembers("Bar", "int xxx();"); - this.createAnnotationAndMembers("Foo", "Object[] value();"); - this.createTestType("@annot.Foo(7)"); - this.assertSourceDoesNotContain("@Bar"); - - DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "value", 5, "annot.Bar"); - AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(), daa); - Annotation annotation = aa.getAnnotation(); - assertNull(annotation); - - aa.newNormalAnnotation(); - this.assertSourceContains("@annot.Foo({7,null,null,null,null,@Bar()})"); - } - - public void testNewNormalAnnotation15() throws Exception { - this.createAnnotationAndMembers("NotBar", "int xxx();"); - this.createAnnotationAndMembers("Bar", "int xxx();"); - this.createAnnotationAndMembers("Foo", "Object[] value();"); - this.createTestType("@annot.Foo(@annot.NotBar)"); - String expected = "@annot.Foo(@Bar(xxx=88))"; - this.assertSourceDoesNotContain(expected); - this.idField().edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - NestedIndexedDeclarationAnnotationAdapterTests.this.editNewNormalAnnotation15(declaration); - } - }); - this.assertSourceContains(expected); - } - - void editNewNormalAnnotation15(ModifiedDeclaration declaration) { - DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "value", 0, "annot.Bar"); - NormalAnnotation annotation = (NormalAnnotation) daa.getAnnotation(declaration); - assertNull(annotation); - annotation = daa.newNormalAnnotation(declaration); - this.addMemberValuePair(annotation, "xxx", 88); - } - - public void testNewNormalAnnotation16() throws Exception { - this.createAnnotationAndMembers("Bar", "int xxx();"); - this.createAnnotationAndMembers("Foo", "annot.Bar[] value();"); - this.createTestType("@annot.Foo(@annot.Bar(55))"); - String expected = "@annot.Foo({@annot.Bar(55),@Bar(xxx=88)})"; - this.assertSourceDoesNotContain(expected); - this.idField().edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - NestedIndexedDeclarationAnnotationAdapterTests.this.editNewNormalAnnotation16(declaration); - } - }); - this.assertSourceContains(expected); - } - - void editNewNormalAnnotation16(ModifiedDeclaration declaration) { - DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "value", 1, "annot.Bar"); - NormalAnnotation annotation = (NormalAnnotation) daa.getAnnotation(declaration); - assertNull(annotation); - annotation = daa.newNormalAnnotation(declaration); - this.addMemberValuePair(annotation, "xxx", 88); - } - - public void testNewNormalAnnotation17() throws Exception { - this.createAnnotationAndMembers("Bar", "int xxx();"); - this.createAnnotationAndMembers("Foo", "Object[] nestedAnnotations();"); - this.createTestType("@annot.Foo(nestedAnnotations={\"something\"})"); - String expected = "@annot.Foo(nestedAnnotations={@Bar(xxx=88)})"; - this.assertSourceDoesNotContain(expected); - this.idField().edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - NestedIndexedDeclarationAnnotationAdapterTests.this.editNewNormalAnnotation17(declaration); - } - }); - this.assertSourceContains(expected); - } - - void editNewNormalAnnotation17(ModifiedDeclaration declaration) { - DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotations", 0, "annot.Bar"); - NormalAnnotation annotation = (NormalAnnotation) daa.getAnnotation(declaration); - assertNull(annotation); - annotation = daa.newNormalAnnotation(declaration); - this.addMemberValuePair(annotation, "xxx", 88); - } - - public void testNewNormalAnnotation18() throws Exception { - this.createAnnotationAndMembers("Bar", "int xxx();"); - this.createAnnotationAndMembers("Foo", "Object[] nestedAnnotations();"); - this.createTestType("@annot.Foo(nestedAnnotations={\"something\"})"); - this.assertSourceDoesNotContain("@Bar"); - - DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotations", 5, "annot.Bar"); - AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(), daa); - Annotation annotation = aa.getAnnotation(); - assertNull(annotation); - - aa.newNormalAnnotation(); - this.assertSourceContains("@Bar()})"); // split line - } - - public void testNewNormalAnnotation19() throws Exception { - this.createAnnotationAndMembers("Bar", "int xxx();"); - this.createAnnotationAndMembers("Foo", "Object[] nestedAnnotations();"); - this.createTestType("@annot.Foo(nestedAnnotations=\"something\")"); - String expected = "@annot.Foo(nestedAnnotations=@Bar(xxx=88))"; - this.assertSourceDoesNotContain(expected); - this.idField().edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - NestedIndexedDeclarationAnnotationAdapterTests.this.editNewNormalAnnotation19(declaration); - } - }); - this.assertSourceContains(expected); - } - - void editNewNormalAnnotation19(ModifiedDeclaration declaration) { - DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotations", 0, "annot.Bar"); - NormalAnnotation annotation = (NormalAnnotation) daa.getAnnotation(declaration); - assertNull(annotation); - annotation = daa.newNormalAnnotation(declaration); - this.addMemberValuePair(annotation, "xxx", 88); - } - - public void testNewNormalAnnotation20() throws Exception { - this.createAnnotationAndMembers("NotBar", "int xxx();"); - this.createAnnotationAndMembers("Bar", "int xxx();"); - this.createAnnotationAndMembers("Foo", "Object[] nestedAnnotations();"); - this.createTestType("@annot.Foo(nestedAnnotations=@annot.NotBar)"); - String expected = "@annot.Foo(nestedAnnotations=@Bar(xxx=88))"; - this.assertSourceDoesNotContain(expected); - this.idField().edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - NestedIndexedDeclarationAnnotationAdapterTests.this.editNewNormalAnnotation20(declaration); - } - }); - this.assertSourceContains(expected); - } - - void editNewNormalAnnotation20(ModifiedDeclaration declaration) { - DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotations", 0, "annot.Bar"); - NormalAnnotation annotation = (NormalAnnotation) daa.getAnnotation(declaration); - assertNull(annotation); - annotation = daa.newNormalAnnotation(declaration); - this.addMemberValuePair(annotation, "xxx", 88); - } - - public void testNewNormalAnnotation21() throws Exception { - this.createAnnotationAndMembers("NotBar", "int xxx();"); - this.createAnnotationAndMembers("Bar", "int xxx();"); - this.createAnnotationAndMembers("Foo", "Object[] nestedAnnotations();"); - this.createTestType("@annot.Foo(nestedAnnotations=@annot.NotBar)"); - this.assertSourceDoesNotContain("@Bar"); - - DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotations", 5, "annot.Bar"); - AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(), daa); - Annotation annotation = aa.getAnnotation(); - assertNull(annotation); - - aa.newNormalAnnotation(); - this.assertSourceContains("@annot.Foo(nestedAnnotations={@annot.NotBar,null,null,null,null,@Bar()})"); - } - - public void testNewNormalAnnotation22() throws Exception { - this.createAnnotationAndMembers("Bar", "int xxx();"); - this.createAnnotationAndMembers("Foo", "Object[] nestedAnnotations();"); - this.createTestType("@annot.Foo(nestedAnnotations=@annot.Bar(77))"); - String expected = "@annot.Foo(nestedAnnotations=@Bar(xxx=88))"; - this.assertSourceDoesNotContain(expected); - this.idField().edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - NestedIndexedDeclarationAnnotationAdapterTests.this.editNewNormalAnnotation22(declaration); - } - }); - this.assertSourceContains(expected); - } - - void editNewNormalAnnotation22(ModifiedDeclaration declaration) { - DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotations", 0, "annot.Bar"); - NormalAnnotation annotation = daa.newNormalAnnotation(declaration); - this.addMemberValuePair(annotation, "xxx", 88); - } - - public void testMoveAnnotation1() throws Exception { - this.createAnnotationAndMembers("Bar", "int value();"); - this.createAnnotationAndMembers("Foo", "annot.Bar[] value();"); - this.createTestType("@annot.Foo(@annot.Bar(00))"); - String expected = "@annot.Foo({null,@annot.Bar(00)})"; - this.assertSourceDoesNotContain(expected); - - IndexedDeclarationAnnotationAdapter idaa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "value", 0, "annot.Bar"); - IndexedAnnotationAdapter iaa = new MemberIndexedAnnotationAdapter(this.idField(), idaa); - Annotation annotation = iaa.getAnnotation(); - assertNotNull(annotation); - - iaa.moveAnnotation(1); - this.assertSourceContains(expected); - } - - public void testMoveAnnotation2() throws Exception { - this.createAnnotationAndMembers("Bar", "int value();"); - this.createAnnotationAndMembers("Foo", "annot.Bar[] value();"); - this.createTestType("@annot.Foo({null, @annot.Bar(11)})"); - String expected = "@annot.Foo(@annot.Bar(11))"; - this.assertSourceDoesNotContain(expected); - - IndexedDeclarationAnnotationAdapter idaa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "value", 1, "annot.Bar"); - IndexedAnnotationAdapter iaa = new MemberIndexedAnnotationAdapter(this.idField(), idaa); - Annotation annotation = iaa.getAnnotation(); - assertNotNull(annotation); - - iaa.moveAnnotation(0); - this.assertSourceContains(expected); - } - - public void testMoveAnnotation3() throws Exception { - this.createAnnotationAndMembers("Bar", "int value();"); - this.createAnnotationAndMembers("Foo", "annot.Bar[] value();"); - this.createTestType("@annot.Foo({@annot.Bar(00), @annot.Bar(11), @annot.Bar(22), @annot.Bar(33)})"); - String expected = "@annot.Foo({@annot.Bar(33), @annot.Bar(11), @annot.Bar(22)})"; - this.assertSourceDoesNotContain(expected); - - IndexedDeclarationAnnotationAdapter idaa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "value", 3, "annot.Bar"); - IndexedAnnotationAdapter iaa = new MemberIndexedAnnotationAdapter(this.idField(), idaa); - Annotation annotation = iaa.getAnnotation(); - assertNotNull(annotation); - - iaa.moveAnnotation(0); - this.assertSourceContains(expected); - } - - public void testMoveAnnotation4() throws Exception { - this.createAnnotationAndMembers("Bar", "int value();"); - this.createAnnotationAndMembers("Foo", "annot.Bar[] value();"); - this.createTestType("@annot.Foo({@annot.Bar(00), @annot.Bar(11), @annot.Bar(22), @annot.Bar(33), @annot.Bar(44)})"); - String expected = "@annot.Foo({@annot.Bar(33), @annot.Bar(11), @annot.Bar(22), null, @annot.Bar(44)})"; - this.assertSourceDoesNotContain(expected); - - IndexedDeclarationAnnotationAdapter idaa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "value", 3, "annot.Bar"); - IndexedAnnotationAdapter iaa = new MemberIndexedAnnotationAdapter(this.idField(), idaa); - Annotation annotation = iaa.getAnnotation(); - assertNotNull(annotation); - - iaa.moveAnnotation(0); - this.assertSourceContains(expected); - } - - public void testMoveAnnotation5() throws Exception { - this.createAnnotationAndMembers("Bar", "int value();"); - this.createAnnotationAndMembers("Foo", "annot.Bar[] value();"); - this.createTestType("@annot.Foo({@annot.Bar(00), @annot.Bar(11), @annot.Bar(22)})"); - String expected = "@annot.Foo({@annot.Bar(00), @annot.Bar(11), null, @annot.Bar(22)})"; - this.assertSourceDoesNotContain(expected); - - IndexedDeclarationAnnotationAdapter idaa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "value", 2, "annot.Bar"); - IndexedAnnotationAdapter iaa = new MemberIndexedAnnotationAdapter(this.idField(), idaa); - Annotation annotation = iaa.getAnnotation(); - assertNotNull(annotation); - - iaa.moveAnnotation(3); - this.assertSourceContains(expected); - } - - public void testMoveAnnotation6() throws Exception { - this.createAnnotationAndMembers("Bar", "int value();"); - this.createAnnotationAndMembers("Foo", "annot.Bar[] value();"); - this.createTestType("@annot.Foo({@annot.Bar(00), @annot.Bar(11), @annot.Bar(22)})"); - String expected = "@annot.Foo({null, @annot.Bar(11), @annot.Bar(22), @annot.Bar(00)})"; - this.assertSourceDoesNotContain(expected); - - IndexedDeclarationAnnotationAdapter idaa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "value", 0, "annot.Bar"); - IndexedAnnotationAdapter iaa = new MemberIndexedAnnotationAdapter(this.idField(), idaa); - Annotation annotation = iaa.getAnnotation(); - assertNotNull(annotation); - - iaa.moveAnnotation(3); - this.assertSourceContains(expected); - } - - public void testMoveAnnotation7() throws Exception { - this.createAnnotationAndMembers("Bar", "int value();"); - this.createAnnotationAndMembers("Foo", "annot.Bar[] value();"); - this.createTestType("@annot.Foo({@annot.Bar(00), @annot.Bar(11), @annot.Bar(22)})"); - String expected = "@annot.Foo({null, @annot.Bar(11), @annot.Bar(22)})"; - this.assertSourceDoesNotContain(expected); - - IndexedDeclarationAnnotationAdapter idaa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "value", 3, "annot.Bar"); - IndexedAnnotationAdapter iaa = new MemberIndexedAnnotationAdapter(this.idField(), idaa); - Annotation annotation = iaa.getAnnotation(); - assertNull(annotation); - - iaa.moveAnnotation(0); - this.assertSourceContains(expected); - } - - public void testMoveAnnotation8() throws Exception { - this.createAnnotationAndMembers("Bar", "int value();"); - this.createAnnotationAndMembers("Foo", "annot.Bar[] value();"); - this.createTestType("@annot.Foo({@annot.Bar(00), @annot.Bar(11), @annot.Bar(22), null, @annot.Bar(44)})"); - String expected = "@annot.Foo({null, @annot.Bar(11), @annot.Bar(22), null, @annot.Bar(44)})"; - this.assertSourceDoesNotContain(expected); - - IndexedDeclarationAnnotationAdapter idaa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "value", 3, "annot.Bar"); - IndexedAnnotationAdapter iaa = new MemberIndexedAnnotationAdapter(this.idField(), idaa); - Annotation annotation = iaa.getAnnotation(); - assertNull(annotation); - - iaa.moveAnnotation(0); - this.assertSourceContains(expected); - } - - public void testMoveAnnotation9() throws Exception { - this.createAnnotationAndMembers("Bar", "int value();"); - this.createAnnotationAndMembers("Foo", "annot.Bar[] value();"); - String expected = "@annot.Foo({null, @annot.Bar(11), @annot.Bar(22)})"; - this.createTestType(expected); // the source should be unchanged - - IndexedDeclarationAnnotationAdapter idaa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "value", 0, "annot.Bar"); - IndexedAnnotationAdapter iaa = new MemberIndexedAnnotationAdapter(this.idField(), idaa); - Annotation annotation = iaa.getAnnotation(); - assertNull(annotation); - - iaa.moveAnnotation(3); - this.assertSourceContains(expected); - } - - public void testMoveAnnotation10() throws Exception { - this.createAnnotationAndMembers("Bar", "int value();"); - this.createAnnotationAndMembers("Foo", "annot.Bar[] value();"); - this.createTestType("@annot.Foo({@annot.Bar(00), @annot.Bar(11)})"); - String expected = "@annot.Foo(@annot.Bar(00))"; - - IndexedDeclarationAnnotationAdapter idaa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "value", 2, "annot.Bar"); - IndexedAnnotationAdapter iaa = new MemberIndexedAnnotationAdapter(this.idField(), idaa); - Annotation annotation = iaa.getAnnotation(); - assertNull(annotation); - iaa.moveAnnotation(1); - this.assertSourceContains(expected); - } - - public void testMoveAnnotation11() throws Exception { - this.createAnnotationAndMembers("Bar", "int value();"); - this.createAnnotationAndMembers("Foo", "annot.Bar[] value();"); - this.createTestType("@annot.Foo(@annot.Bar(00))"); - - IndexedDeclarationAnnotationAdapter idaa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "value", 1, "annot.Bar"); - IndexedAnnotationAdapter iaa = new MemberIndexedAnnotationAdapter(this.idField(), idaa); - Annotation annotation = iaa.getAnnotation(); - assertNull(annotation); - - iaa.moveAnnotation(0); - this.assertSourceDoesNotContain("Foo"); - } - - public void testMoveAnnotation12() throws Exception { - this.createAnnotationAndMembers("Bar", "int value();"); - this.createAnnotationAndMembers("Foo", "annot.Bar[] value();"); - this.createTestType("@annot.Foo({@annot.Bar(00), null, @annot.Bar(22)})"); - String expected = "@annot.Foo(@annot.Bar(22))"; - - IndexedDeclarationAnnotationAdapter idaa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "value", 2, "annot.Bar"); - IndexedAnnotationAdapter iaa = new MemberIndexedAnnotationAdapter(this.idField(), idaa); - Annotation annotation = iaa.getAnnotation(); - assertNotNull(annotation); - - iaa.moveAnnotation(0); - this.assertSourceContains(expected); - } - - public void testMoveAnnotation13() throws Exception { - this.createAnnotationAndMembers("Bar", "int value();"); - this.createAnnotationAndMembers("Foo", "annot.Bar[] value();"); - this.createTestType("@annot.Foo({@annot.Bar(00), @annot.Bar(11), null, @annot.Bar(33)})"); - String expected = "@annot.Foo({@annot.Bar(33), @annot.Bar(11)})"; - - IndexedDeclarationAnnotationAdapter idaa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "value", 3, "annot.Bar"); - IndexedAnnotationAdapter iaa = new MemberIndexedAnnotationAdapter(this.idField(), idaa); - Annotation annotation = iaa.getAnnotation(); - assertNotNull(annotation); - - iaa.moveAnnotation(0); - this.assertSourceContains(expected); - } - -} diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/jdtutility/SimpleDeclarationAnnotationAdapterTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/jdtutility/SimpleDeclarationAnnotationAdapterTests.java deleted file mode 100644 index 0e014b66b5..0000000000 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/jdtutility/SimpleDeclarationAnnotationAdapterTests.java +++ /dev/null @@ -1,204 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2007 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.core.tests.internal.jdtutility; - -import org.eclipse.jdt.core.dom.ASTNode; -import org.eclipse.jdt.core.dom.Annotation; -import org.eclipse.jdt.core.dom.Expression; -import org.eclipse.jdt.core.dom.MemberValuePair; -import org.eclipse.jdt.core.dom.NormalAnnotation; -import org.eclipse.jdt.core.dom.NumberLiteral; -import org.eclipse.jdt.core.dom.SingleMemberAnnotation; -import org.eclipse.jdt.core.dom.StringLiteral; -import org.eclipse.jpt.core.internal.jdtutility.AnnotationAdapter; -import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationAdapter; -import org.eclipse.jpt.core.internal.jdtutility.Member; -import org.eclipse.jpt.core.internal.jdtutility.MemberAnnotationAdapter; -import org.eclipse.jpt.core.internal.jdtutility.ModifiedDeclaration; -import org.eclipse.jpt.core.internal.jdtutility.SimpleDeclarationAnnotationAdapter; - -public class SimpleDeclarationAnnotationAdapterTests extends AnnotationTestCase { - - public SimpleDeclarationAnnotationAdapterTests(String name) { - super(name); - } - - private void createAnnotation(String annotationName) throws Exception { - this.javaProject.createType("annot", annotationName + ".java", "public @interface " + annotationName + " {}"); - } - - public void testGetAnnotation1() throws Exception { - this.createAnnotation("Foo"); - this.createTestType("@annot.Foo"); - DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(), daa); - Annotation annotation = aa.getAnnotation(); - assertNotNull(annotation); - assertEquals("annot.Foo", annotation.getTypeName().getFullyQualifiedName()); - assertTrue(annotation.isMarkerAnnotation()); - } - - public void testGetAnnotation2() throws Exception { - this.createAnnotation("Foo"); - this.createTestType("@annot.Foo(1) @annot.Foo(2)"); - DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(), daa); - Annotation annotation = aa.getAnnotation(); - assertNotNull(annotation); - assertEquals("annot.Foo", annotation.getTypeName().getFullyQualifiedName()); - assertTrue(annotation.isSingleMemberAnnotation()); - Expression value = ((SingleMemberAnnotation) annotation).getValue(); - assertEquals(ASTNode.NUMBER_LITERAL, value.getNodeType()); - assertEquals("1", ((NumberLiteral) value).getToken()); - } - - public void testGetAnnotation3() throws Exception { - this.createAnnotation("Foo"); - this.createTestType("annot.Foo", "@Foo"); - DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(), daa); - Annotation annotation = aa.getAnnotation(); - assertNotNull(annotation); - assertEquals("Foo", annotation.getTypeName().getFullyQualifiedName()); - assertTrue(annotation.isMarkerAnnotation()); - } - - public void testGetAnnotationNull1() throws Exception { - this.createAnnotation("Foo"); - this.createTestType(); - DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(), daa); - Annotation annotation = aa.getAnnotation(); - assertNull(annotation); - } - - public void testGetAnnotationNull2() throws Exception { - this.createAnnotation("Foo"); - this.createAnnotation("Fop"); - this.createTestType("@annot.Fop"); - DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(), daa); - Annotation annotation = aa.getAnnotation(); - assertNull(annotation); - this.assertSourceContains("@annot.Fop"); - } - - public void testGetAnnotationNull3() throws Exception { - this.createAnnotation("Foo"); - this.createTestType("@annot.Foo"); - // un-qualified name - DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("Foo"); - AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(), daa); - Annotation annotation = aa.getAnnotation(); - assertNull(annotation); - this.assertSourceContains("@annot.Foo"); - } - - public void testRemoveAnnotation1() throws Exception { - this.createAnnotation("Foo"); - this.createTestType("@annot.Foo"); - this.assertSourceContains("@annot.Foo"); - DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(), daa); - Annotation annotation = aa.getAnnotation(); - assertNotNull(annotation); - - aa.removeAnnotation(); - this.assertSourceDoesNotContain("@annot.Foo"); - } - - public void testRemoveAnnotation2() throws Exception { - this.createAnnotation("Foo"); - this.createTestType("@annot.Foo(1) @annot.Foo(2)"); - this.assertSourceContains("@annot.Foo(1) @annot.Foo(2)"); - DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(), daa); - Annotation annotation = aa.getAnnotation(); - assertNotNull(annotation); - - aa.removeAnnotation(); - this.assertSourceDoesNotContain("@annot.Foo(1)"); - this.assertSourceContains("@annot.Foo(2)"); - } - - public void testNewMarkerAnnotation1() throws Exception { - this.createAnnotation("Foo"); - this.createTestType(); - this.assertSourceDoesNotContain("@annot.Foo"); - DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(), daa); - Annotation annotation = aa.getAnnotation(); - assertNull(annotation); - - aa.newMarkerAnnotation(); - this.assertSourceContains("import annot.Foo;"); - this.assertSourceContains("@Foo"); - } - - public void testNewMarkerAnnotation2() throws Exception { - this.createAnnotation("Foo"); - this.createTestType("@annot.Foo(88)"); - DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - AnnotationAdapter aa = new MemberAnnotationAdapter(this.idField(), daa); - Annotation annotation = aa.getAnnotation(); - assertNotNull(annotation); - - aa.newMarkerAnnotation(); - this.assertSourceContains("import annot.Foo;"); - this.assertSourceContains("@Foo"); - this.assertSourceDoesNotContain("@annot.Foo(88)"); - } - - public void testNewSingleMemberAnnotation() throws Exception { - this.createAnnotation("Foo"); - this.createTestType(); - this.assertSourceDoesNotContain("@Foo"); - this.idField().edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - SimpleDeclarationAnnotationAdapterTests.this.editNewSingleMemberAnnotation(declaration); - } - }); - this.assertSourceContains("import annot.Foo;"); - this.assertSourceContains("@Foo(\"test string literal\")"); - } - - void editNewSingleMemberAnnotation(ModifiedDeclaration declaration) { - DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - SingleMemberAnnotation annotation = (SingleMemberAnnotation) daa.getAnnotation(declaration); - assertNull(annotation); - annotation = daa.newSingleMemberAnnotation(declaration); - StringLiteral stringLiteral = annotation.getAST().newStringLiteral(); - stringLiteral.setLiteralValue("test string literal"); - annotation.setValue(stringLiteral); - } - - public void testNewNormalAnnotation() throws Exception { - this.createAnnotation("Foo"); - this.createTestType(); - this.assertSourceDoesNotContain("@Foo"); - this.idField().edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - SimpleDeclarationAnnotationAdapterTests.this.editNewNormalAnnotation(declaration); - } - }); - this.assertSourceContains("import annot.Foo;"); - this.assertSourceContains("@Foo(bar=\"test string literal\")"); - } - - void editNewNormalAnnotation(ModifiedDeclaration declaration) { - DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - NormalAnnotation annotation = (NormalAnnotation) daa.getAnnotation(declaration); - assertNull(annotation); - annotation = daa.newNormalAnnotation(declaration); - MemberValuePair mvp = this.newMemberValuePair(annotation.getAST(), "bar", "test string literal"); - this.values(annotation).add(mvp); - } - -} diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/jdtutility/TypeTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/jdtutility/TypeTests.java deleted file mode 100644 index 360a9145dd..0000000000 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/jdtutility/TypeTests.java +++ /dev/null @@ -1,67 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2007 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.core.tests.internal.jdtutility; - -import org.eclipse.jdt.core.IType; -import org.eclipse.jpt.core.internal.ITextRange; -import org.eclipse.jpt.core.internal.jdtutility.Type; - -public class TypeTests extends AnnotationTestCase { - - private IType jdtType; - private Type testType; - - - public TypeTests(String name) { - super(name); - } - - @Override - protected void setUp() throws Exception { - super.setUp(); - this.jdtType = this.createTestType(); - this.testType = new Type(this.jdtType); - } - - @Override - protected void tearDown() throws Exception { - this.testType = null; - this.jdtType = null; - super.tearDown(); - } - - public void testJdtType() throws Exception { - assertEquals(this.jdtType, this.testType.jdtType()); - } - - public void testIsAbstract() throws Exception { - assertFalse(this.testType.isAbstract()); - } - - public void testTopLevelDeclaringType() throws Exception { - assertEquals(this.testType, this.testType.topLevelDeclaringType()); - } - - public void testGetDeclaringType() throws Exception { - assertNull(this.testType.getDeclaringType()); - } - - public void testGetName() throws Exception { - assertEquals(TYPE_NAME, this.testType.getName()); - } - - public void testTextRange() throws Exception { - String source = this.jdtType.getOpenable().getBuffer().getContents(); - ITextRange textRange = this.testType.textRange(); - String body = source.substring(textRange.getOffset()); - assertTrue(body.startsWith("public class " + TYPE_NAME)); - } - -} diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/model/JptCoreModelTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/model/JptCoreModelTests.java deleted file mode 100644 index d7d2ffe080..0000000000 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/model/JptCoreModelTests.java +++ /dev/null @@ -1,27 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007 Oracle. All rights reserved. This - * program and the accompanying materials are made available under the terms of - * the Eclipse Public License v1.0 which accompanies this distribution, and is - * available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: Oracle. - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.core.tests.internal.model; - -import junit.framework.Test; -import junit.framework.TestSuite; - -public class JptCoreModelTests { - - public static Test suite() { - TestSuite suite = new TestSuite(JptCoreModelTests.class.getPackage().getName()); - suite.addTestSuite(ModelInitializationTests.class); - return suite; - } - - private JptCoreModelTests() { - super(); - throw new UnsupportedOperationException(); - } - -} diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/model/ModelInitializationTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/model/ModelInitializationTests.java deleted file mode 100644 index 620ec258a1..0000000000 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/model/ModelInitializationTests.java +++ /dev/null @@ -1,90 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2007 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.core.tests.internal.model; - -import junit.framework.TestCase; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.Path; -import org.eclipse.jpt.core.internal.IJpaModel; -import org.eclipse.jpt.core.internal.IJpaProject; -import org.eclipse.jpt.core.internal.JptCorePlugin; -import org.eclipse.jpt.core.tests.internal.ProjectUtility; -import org.eclipse.jpt.core.tests.internal.projects.TestFacetedProject; -import org.eclipse.jpt.utility.internal.ClassTools; -import org.eclipse.jpt.utility.internal.CollectionTools; - -public class ModelInitializationTests extends TestCase { - private IJpaModel jpaModel; - - - public ModelInitializationTests(String name) { - super(name); - } - - @Override - protected void setUp() throws Exception { - super.setUp(); - ProjectUtility.deleteAllProjects(); - this.jpaModel = JptCorePlugin.getJpaModel(); - } - - @Override - protected void tearDown() throws Exception { - ProjectUtility.deleteAllProjects(); - this.jpaModel = null; - super.tearDown(); - } - - /** - * Builds a project with the java and utility facets installed, and with - * pre-existing entities added. - */ - private TestFacetedProject buildTestProject() throws CoreException { - TestFacetedProject testProject = new TestFacetedProject(ClassTools.shortClassNameForObject(this), true); - testProject.installFacet("jst.java", "5.0"); - testProject.installFacet("jst.utility", "1.0"); - testProject.createFile( - new Path("src/test.pkg/TestEntity.java"), - "package test.pkg; @Entity public class TestEntity {}"); - testProject.createFile( - new Path("src/test.pkg/TestEntity2.java"), - "package test.pkg; @Entity public class TestEntity2 {}"); - return testProject; - } - - public void testBasic() { - assertNotNull(this.jpaModel); - } - - public void testFacetInstallation() throws CoreException { - TestFacetedProject testProject = buildTestProject(); - assertNull(this.jpaModel.getJpaProject(testProject.getProject())); - testProject.installFacet("jpt.jpa", "1.0"); - assertEquals(1, CollectionTools.size(this.jpaModel.jpaProjects())); - IJpaProject jpaProject = this.jpaModel.getJpaProject(testProject.getProject()); - assertNotNull(jpaProject); - assertEquals(4, CollectionTools.size(jpaProject.jpaFiles())); - assertNotNull(jpaProject.getJpaFile(testProject.getProject().getFile(new Path("src/test.pkg/TestEntity.java")))); - assertNotNull(jpaProject.getJpaFile(testProject.getProject().getFile(new Path("src/test.pkg/TestEntity2.java")))); - } - - public void testProjectOpening() throws CoreException { - TestFacetedProject testProject = buildTestProject(); - testProject.installFacet("jpt.jpa", "1.0"); - testProject.close(); - assertTrue(! testProject.getProject().isOpen()); - testProject.open(); - IJpaProject jpaProject = this.jpaModel.getJpaProject(testProject.getProject()); - assertNotNull(jpaProject); - assertNotNull(jpaProject.getJpaFile(testProject.getProject().getFile(new Path("src/test.pkg/TestEntity.java")))); - assertNotNull(jpaProject.getJpaFile(testProject.getProject().getFile(new Path("src/test.pkg/TestEntity2.java")))); - } - -} diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/projects/TestFacetedProject.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/projects/TestFacetedProject.java deleted file mode 100644 index 6b638fa21b..0000000000 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/projects/TestFacetedProject.java +++ /dev/null @@ -1,48 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2007 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.core.tests.internal.projects; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.wst.common.project.facet.core.IFacetedProject; -import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion; -import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager; - -public class TestFacetedProject extends TestPlatformProject { - private IFacetedProject facetedProject; - - - // ********** constructors/initialization ********** - - public TestFacetedProject(String projectName) throws CoreException { - this(projectName, true); - } - - public TestFacetedProject(String projectName, boolean autoBuild) throws CoreException { - super(projectName, autoBuild); - this.facetedProject = this.createFacetedProject(); - } - - private IFacetedProject createFacetedProject() throws CoreException { - return ProjectFacetsManager.create(this.getProject(), true, null); // true = "convert if necessary" - } - - - // ********** public methods ********** - - public IFacetedProject getFacetedProject() { - return this.facetedProject; - } - - public void installFacet(String facetName, String versionName) throws CoreException { - IProjectFacetVersion facetVersion = ProjectFacetsManager.getProjectFacet(facetName).getVersion(versionName); - this.facetedProject.installProjectFacet(facetVersion, null, null); - } - -} diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/projects/TestJavaProject.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/projects/TestJavaProject.java deleted file mode 100644 index a19529b0e1..0000000000 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/projects/TestJavaProject.java +++ /dev/null @@ -1,148 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2007 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.core.tests.internal.projects; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.Path; -import org.eclipse.jdt.core.IClasspathEntry; -import org.eclipse.jdt.core.ICompilationUnit; -import org.eclipse.jdt.core.IJavaElement; -import org.eclipse.jdt.core.IJavaProject; -import org.eclipse.jdt.core.IPackageFragment; -import org.eclipse.jdt.core.IPackageFragmentRoot; -import org.eclipse.jdt.core.IType; -import org.eclipse.jdt.core.JavaCore; -import org.eclipse.jdt.core.JavaModelException; -import org.eclipse.jdt.core.search.IJavaSearchConstants; -import org.eclipse.jdt.core.search.SearchEngine; -import org.eclipse.jdt.core.search.SearchPattern; -import org.eclipse.jdt.core.search.TypeNameRequestor; -import org.eclipse.jpt.utility.internal.CollectionTools; - -/** - * This builds and holds a "Java" project. - * Support for adding packages and types. - */ -public class TestJavaProject extends TestFacetedProject { - - private IJavaProject javaProject; - private IPackageFragmentRoot sourceFolder; - - - // ********** constructors/initialization ********** - - public TestJavaProject() throws CoreException { - this("TestJavaProject"); - } - - public TestJavaProject(String projectName) throws CoreException { - this(projectName, false); - } - - public TestJavaProject(String projectName, boolean autoBuild) throws CoreException { - super(projectName, autoBuild); - this.installFacet("jst.java", "5.0"); - this.javaProject = JavaCore.create(this.getProject()); - this.sourceFolder = this.javaProject.getPackageFragmentRoot(this.getProject().getFolder("src")); - } - - protected void addJar(String jarPath) throws JavaModelException { - this.addClasspathEntry(JavaCore.newLibraryEntry(new Path(jarPath), null, null)); - } - - private void addClasspathEntry(IClasspathEntry entry) throws JavaModelException { - this.javaProject.setRawClasspath(CollectionTools.add(this.javaProject.getRawClasspath(), entry), null); - } - - - // ********** public methods ********** - - public IPackageFragment createPackage(String packageName) throws CoreException { - return this.sourceFolder.createPackageFragment(packageName, false, null); // false = "no force" - } - - /** - * The source should NOT contain a package declaration; - * it will be added here. - */ - public IType createType(String packageName, String compilationUnitName, String source) throws CoreException { - return this.createType(this.createPackage(packageName), compilationUnitName, new SimpleSourceWriter(source)); - } - - /** - * The source should NOT contain a package declaration; - * it will be added here. - */ - public IType createType(String packageName, String compilationUnitName, SourceWriter sourceWriter) throws CoreException { - return this.createType(this.createPackage(packageName), compilationUnitName, sourceWriter); - } - - /** - * The source should NOT contain a package declaration; - * it will be added here. - */ - public IType createType(IPackageFragment packageFragment, String compilationUnitName, SourceWriter sourceWriter) throws CoreException { - StringBuffer sb = new StringBuffer(2000); - sb.append("package ").append(packageFragment.getElementName()).append(";").append(CR); - sb.append(CR); - sourceWriter.appendSourceTo(sb); - String source = sb.toString(); - ICompilationUnit cu = packageFragment.createCompilationUnit(compilationUnitName, source, false, null); // false = "no force" - return cu.findPrimaryType(); - } - - public IType findType(String fullyQualifiedName) throws JavaModelException { - return this.javaProject.findType(fullyQualifiedName); - } - - @Override - public void dispose() throws CoreException { - this.waitForIndexer(); - this.sourceFolder = null; - this.javaProject = null; - super.dispose(); - } - - - // ********** internal methods ********** - - private void waitForIndexer() throws JavaModelException { - new SearchEngine().searchAllTypeNames( - null, - SearchPattern.R_EXACT_MATCH | SearchPattern.R_CASE_SENSITIVE, - null, - SearchPattern.R_EXACT_MATCH | SearchPattern.R_CASE_SENSITIVE, - IJavaSearchConstants.CLASS, - SearchEngine.createJavaSearchScope(new IJavaElement[0]), - new TypeNameRequestor() {/* do nothing */}, - IJavaSearchConstants.WAIT_UNTIL_READY_TO_SEARCH, - null - ); - } - - - // ********** member classes ********** - - public interface SourceWriter { - void appendSourceTo(StringBuffer sb); - } - - public class SimpleSourceWriter implements SourceWriter { - private final String source; - public SimpleSourceWriter(String source) { - super(); - this.source = source; - } - public void appendSourceTo(StringBuffer sb) { - sb.append(source); - } - } - -} diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/projects/TestJpaProject.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/projects/TestJpaProject.java deleted file mode 100644 index 68f01e8f2b..0000000000 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/projects/TestJpaProject.java +++ /dev/null @@ -1,60 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2007 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.core.tests.internal.projects; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.jpt.core.internal.IJpaProject; -import org.eclipse.jpt.core.internal.JptCorePlugin; - -public class TestJpaProject extends TestJavaProject { - private IJpaProject jpaProject; - - public static final String JAR_NAME_SYSTEM_PROPERTY = "org.eclipse.jpt.jpa.jar"; - - // ********** constructors/initialization ********** - - public TestJpaProject() throws CoreException { - this("TestJpaProject"); - } - - public TestJpaProject(String projectName) throws CoreException { - this(projectName, false); - } - - public TestJpaProject(String projectName, boolean autoBuild) throws CoreException { - super(projectName, autoBuild); - this.installFacet("jst.utility", "1.0"); - this.installFacet("jpt.jpa", "1.0"); - this.addJar(this.jarName()); - this.jpaProject = JptCorePlugin.getJpaProject(this.getProject()); - } - - protected String jarName() { - String jarName = System.getProperty(JAR_NAME_SYSTEM_PROPERTY); - if (jarName == null) { - throw new RuntimeException("missing Java system property: \"" + JAR_NAME_SYSTEM_PROPERTY + "\""); - } - return jarName; - } - - - // ********** public methods ********** - - public IJpaProject getJpaProject() { - return this.jpaProject; - } - - @Override - public void dispose() throws CoreException { - this.jpaProject = null; - super.dispose(); - } - -} diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/projects/TestPlatformProject.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/projects/TestPlatformProject.java deleted file mode 100644 index 7fbca7957d..0000000000 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/projects/TestPlatformProject.java +++ /dev/null @@ -1,195 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2007 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.core.tests.internal.projects; - -import java.io.ByteArrayInputStream; -import java.io.InputStream; -import org.eclipse.core.resources.IContainer; -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IFolder; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IProjectDescription; -import org.eclipse.core.resources.IWorkspaceDescription; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.Path; -import org.eclipse.core.runtime.jobs.Job; -import org.eclipse.jpt.utility.internal.CollectionTools; - -/** - * This builds and holds a "general" project. - * Support for adding natures, folders, and files. - */ -public class TestPlatformProject { - - private final IProject project; - - /** carriage return */ - public static final String CR = System.getProperty("line.separator"); - - - // ********** constructors/initialization ********** - - public TestPlatformProject() throws CoreException { - this(false); - } - - public TestPlatformProject(boolean autoBuild) throws CoreException { - this("TestProject", autoBuild); - } - - public TestPlatformProject(String projectName, boolean autoBuild) throws CoreException { - super(); - this.setAutoBuild(autoBuild); // workspace-wide setting - this.project = this.createPlatformProject(projectName); - } - - private void setAutoBuild(boolean autoBuild) throws CoreException { - IWorkspaceDescription description = ResourcesPlugin.getWorkspace().getDescription(); - description.setAutoBuilding(autoBuild); - ResourcesPlugin.getWorkspace().setDescription(description); - } - - private IProject createPlatformProject(String projectName) throws CoreException { - IProject p = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName); - p.create(null); - p.open(null); - return p; - } - - - // ********** public methods ********** - - public IProject getProject() { - return this.project; - } - - public void addProjectNature(String natureID) throws CoreException { - IProjectDescription description = this.project.getDescription(); - description.setNatureIds((String[]) CollectionTools.add(description.getNatureIds(), natureID)); - this.project.setDescription(description, null); - } - - public void removeProjectNature(String natureID) throws CoreException { - IProjectDescription description = this.project.getDescription(); - description.setNatureIds((String[]) CollectionTools.removeAllOccurrences(description.getNatureIds(), natureID)); - this.project.setDescription(description, null); - } - - /** - * Create a folder with the specified name directly under the project. - */ - public IFolder createFolder(String folderName) throws CoreException { - return this.createFolder(this.project, new Path(folderName)); - } - - /** - * Create a folder in the specified container with the specified name. - */ - public IFolder createFolder(IContainer container, String folderName) throws CoreException { - return this.createFolder(container, new Path(folderName)); - } - - /** - * Create a folder in the specified container with the specified path. - */ - public IFolder createFolder(IContainer container, IPath folderPath) throws CoreException { - IFolder folder = container.getFolder(folderPath); - if ( ! folder.exists()) { - folder.create(false, true, null); // false = "no force"; true = "local" - } - return folder; - } - - /** - * Create a file with the specified name and content directly under the project. - */ - public IFile createFile(String fileName, String content) throws CoreException { - return this.createFile(this.project, fileName, content); - } - - /** - * Create a file in the specified container with the specified name and content. - */ - public IFile createFile(IContainer container, String fileName, String content) throws CoreException { - return createFile(container, new Path(fileName), content); - } - - /** - * Create a file in the project with the specified [relative] path - * and content. - */ - public IFile createFile(IPath filePath, String content) throws CoreException { - return this.createFile(this.project, filePath, content); - } - - /** - * Create a file in the specified container with the specified path and content. - */ - public IFile createFile(IContainer container, IPath filePath, String content) throws CoreException { - return this.createFile(container, filePath, new ByteArrayInputStream(content.getBytes())); - } - - /** - * Create a file in the specified container with the specified path and contents. - */ - public IFile createFile(IContainer container, IPath filePath, InputStream content) throws CoreException { - int len = filePath.segmentCount() - 1; - for (int i = 0; i < len; i++) { - container = container.getFolder(new Path(filePath.segment(i))); - if ( ! container.exists()) { - ((IFolder) container).create(true, true, null); // true = "force"; true = "local" - } - } - - IFile file = container.getFile(new Path(filePath.lastSegment())); - if (file.exists()) { - file.delete(true, null); // true = "force" - } - file.create(content, true, null); // true = "force" - return file; - } - - public void open() throws CoreException { - this.project.open(null); - waitForJobs(); - } - - public void close() throws CoreException { - this.project.close(null); - waitForJobs(); - } - - public void dispose() throws CoreException { - this.project.delete(true, true, null); // true = "delete content"; true = "force" - for (int i = 1; this.project.exists(); i++) { - waitForJobs(); - System.out.println("Project still exists: " + i); - } - } - - - // ********** static methods ********** - - /** - * Wait until all background tasks are complete. - */ - public static void waitForJobs() { - while (Job.getJobManager().currentJob() != null) { - try { - Thread.sleep(100); // let other threads get something done - } catch (InterruptedException ex) { - throw new RuntimeException(ex); - } - } - } - -} diff --git a/jpa/tests/org.eclipse.jpt.core.tests/test.xml b/jpa/tests/org.eclipse.jpt.core.tests/test.xml deleted file mode 100644 index 702dee3626..0000000000 --- a/jpa/tests/org.eclipse.jpt.core.tests/test.xml +++ /dev/null @@ -1,44 +0,0 @@ -<?xml version="1.0"?> -<project name="testsuite" default="run" basedir="."> - <!-- The property ${eclipse-home} should be passed into this script --> - <!-- Set a meaningful default value for when it is not. --> - <echo message="basedir ${basedir}" /> - <echo message="eclipse place ${eclipse-home}" /> - <!-- sets the properties plugin-name, and library-file --> - <property name="plugin-name" value="org.eclipse.jpt.core.tests"/> - <property name="library-file" value="${eclipse-home}/plugins/org.eclipse.test_3.1.0/library.xml"/> - - <!-- This target holds all initialization code that needs to be done for --> - <!-- all tests that are to be run. Initialization for individual tests --> - <!-- should be done within the body of the suite target. --> - <target name="init"> - <tstamp/> - <delete> - <fileset dir="${eclipse-home}" includes="org*.xml"/> - </delete> - </target> - - <!-- This target defines the tests that need to be run. --> - <target name="suite"> - <ant target="core-test" antfile="${library-file}" dir="${eclipse-home}"> - <property name="plugin-name" value="${plugin-name}"/> - <property name="classname" value="org.eclipse.jpt.core.tests.internal.JptCoreTests" /> - <property name="plugin-path" value="${eclipse-home}/plugins/${plugin-name}"/> - </ant> - </target> - - <!-- This target holds code to cleanup the testing environment after --> - <!-- after all of the tests have been run. You can use this target to --> - <!-- delete temporary files that have been created. --> - <target name="cleanup"> - </target> - - <!-- This target runs the test suite. Any actions that need to happen --> - <!-- after all the tests have been run should go here. --> - <target name="run" depends="init,suite,cleanup"> - <ant target="collect" antfile="${library-file}" dir="${eclipse-home}"> - <property name="includes" value="org*.xml"/> - <property name="output-file" value="${plugin-name}.xml"/> - </ant> - </target> -</project>
\ No newline at end of file diff --git a/jpa/tests/org.eclipse.jpt.db.tests/.classpath b/jpa/tests/org.eclipse.jpt.db.tests/.classpath deleted file mode 100644 index 751c8f2e50..0000000000 --- a/jpa/tests/org.eclipse.jpt.db.tests/.classpath +++ /dev/null @@ -1,7 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<classpath> - <classpathentry kind="src" path="src"/> - <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> - <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> - <classpathentry kind="output" path="bin"/> -</classpath> diff --git a/jpa/tests/org.eclipse.jpt.db.tests/.cvsignore b/jpa/tests/org.eclipse.jpt.db.tests/.cvsignore deleted file mode 100644 index ba077a4031..0000000000 --- a/jpa/tests/org.eclipse.jpt.db.tests/.cvsignore +++ /dev/null @@ -1 +0,0 @@ -bin diff --git a/jpa/tests/org.eclipse.jpt.db.tests/.project b/jpa/tests/org.eclipse.jpt.db.tests/.project deleted file mode 100644 index f5b0127a1e..0000000000 --- a/jpa/tests/org.eclipse.jpt.db.tests/.project +++ /dev/null @@ -1,28 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<projectDescription> - <name>org.eclipse.jpt.db.tests</name> - <comment></comment> - <projects> - </projects> - <buildSpec> - <buildCommand> - <name>org.eclipse.jdt.core.javabuilder</name> - <arguments> - </arguments> - </buildCommand> - <buildCommand> - <name>org.eclipse.pde.ManifestBuilder</name> - <arguments> - </arguments> - </buildCommand> - <buildCommand> - <name>org.eclipse.pde.SchemaBuilder</name> - <arguments> - </arguments> - </buildCommand> - </buildSpec> - <natures> - <nature>org.eclipse.pde.PluginNature</nature> - <nature>org.eclipse.jdt.core.javanature</nature> - </natures> -</projectDescription> diff --git a/jpa/tests/org.eclipse.jpt.db.tests/META-INF/MANIFEST.MF b/jpa/tests/org.eclipse.jpt.db.tests/META-INF/MANIFEST.MF deleted file mode 100644 index eb01aca9ac..0000000000 --- a/jpa/tests/org.eclipse.jpt.db.tests/META-INF/MANIFEST.MF +++ /dev/null @@ -1,16 +0,0 @@ -Manifest-Version: 1.0 -Bundle-ManifestVersion: 2 -Bundle-Name: %pluginName -Bundle-Vendor: %providerName -Bundle-SymbolicName: org.eclipse.jpt.db.tests -Bundle-Version: 1.0.0.qualifier -Bundle-Activator: org.eclipse.jpt.db.tests.internal.JptDbTestsPlugin -Bundle-Localization: plugin -Eclipse-LazyStart: false -Require-Bundle: org.eclipse.core.runtime, - org.junit, - org.eclipse.datatools.connectivity, - org.eclipse.datatools.connectivity.db.generic, - org.eclipse.jpt.utility, - org.eclipse.jpt.db -Export-Package: org.eclipse.jpt.db.tests.internal.platforms diff --git a/jpa/tests/org.eclipse.jpt.db.tests/build.properties b/jpa/tests/org.eclipse.jpt.db.tests/build.properties deleted file mode 100644 index cd0d010fd1..0000000000 --- a/jpa/tests/org.eclipse.jpt.db.tests/build.properties +++ /dev/null @@ -1,15 +0,0 @@ -############################################################################### -# Copyright (c) 2007 Oracle. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# Oracle - initial API and implementation -############################################################################### -source.. = src/ -output.. = bin/ -bin.includes = .,\ - META-INF/,\ - plugin.properties diff --git a/jpa/tests/org.eclipse.jpt.db.tests/config/derby101.properties b/jpa/tests/org.eclipse.jpt.db.tests/config/derby101.properties deleted file mode 100644 index 6101413bc8..0000000000 --- a/jpa/tests/org.eclipse.jpt.db.tests/config/derby101.properties +++ /dev/null @@ -1,30 +0,0 @@ -############################################################################### -# Copyright (c) 2007 Oracle. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# Oracle - initial API and implementation -############################################################################### -# Platform Property names & Default -# -# profileName - jpatest -# profileDescription - JDBC Profile for JPA Testing -# userName - jpatest -# userPassword - (empty) -# databasedriverJarList - (mandatory) -# databaseName - testdb -# databaseUrl - (mandatory) -# -profileName = derby101 -profileDescription = Derby Embedded JDBC Profile for Testing -# set user name -userName = jpatest -userPassword = -# set path to Derby driver here (example: databasedriverJarList = c:/derbydb/lib/derby.jar ) -databasedriverJarList = -databaseName = testdb -# set database URL here (example: databaseUrl = jdbc:derby:c:/derbydb/testdb;create=true ) -databaseUrl = diff --git a/jpa/tests/org.eclipse.jpt.db.tests/config/oracle10g.properties b/jpa/tests/org.eclipse.jpt.db.tests/config/oracle10g.properties deleted file mode 100644 index 498fc7deb5..0000000000 --- a/jpa/tests/org.eclipse.jpt.db.tests/config/oracle10g.properties +++ /dev/null @@ -1,29 +0,0 @@ -############################################################################### -# Copyright (c) 2007 Oracle. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# Oracle - initial API and implementation -############################################################################### -# Platform Property names & Default -# -# profileName - jpatest -# profileDescription - JDBC Profile for JPA Testing -# userName - jpatest -# userPassword - (empty) -# databasedriverJarList - jar list separate by comma (mandatory) -# databaseName - testdb -# databaseUrl - (mandatory) -# -profileName = oracleXE10g -profileDescription = XE 10g Release 2 (10.2) Thin JDBC Profile for Testing -userName = scott -userPassword = tiger -# set path to Oracle driver here (example: databasedriverJarList = c:/oracle/jdbc/lib/ojdbc14.jar ) -databasedriverJarList = -databaseName = testdb -# set database URL here (example: databaseUrl = jdbc:oracle:thin:@localhost:1521:testdb ) -databaseUrl = diff --git a/jpa/tests/org.eclipse.jpt.db.tests/config/oracle9i.properties b/jpa/tests/org.eclipse.jpt.db.tests/config/oracle9i.properties deleted file mode 100644 index 3207919153..0000000000 --- a/jpa/tests/org.eclipse.jpt.db.tests/config/oracle9i.properties +++ /dev/null @@ -1,29 +0,0 @@ -############################################################################### -# Copyright (c) 2007 Oracle. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# Oracle - initial API and implementation -############################################################################### -# Platform Property names & Default -# -# profileName - jpatest -# profileDescription - JDBC Profile for JPA Testing -# userName - jpatest -# userPassword - (empty) -# databasedriverJarList - jar list separate by comma (mandatory) -# databaseName - testdb -# databaseUrl - (mandatory) -# -profileName = oracle9i -profileDescription = Oracle Thin JDBC Profile for Testing -userName = scott -userPassword = tiger -# set path to Oracle driver here (example: databasedriverJarList = c:/oracle/jdbc/lib/ojdbc14.jar ) -databasedriverJarList = -databaseName = testdb -# set database URL here (example: databaseUrl = jdbc:oracle:thin:@server:1521:testdb ) -databaseUrl = diff --git a/jpa/tests/org.eclipse.jpt.db.tests/config/sqlserver2005.properties b/jpa/tests/org.eclipse.jpt.db.tests/config/sqlserver2005.properties deleted file mode 100644 index 8451351e83..0000000000 --- a/jpa/tests/org.eclipse.jpt.db.tests/config/sqlserver2005.properties +++ /dev/null @@ -1,30 +0,0 @@ -############################################################################### -# Copyright (c) 2007 Oracle. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# Oracle - initial API and implementation -############################################################################### -# Platform Property names & Default -# -# profileName - jpatest -# profileDescription - JDBC Profile for JPA Testing -# userName - jpatest -# userPassword - (empty) -# databasedriverJarList - (mandatory) -# databaseName - testdb -# databaseUrl - (mandatory) -# -profileName = sqlserver2005 -profileDescription = MS SQL Server 2005 JDBC Profile for Testing -# set user name -userName = -userPassword = -# set path to Derby driver here (example: databasedriverJarList = c:/sqlserver/lib/sqljdbc.jar ) -databasedriverJarList = -databaseName = testdb -# set database URL here (example: databaseUrl = jdbc:sqlserver://localhost:1433;databaseName=testdb ) -databaseUrl = diff --git a/jpa/tests/org.eclipse.jpt.db.tests/plugin.properties b/jpa/tests/org.eclipse.jpt.db.tests/plugin.properties deleted file mode 100644 index b04fe27976..0000000000 --- a/jpa/tests/org.eclipse.jpt.db.tests/plugin.properties +++ /dev/null @@ -1,25 +0,0 @@ -############################################################################### -# Copyright (c) 2007 Oracle. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# Oracle - initial API and implementation -############################################################################### -# ==================================================================== -# To code developer: -# Do NOT change the properties between this line and the -# "%%% END OF TRANSLATED PROPERTIES %%%" line. -# Make a new property name, append to the end of the file and change -# the code to use the new property. -# ==================================================================== - -# ==================================================================== -# %%% END OF TRANSLATED PROPERTIES %%% -# ==================================================================== - -pluginName = JPA DB Tests -providerName = Eclipse.org - diff --git a/jpa/tests/org.eclipse.jpt.db.tests/src/org/eclipse/jpt/db/tests/internal/JptDbTests.java b/jpa/tests/org.eclipse.jpt.db.tests/src/org/eclipse/jpt/db/tests/internal/JptDbTests.java deleted file mode 100644 index 2326ea3d94..0000000000 --- a/jpa/tests/org.eclipse.jpt.db.tests/src/org/eclipse/jpt/db/tests/internal/JptDbTests.java +++ /dev/null @@ -1,39 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2007 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the terms of - * the Eclipse Public License v1.0, which accompanies this distribution and is available at - * http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.db.tests.internal; - -import junit.framework.Test; -import junit.framework.TestSuite; -import junit.swingui.TestRunner; -import org.eclipse.jpt.db.tests.internal.platforms.AllPlatformTests; -import org.eclipse.jpt.utility.internal.ClassTools; - -/** - * JptDbTests - */ -public class JptDbTests { - - public static void main( String[] args) { - TestRunner.main( new String[] { "-c", JptDbTests.class.getName()}); - } - - public static Test suite() { - TestSuite suite = new TestSuite( ClassTools.packageNameFor( JptDbTests.class)); - - suite.addTest( AllPlatformTests.suite()); - - return suite; - } - - private JptDbTests() { - super(); - throw new UnsupportedOperationException(); - } -} diff --git a/jpa/tests/org.eclipse.jpt.db.tests/src/org/eclipse/jpt/db/tests/internal/JptDbTestsPlugin.java b/jpa/tests/org.eclipse.jpt.db.tests/src/org/eclipse/jpt/db/tests/internal/JptDbTestsPlugin.java deleted file mode 100644 index dfced34598..0000000000 --- a/jpa/tests/org.eclipse.jpt.db.tests/src/org/eclipse/jpt/db/tests/internal/JptDbTestsPlugin.java +++ /dev/null @@ -1,54 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2007 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the terms of - * the Eclipse Public License v1.0, which accompanies this distribution and is available at - * http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.db.tests.internal; - -import org.eclipse.core.runtime.Plugin; -import org.osgi.framework.BundleContext; - -/** - * JptDbTestsPlugin - */ -public class JptDbTestsPlugin extends Plugin { - - // The shared instance - private static JptDbTestsPlugin plugin; - - public static final String BUNDLE_ID = "org.eclipse.jpt.db.tests"; //$NON-NLS-1$ - - /** - * Returns the shared instance - */ - public static JptDbTestsPlugin getDefault() { - return plugin; - } - - /** - * The constructor - */ - public JptDbTestsPlugin() { - super(); - plugin = this; - } - - /** - * This method is called upon plug-in activation - */ - public void start(BundleContext context) throws Exception { - super.start(context); - } - - /** - * This method is called when the plug-in is stopped - */ - public void stop(BundleContext context) throws Exception { - plugin = null; - super.stop(context); - } -} diff --git a/jpa/tests/org.eclipse.jpt.db.tests/src/org/eclipse/jpt/db/tests/internal/platforms/AllPlatformTests.java b/jpa/tests/org.eclipse.jpt.db.tests/src/org/eclipse/jpt/db/tests/internal/platforms/AllPlatformTests.java deleted file mode 100644 index af9c4233cc..0000000000 --- a/jpa/tests/org.eclipse.jpt.db.tests/src/org/eclipse/jpt/db/tests/internal/platforms/AllPlatformTests.java +++ /dev/null @@ -1,42 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2007 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the terms of - * the Eclipse Public License v1.0, which accompanies this distribution and is available at - * http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.db.tests.internal.platforms; - -import junit.framework.Test; -import junit.framework.TestSuite; -import junit.swingui.TestRunner; -import org.eclipse.jpt.utility.internal.ClassTools; - -/** - * AllPlatformTests - */ -public class AllPlatformTests { - - public static void main( String[] args) { - TestRunner.main( new String[] { "-c", AllPlatformTests.class.getName()}); - } - - public static Test suite() { - TestSuite suite = new TestSuite( ClassTools.packageNameFor( AllPlatformTests.class)); - - // TODO - Uncomment the platform to test. -// suite.addTest( Derby101Tests.suite()); -// suite.addTest( Oracle9iTests.suite()); -// suite.addTest( Oracle10gTests.suite()); -// suite.addTest( SQLServer2005Tests.suite()); - - return suite; - } - - private AllPlatformTests() { - super(); - } - -}
\ No newline at end of file diff --git a/jpa/tests/org.eclipse.jpt.db.tests/src/org/eclipse/jpt/db/tests/internal/platforms/DTPPlatformTests.java b/jpa/tests/org.eclipse.jpt.db.tests/src/org/eclipse/jpt/db/tests/internal/platforms/DTPPlatformTests.java deleted file mode 100644 index 46deffc7a6..0000000000 --- a/jpa/tests/org.eclipse.jpt.db.tests/src/org/eclipse/jpt/db/tests/internal/platforms/DTPPlatformTests.java +++ /dev/null @@ -1,385 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 - 2007 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the terms of - * the Eclipse Public License v1.0, which accompanies this distribution and is available at - * http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.db.tests.internal.platforms; - -import java.io.File; -import java.io.IOException; -import java.net.URL; -import java.util.ArrayList; -import java.util.Collection; -import java.util.NoSuchElementException; -import java.util.Properties; -import junit.framework.Assert; -import junit.framework.TestCase; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.Platform; -import org.eclipse.datatools.connectivity.ConnectionProfileException; -import org.eclipse.datatools.connectivity.IConnectionProfile; -import org.eclipse.datatools.connectivity.ProfileManager; -import org.eclipse.datatools.connectivity.db.generic.IDBDriverDefinitionConstants; -import org.eclipse.datatools.connectivity.drivers.IDriverMgmtConstants; -import org.eclipse.datatools.connectivity.drivers.IPropertySet; -import org.eclipse.datatools.connectivity.drivers.PropertySetImpl; -import org.eclipse.datatools.connectivity.drivers.XMLFileManager; -import org.eclipse.datatools.connectivity.internal.ConnectivityPlugin; -import org.eclipse.jpt.db.internal.Connection; -import org.eclipse.jpt.db.internal.ConnectionProfile; -import org.eclipse.jpt.db.internal.ConnectionProfileRepository; -import org.eclipse.jpt.db.internal.DTPConnectionProfileWrapper; -import org.eclipse.jpt.db.internal.Database; -import org.eclipse.jpt.db.internal.Schema; -import org.eclipse.jpt.db.internal.Table; -import org.eclipse.jpt.db.tests.internal.JptDbTestsPlugin; -import org.eclipse.jpt.utility.internal.CollectionTools; -import org.eclipse.jpt.utility.internal.StringTools; - -/** - * Base class for all supported DTP platform. - */ -public abstract class DTPPlatformTests extends TestCase { - - protected ConnectionProfileRepository connectionRepository; - - private Properties platformProperties; - private String currentDbVendor; - private String currentDbVersion; - - private static final String PLATFORM_CONFIG_DIRECTORY = "config"; //$NON-NLS-1$ - - private static final String PROFILE_NAME_PROPERTY = "profileName"; //$NON-NLS-1$ - private static final String PROFILE_DESCRIPTION_PROPERTY = "profileDescription"; //$NON-NLS-1$ - private static final String USER_NAME_PROPERTY = "userName"; //$NON-NLS-1$ - private static final String USER_PASSWORD_PROPERTY = "userPassword"; //$NON-NLS-1$ - private static final String DB_DRIVER_JAR_PROPERTY = "databasedriverJarList"; //$NON-NLS-1$ - private static final String DB_NAME_PROPERTY = "databaseName"; //$NON-NLS-1$ - private static final String DB_URL_PROPERTY = "databaseUrl"; //$NON-NLS-1$ - - private static final String PROFILE_NAME_DEFAULT = "jpatest"; //$NON-NLS-1$ - private static final String PROFILE_DESCRIPTION_DEFAULT = "JDBC Profile for JPA Testing"; //$NON-NLS-1$ - private static final String USER_NAME_DEFAULT = "userName"; //$NON-NLS-1$ - private static final String USER_PASSWORD_DEFAULT = ""; //$NON-NLS-1$ - private static final String DB_NAME_DEFAULT = "testdb"; //$NON-NLS-1$ - - private static final String MISSING_PROPERTY_MESSAGE = "Enter missing property in platform config file (config/database.properties)"; - - public DTPPlatformTests( String name) { - super( name); - - this.connectionRepository = ConnectionProfileRepository.instance(); - } - - protected void setUp() throws Exception { - super.setUp(); - this.connectionRepository.initializeListeners(); - - if( this.platformIsNew()) { - this.loadPlatformProperties(); - - this.buildDriverDefinitionFile( IDriverMgmtConstants.DRIVER_FILE); - this.buildConnectionProfile( this.profileName()); - this.currentDbVendor = this.databaseVendor(); - this.currentDbVersion = this.databaseVersion(); - } - this.verifyProfileNamed( this.profileName()); - } - - protected void tearDown() throws Exception { - super.tearDown(); - - this.connectionRepository.disposeListeners(); - } - - // ********** tests ********** - - public void testConnection() throws Exception { - - this.connect(); - - this.verifyDatabaseVersionNumber(); - this.verifyConnection(); - this.verifyDatabaseContent(); - - this.disconnect(); - } - - public void testGetProfiles() { - // Getting the profile directly from DTP ProfileManager - IConnectionProfile[] profiles = ProfileManager.getInstance().getProfiles(); - Assert.assertNotNull( profiles); - Assert.assertTrue( profiles.length > 0); - } - - public void testGetProfilesByProvider() { - // Get Profiles By ProviderID - IConnectionProfile[] profiles = ProfileManager.getInstance().getProfileByProviderID( this.getProfile().getProviderId()); - Assert.assertNotNull( profiles); - Assert.assertTrue( profiles.length > 0); - } - - public void testGetProfileByName() { - // Get Profile By Name - IConnectionProfile dtpProfile = ProfileManager.getInstance().getProfileByName( this.profileName()); - Assert.assertNotNull( dtpProfile); - Assert.assertTrue( dtpProfile.getName().equals( this.profileName())); - } - - public void testGetProfileByInstanceId() { - // Get Profile By InstanceID - IConnectionProfile dtpProfile = ProfileManager.getInstance().getProfileByInstanceID( this.getProfile().getInstanceId()); - Assert.assertNotNull( dtpProfile); - Assert.assertTrue( dtpProfile.getName().equals( this.profileName())); - } - - // ********** internal tests ********** - - private void verifyDatabaseVersionNumber() { - Database database = this.getProfile().getDatabase(); - Assert.assertNotNull( database); - - String actualVersionNumber = database.getVersion(); - String expectedVersionNumber = this.databaseVersion(); - String errorMessage = "Expected version number: " + expectedVersionNumber + " but the actual version number was: " + actualVersionNumber; - assertTrue( errorMessage, actualVersionNumber.indexOf( expectedVersionNumber) != -1); - - String actualVendor = database.getVendor(); - String expectedVendor = this.databaseVendor(); - errorMessage = "Expected vendor: " + expectedVendor + " but the actual vendor was: " + actualVendor; - assertEquals( errorMessage, actualVendor, expectedVendor); - } - - private void verifyConnection() { - Connection connection = this.getProfile().getConnection(); - Assert.assertNotNull( connection); - - String actualFactory = connection.getFactoryId(); - String expectedFactory = DTPConnectionProfileWrapper.CONNECTION_TYPE; - String errorMessage = "Expected factory: " + expectedFactory + " but the actual factory was: " + actualFactory; - assertEquals( errorMessage, actualFactory, expectedFactory); - } - - private void verifyDatabaseContent() { - Database database = this.getProfile().getDatabase(); - Assert.assertTrue( database.schemataSize() > 0); - - Schema schema = database.schemaNamed( this.getProfile().getUserName()); - if( schema != null) { - Assert.assertTrue( schema.sequencesSize() >= 0); - - Object[] tableNames = CollectionTools.array( schema.tableNames()); - if( tableNames.length >= 1) { - Table table = schema.tableNamed(( String)tableNames[ 0]); - Assert.assertTrue( table.columnsSize() >= 0); - Assert.assertTrue( table.foreignKeyColumnsSize() >= 0); - Assert.assertTrue( table.foreignKeysSize() >= 0); - Assert.assertTrue( table.primaryKeyColumnsSize() >= 0); - } - } - } - - private void verifyProfileNamed( String profileName) { - - ConnectionProfile profile = this.getProfileNamed( profileName); - Assert.assertTrue( "ConnectionProfile not found", profileName.equals( profile.getName())); - } - - // ***** Platform specific behavior ***** - - protected abstract String databaseVendor(); - protected abstract String databaseVersion(); - - protected abstract String driverName(); - protected abstract String driverDefinitionType(); - protected abstract String driverDefinitionId(); - protected abstract String driverClass(); - - protected abstract String getConfigName(); - - // ***** Behavior ***** - - protected void connect() { - - this.getProfile().connect(); - Assert.assertTrue( "Connect failed.", this.getProfile().isConnected()); - } - - protected void disconnect() { - - this.getProfile().disconnect(); - Assert.assertFalse( "Disconnect failed.", this.getProfile().isConnected()); - } - - // ********** queries ********** - - protected Schema getSchemaNamed( String schemaName) { - - return this.getProfile().getDatabase().schemaNamed( schemaName); - } - - protected Collection getTables() { - - Schema schema = this.getSchemaNamed( this.getProfile().getUserName()); - if( schema == null) { - return new ArrayList(); - } - return CollectionTools.collection( schema.tables()); - } - - protected Table getTableNamed( String tableName) { - - Schema schema = this.getSchemaNamed( this.getProfile().getUserName()); - Assert.assertNotNull( schema); - - return schema.tableNamed( tableName); - } - - protected String providerId() { - return DTPConnectionProfileWrapper.CONNECTION_PROFILE_TYPE; - } - - protected String passwordIsSaved() { - return "true"; - } - - protected String profileName() { - return this.platformProperties.getProperty( PROFILE_NAME_PROPERTY, PROFILE_NAME_DEFAULT); - } - - protected String profileDescription() { - return this.platformProperties.getProperty( PROFILE_DESCRIPTION_PROPERTY, PROFILE_DESCRIPTION_DEFAULT); - } - - protected String userName() { - return this.platformProperties.getProperty( USER_NAME_PROPERTY, USER_NAME_DEFAULT); - } - - protected String userPassword() { - return this.platformProperties.getProperty( USER_PASSWORD_PROPERTY, USER_PASSWORD_DEFAULT); - } - - protected String databaseName() { - return this.platformProperties.getProperty( DB_NAME_PROPERTY, DB_NAME_DEFAULT); - } - - protected String databasedriverJarList() { - String dbDriverJarList = this.platformProperties.getProperty( DB_DRIVER_JAR_PROPERTY); - if ( StringTools.stringIsEmpty( dbDriverJarList)) { - throw new NoSuchElementException( MISSING_PROPERTY_MESSAGE); - } - return dbDriverJarList; - } - - protected String databaseUrl() { - String dbUrl = this.platformProperties.getProperty( DB_URL_PROPERTY); - if ( StringTools.stringIsEmpty( dbUrl)) { - throw new NoSuchElementException( MISSING_PROPERTY_MESSAGE); - } - return dbUrl; - } - - private ConnectionProfile getProfile() { - - return this.getProfileNamed( this.profileName()); - } - - protected ConnectionProfile getProfileNamed( String profileName) { - - return ConnectionProfileRepository.instance().profileNamed( profileName); - } - - private String getTestPluginBundleId() { - return JptDbTestsPlugin.BUNDLE_ID; - } - - private IPath getDriverDefinitionLocation() { - return ConnectivityPlugin.getDefault().getStateLocation(); - } - - private String getConfigPath() { - return this.getConfigDir() + "/" + this.getConfigName(); - } - - private String getConfigDir() { - return PLATFORM_CONFIG_DIRECTORY; - } - - private boolean platformIsNew() { - return( !this.databaseVendor().equals( this.currentDbVendor) || this.databaseVersion().equals( this.currentDbVersion)); - } - - private void loadPlatformProperties() throws IOException { - - if( this.platformProperties == null) { - URL configUrl = Platform.getBundle( this.getTestPluginBundleId()).getEntry( this.getConfigPath()); - - this.platformProperties = new Properties(); - this.platformProperties.load( configUrl.openStream()); - } - } - - private Properties buildDriverProperties() { - Properties driverProperties = new Properties(); - driverProperties.setProperty( DTPConnectionProfileWrapper.DRIVER_DEFINITION_TYPE_PROP_ID, this.driverDefinitionType()); - driverProperties.setProperty( DTPConnectionProfileWrapper.DRIVER_JAR_LIST_PROP_ID, this.databasedriverJarList()); - driverProperties.setProperty( IDBDriverDefinitionConstants.USERNAME_PROP_ID, this.userName()); - driverProperties.setProperty( IDBDriverDefinitionConstants.DRIVER_CLASS_PROP_ID, this.driverClass()); - driverProperties.setProperty( IDBDriverDefinitionConstants.DATABASE_NAME_PROP_ID, this.databaseName()); - driverProperties.setProperty( IDBDriverDefinitionConstants.PASSWORD_PROP_ID, this.userPassword()); - driverProperties.setProperty( IDBDriverDefinitionConstants.URL_PROP_ID, this.databaseUrl()); - driverProperties.setProperty( IDBDriverDefinitionConstants.DATABASE_VENDOR_PROP_ID, this.databaseVendor()); - driverProperties.setProperty( IDBDriverDefinitionConstants.DATABASE_VERSION_PROP_ID, this.databaseVersion()); - return driverProperties; - } - - private Properties buildBasicProperties() { - Properties basicProperties = new Properties(); - basicProperties.setProperty( IDBDriverDefinitionConstants.DATABASE_NAME_PROP_ID, this.databaseName()); - basicProperties.setProperty( IDBDriverDefinitionConstants.USERNAME_PROP_ID, this.userName()); - basicProperties.setProperty( IDBDriverDefinitionConstants.PASSWORD_PROP_ID, this.userPassword()); - basicProperties.setProperty( DTPConnectionProfileWrapper.DRIVER_DEFINITION_PROP_ID, this.driverDefinitionId()); - - basicProperties.setProperty( IDBDriverDefinitionConstants.DRIVER_CLASS_PROP_ID, this.driverClass()); - basicProperties.setProperty( IDBDriverDefinitionConstants.URL_PROP_ID, this.databaseUrl()); - basicProperties.setProperty( IDBDriverDefinitionConstants.DATABASE_VENDOR_PROP_ID, this.databaseVendor()); - basicProperties.setProperty( IDBDriverDefinitionConstants.DATABASE_VERSION_PROP_ID, this.databaseVersion()); - - basicProperties.setProperty( DTPConnectionProfileWrapper.DATABASE_SAVE_PWD_PROP_ID, this.passwordIsSaved()); - return basicProperties; - } - - private void buildConnectionProfile( String profileName) throws ConnectionProfileException { - - ProfileManager profileManager = ProfileManager.getInstance(); - Assert.assertNotNull( profileManager); - IConnectionProfile profile = profileManager.getProfileByName( profileName); - if( profile == null) { - Properties basicProperties = buildBasicProperties(); - ProfileManager.getInstance().createProfile( profileName, this.profileDescription(), this.providerId(), basicProperties); - } - } - - private void buildDriverDefinitionFile( String driverFileName) throws CoreException { - - XMLFileManager.setStorageLocation( this.getDriverDefinitionLocation()); - XMLFileManager.setFileName( driverFileName); - IPropertySet[] propsets = new IPropertySet[ 1]; - String driverName = this.driverName(); - String driverId = this.driverDefinitionId(); - PropertySetImpl propertySet = new PropertySetImpl( driverName, driverId); - propertySet.setProperties( driverId, this.buildDriverProperties()); - propsets[ 0] = propertySet; - - XMLFileManager.saveNamedPropertySet( propsets); - - File driverDefinitioneFile = this.getDriverDefinitionLocation().append( driverFileName).toFile(); - Assert.assertTrue( driverDefinitioneFile.exists()); - } - -} diff --git a/jpa/tests/org.eclipse.jpt.db.tests/src/org/eclipse/jpt/db/tests/internal/platforms/Derby101Tests.java b/jpa/tests/org.eclipse.jpt.db.tests/src/org/eclipse/jpt/db/tests/internal/platforms/Derby101Tests.java deleted file mode 100644 index 7e510cfd43..0000000000 --- a/jpa/tests/org.eclipse.jpt.db.tests/src/org/eclipse/jpt/db/tests/internal/platforms/Derby101Tests.java +++ /dev/null @@ -1,64 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2007 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the terms of - * the Eclipse Public License v1.0, which accompanies this distribution and is available at - * http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.db.tests.internal.platforms; - -import junit.framework.Test; -import junit.framework.TestSuite; -import junit.swingui.TestRunner; - -/** - * Derby 10.1 Embedded Driver Test - */ -public class Derby101Tests extends DTPPlatformTests { - - public static void main( String[] args) { - TestRunner.main( new String[] { "-c", Derby101Tests.class.getName()}); - } - - public static Test suite() { - return new TestSuite( Derby101Tests.class); - } - - public Derby101Tests( String name) { - super( name); - } - - protected String databaseVendor() { - return "Derby"; - } - - protected String databaseVersion() { - return "10.1"; - } - - protected String providerId() { - return "org.eclipse.datatools.connectivity.db.derby.embedded.connectionProfile"; - } - - protected String driverName() { - return "Derby Embedded JDBC Driver"; - } - - protected String driverDefinitionType() { - return "org.eclipse.datatools.connectivity.db.derby101.genericDriverTemplate"; - } - - protected String driverDefinitionId() { - return "DriverDefn.Derby Embedded JDBC Driver"; - } - - protected String driverClass() { - return "org.apache.derby.jdbc.EmbeddedDriver"; - } - - protected String getConfigName() { - return "derby101.properties"; - } -} diff --git a/jpa/tests/org.eclipse.jpt.db.tests/src/org/eclipse/jpt/db/tests/internal/platforms/Oracle10gTests.java b/jpa/tests/org.eclipse.jpt.db.tests/src/org/eclipse/jpt/db/tests/internal/platforms/Oracle10gTests.java deleted file mode 100644 index 70d3a3d55f..0000000000 --- a/jpa/tests/org.eclipse.jpt.db.tests/src/org/eclipse/jpt/db/tests/internal/platforms/Oracle10gTests.java +++ /dev/null @@ -1,60 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2007 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the terms of - * the Eclipse Public License v1.0, which accompanies this distribution and is available at - * http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.db.tests.internal.platforms; - -import junit.framework.Test; -import junit.framework.TestSuite; -import junit.swingui.TestRunner; - -/** - * Oracle 10g Thin Driver Test - */ -public class Oracle10gTests extends DTPPlatformTests { - - public static void main( String[] args) { - TestRunner.main( new String[] { "-c", Oracle10gTests.class.getName()}); - } - - public static Test suite() { - return new TestSuite( Oracle10gTests.class); - } - - public Oracle10gTests( String name) { - super( name); - } - - protected String databaseVendor() { - return "Oracle"; - } - - protected String databaseVersion() { - return "10"; - } - - protected String driverClass() { - return "oracle.jdbc.OracleDriver"; - } - - protected String driverDefinitionId() { - return "DriverDefn.Oracle Thin Driver"; - } - - protected String driverDefinitionType() { - return "org.eclipse.datatools.enablement.oracle.10.driverTemplate"; - } - - protected String driverName() { - return "Oracle 10g Thin Driver"; - } - - protected String getConfigName() { - return "oracle10g.properties"; - } -} diff --git a/jpa/tests/org.eclipse.jpt.db.tests/src/org/eclipse/jpt/db/tests/internal/platforms/Oracle9iTests.java b/jpa/tests/org.eclipse.jpt.db.tests/src/org/eclipse/jpt/db/tests/internal/platforms/Oracle9iTests.java deleted file mode 100644 index 3923081244..0000000000 --- a/jpa/tests/org.eclipse.jpt.db.tests/src/org/eclipse/jpt/db/tests/internal/platforms/Oracle9iTests.java +++ /dev/null @@ -1,60 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2007 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the terms of - * the Eclipse Public License v1.0, which accompanies this distribution and is available at - * http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.db.tests.internal.platforms; - -import junit.framework.Test; -import junit.framework.TestSuite; -import junit.swingui.TestRunner; - -/** - * Oracle 9i Thin Driver Test - */ -public class Oracle9iTests extends DTPPlatformTests { - - public static void main( String[] args) { - TestRunner.main( new String[] { "-c", Oracle9iTests.class.getName()}); - } - - public static Test suite() { - return new TestSuite( Oracle9iTests.class); - } - - public Oracle9iTests( String name) { - super( name); - } - - protected String databaseVendor() { - return "Oracle"; - } - - protected String databaseVersion() { - return "9"; - } - - protected String driverClass() { - return "oracle.jdbc.OracleDriver"; - } - - protected String driverDefinitionId() { - return "DriverDefn.Oracle Thin Driver"; - } - - protected String driverDefinitionType() { - return "org.eclipse.datatools.enablement.oracle.9.driverTemplate"; - } - - protected String driverName() { - return "Oracle 9i Thin Driver"; - } - - protected String getConfigName() { - return "oracle9i.properties"; - } -} diff --git a/jpa/tests/org.eclipse.jpt.db.tests/src/org/eclipse/jpt/db/tests/internal/platforms/SQLServer2005Tests.java b/jpa/tests/org.eclipse.jpt.db.tests/src/org/eclipse/jpt/db/tests/internal/platforms/SQLServer2005Tests.java deleted file mode 100644 index a0f5034f6d..0000000000 --- a/jpa/tests/org.eclipse.jpt.db.tests/src/org/eclipse/jpt/db/tests/internal/platforms/SQLServer2005Tests.java +++ /dev/null @@ -1,64 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the terms of - * the Eclipse Public License v1.0, which accompanies this distribution and is available at - * http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.db.tests.internal.platforms; - -import junit.framework.Test; -import junit.framework.TestSuite; -import junit.swingui.TestRunner; - -/** - * SQL Server 2005 Driver Test - */ -public class SQLServer2005Tests extends DTPPlatformTests { - - public static void main( String[] args) { - TestRunner.main( new String[] { "-c", SQLServer2005Tests.class.getName()}); - } - - public static Test suite() { - return new TestSuite( SQLServer2005Tests.class); - } - - public SQLServer2005Tests( String name) { - super( name); - } - - protected String databaseVendor() { - return "SQLServer"; - } - - protected String databaseVersion() { - return "2005"; - } - - protected String providerId() { - return "org.eclipse.datatools.connectivity.db.generic.connectionProfile"; - } - - protected String driverName() { - return "Microsoft SQL Server 2005 JDBC Driver"; - } - - protected String driverDefinitionType() { - return "org.eclipse.datatools.enablement.msft.sqlserver.2005.driverTemplate"; - } - - protected String driverDefinitionId() { - return "DriverDefn.Microsoft SQL Server 2005 JDBC Driver"; - } - - protected String driverClass() { - return "com.microsoft.sqlserver.jdbc.SQLServerDriver"; - } - - protected String getConfigName() { - return "sqlserver2005.properties"; - } -} |