pax_global_header00006660000000000000000000000064122521534560014517gustar00rootroot0000000000000052 comment=156491d6af5e4aad81a50e8c6b38e59eff882912 Resteasy-3.0.6.Final/000077500000000000000000000000001225215345600143545ustar00rootroot00000000000000Resteasy-3.0.6.Final/.gitignore000066400000000000000000000005441225215345600163470ustar00rootroot00000000000000# Intellij ################### .idea *.iml # Compiled source # ################### *.com *.class *.dll *.exe *.o *.so # Packages # ############ # it's better to unpack these files and commit the raw source # git has its own built in compression methods *.7z *.dmg *.gz *.iso *.jar *.rar *.tar *.zip # Logs and databases # ###################### *.log Resteasy-3.0.6.Final/.settings/000077500000000000000000000000001225215345600162725ustar00rootroot00000000000000Resteasy-3.0.6.Final/.settings/org.eclipse.m2e.core.prefs000066400000000000000000000001261225215345600231550ustar00rootroot00000000000000activeProfiles= eclipse.preferences.version=1 resolveWorkspaceProjects=true version=1 Resteasy-3.0.6.Final/README000066400000000000000000000006361225215345600152410ustar00rootroot00000000000000Resteasy is a JBoss.org project aimed at providing productivity frameworks for developing client and server RESTful applications and services in Java. It is mainly a JAX-RS implementation but you'll find some other experimental code in the repository. JAX-RS ------ The JAX-RS code is in the jaxrs directory. After pulling down a clone of the Resteasy repository, cd to jaxrs/ and just do mvn install to build.Resteasy-3.0.6.Final/jaxrs/000077500000000000000000000000001225215345600155035ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/.gitignore000066400000000000000000000001101225215345600174630ustar00rootroot00000000000000# eclipse files .project .settings .classpath # maven files target bin Resteasy-3.0.6.Final/jaxrs/License.html000066400000000000000000000246151225215345600177630ustar00rootroot00000000000000
Apache License
  Version 2.0, January 2004
   http://www.apache.org/licenses/

  TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION

  1. Definitions.

 "License" shall mean the terms and conditions for use, reproduction,
 and distribution as defined by Sections 1 through 9 of this document.

 "Licensor" shall mean the copyright owner or entity authorized by
 the copyright owner that is granting the License.

 "Legal Entity" shall mean the union of the acting entity and all
 other entities that control, are controlled by, or are under common
 control with that entity. For the purposes of this definition,
 "control" means (i) the power, direct or indirect, to cause the
 direction or management of such entity, whether by contract or
 otherwise, or (ii) ownership of fifty percent (50%) or more of the
 outstanding shares, or (iii) beneficial ownership of such entity.

 "You" (or "Your") shall mean an individual or Legal Entity
 exercising permissions granted by this License.

 "Source" form shall mean the preferred form for making modifications,
 including but not limited to software source code, documentation
 source, and configuration files.

 "Object" form shall mean any form resulting from mechanical
 transformation or translation of a Source form, including but
 not limited to compiled object code, generated documentation,
 and conversions to other media types.

 "Work" shall mean the work of authorship, whether in Source or
 Object form, made available under the License, as indicated by a
 copyright notice that is included in or attached to the work
 (an example is provided in the Appendix below).

 "Derivative Works" shall mean any work, whether in Source or Object
 form, that is based on (or derived from) the Work and for which the
 editorial revisions, annotations, elaborations, or other modifications
 represent, as a whole, an original work of authorship. For the purposes
 of this License, Derivative Works shall not include works that remain
 separable from, or merely link (or bind by name) to the interfaces of,
 the Work and Derivative Works thereof.

 "Contribution" shall mean any work of authorship, including
 the original version of the Work and any modifications or additions
 to that Work or Derivative Works thereof, that is intentionally
 submitted to Licensor for inclusion in the Work by the copyright owner
 or by an individual or Legal Entity authorized to submit on behalf of
 the copyright owner. For the purposes of this definition, "submitted"
 means any form of electronic, verbal, or written communication sent
 to the Licensor or its representatives, including but not limited to
 communication on electronic mailing lists, source code control systems,
 and issue tracking systems that are managed by, or on behalf of, the
 Licensor for the purpose of discussing and improving the Work, but
 excluding communication that is conspicuously marked or otherwise
 designated in writing by the copyright owner as "Not a Contribution."

 "Contributor" shall mean Licensor and any individual or Legal Entity
 on behalf of whom a Contribution has been received by Licensor and
 subsequently incorporated within the Work.

  2. Grant of Copyright License. Subject to the terms and conditions of
 this License, each Contributor hereby grants to You a perpetual,
 worldwide, non-exclusive, no-charge, royalty-free, irrevocable
 copyright license to reproduce, prepare Derivative Works of,
 publicly display, publicly perform, sublicense, and distribute the
 Work and such Derivative Works in Source or Object form.

  3. Grant of Patent License. Subject to the terms and conditions of
 this License, each Contributor hereby grants to You a perpetual,
 worldwide, non-exclusive, no-charge, royalty-free, irrevocable
 (except as stated in this section) patent license to make, have made,
 use, offer to sell, sell, import, and otherwise transfer the Work,
 where such license applies only to those patent claims licensable
 by such Contributor that are necessarily infringed by their
 Contribution(s) alone or by combination of their Contribution(s)
 with the Work to which such Contribution(s) was submitted. If You
 institute patent litigation against any entity (including a
 cross-claim or counterclaim in a lawsuit) alleging that the Work
 or a Contribution incorporated within the Work constitutes direct
 or contributory patent infringement, then any patent licenses
 granted to You under this License for that Work shall terminate
 as of the date such litigation is filed.

  4. Redistribution. You may reproduce and distribute copies of the
 Work or Derivative Works thereof in any medium, with or without
 modifications, and in Source or Object form, provided that You
 meet the following conditions:

 (a) You must give any other recipients of the Work or
 Derivative Works a copy of this License; and

 (b) You must cause any modified files to carry prominent notices
 stating that You changed the files; and

 (c) You must retain, in the Source form of any Derivative Works
 that You distribute, all copyright, patent, trademark, and
 attribution notices from the Source form of the Work,
 excluding those notices that do not pertain to any part of
 the Derivative Works; and

 (d) If the Work includes a "NOTICE" text file as part of its
 distribution, then any Derivative Works that You distribute must
 include a readable copy of the attribution notices contained
 within such NOTICE file, excluding those notices that do not
 pertain to any part of the Derivative Works, in at least one
 of the following places: within a NOTICE text file distributed
 as part of the Derivative Works; within the Source form or
 documentation, if provided along with the Derivative Works; or,
 within a display generated by the Derivative Works, if and
 wherever such third-party notices normally appear. The contents
 of the NOTICE file are for informational purposes only and
 do not modify the License. You may add Your own attribution
 notices within Derivative Works that You distribute, alongside
 or as an addendum to the NOTICE text from the Work, provided
 that such additional attribution notices cannot be construed
 as modifying the License.

 You may add Your own copyright statement to Your modifications and
 may provide additional or different license terms and conditions
 for use, reproduction, or distribution of Your modifications, or
 for any such Derivative Works as a whole, provided Your use,
 reproduction, and distribution of the Work otherwise complies with
 the conditions stated in this License.

  5. Submission of Contributions. Unless You explicitly state otherwise,
 any Contribution intentionally submitted for inclusion in the Work
 by You to the Licensor shall be under the terms and conditions of
 this License, without any additional terms or conditions.
 Notwithstanding the above, nothing herein shall supersede or modify
 the terms of any separate license agreement you may have executed
 with Licensor regarding such Contributions.

  6. Trademarks. This License does not grant permission to use the trade
 names, trademarks, service marks, or product names of the Licensor,
 except as required for reasonable and customary use in describing the
 origin of the Work and reproducing the content of the NOTICE file.

  7. Disclaimer of Warranty. Unless required by applicable law or
 agreed to in writing, Licensor provides the Work (and each
 Contributor provides its Contributions) 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. You are solely responsible for determining the
 appropriateness of using or redistributing the Work and assume any
 risks associated with Your exercise of permissions under this License.

  8. Limitation of Liability. In no event and under no legal theory,
 whether in tort (including negligence), contract, or otherwise,
 unless required by applicable law (such as deliberate and grossly
 negligent acts) or agreed to in writing, shall any Contributor be
 liable to You for damages, including any direct, indirect, special,
 incidental, or consequential damages of any character arising as a
 result of this License or out of the use or inability to use the
 Work (including but not limited to damages for loss of goodwill,
 work stoppage, computer failure or malfunction, or any and all
 other commercial damages or losses), even if such Contributor
 has been advised of the possibility of such damages.

  9. Accepting Warranty or Additional Liability. While redistributing
 the Work or Derivative Works thereof, You may choose to offer,
 and charge a fee for, acceptance of support, warranty, indemnity,
 or other liability obligations and/or rights consistent with this
 License. However, in accepting such obligations, You may act only
 on Your own behalf and on Your sole responsibility, not on behalf
 of any other Contributor, and only if You agree to indemnify,
 defend, and hold each Contributor harmless for any liability
 incurred by, or claims asserted against, such Contributor by reason
 of your accepting any such warranty or additional liability.

  END OF TERMS AND CONDITIONS

  APPENDIX: How to apply the Apache License to your work.

 To apply the Apache License to your work, attach the following
 boilerplate notice, with the fields enclosed by brackets "[]"
 replaced with your own identifying information. (Don't include
 the brackets!)  The text should be enclosed in the appropriate
 comment syntax for the file format. We also recommend that a
 file or class name and description of purpose be included on the
 same "printed page" as the copyright notice for easier
 identification within third-party archives.

  Copyright [yyyy] [name of copyright owner]

  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at

  http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
    
Resteasy-3.0.6.Final/jaxrs/README.html000066400000000000000000000002131225215345600173220ustar00rootroot00000000000000

DOCUMENTATION

All of our documentation is on our Resteasy Wiki

Resteasy-3.0.6.Final/jaxrs/arquillian/000077500000000000000000000000001225215345600176445ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/.gitignore000066400000000000000000000000201225215345600216240ustar00rootroot00000000000000/as7-dist-async Resteasy-3.0.6.Final/jaxrs/arquillian/RESTEASY-736-as71/000077500000000000000000000000001225215345600221715ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/RESTEASY-736-as71/.gitignore000066400000000000000000000000221225215345600241530ustar00rootroot00000000000000/target .DS_Store Resteasy-3.0.6.Final/jaxrs/arquillian/RESTEASY-736-as71/licenses/000077500000000000000000000000001225215345600237765ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/RESTEASY-736-as71/licenses/JBossORG-EULA.txt000066400000000000000000000174601225215345600266630ustar00rootroot00000000000000LICENSE AGREEMENT JBOSS(r) This License Agreement governs the use of the Software Packages and any updates to the Software Packages, regardless of the delivery mechanism. Each Software Package is a collective work under U.S. Copyright Law. Subject to the following terms, Red Hat, Inc. ("Red Hat") grants to the user ("Client") a license to the applicable collective work(s) pursuant to the GNU Lesser General Public License v. 2.1 except for the following Software Packages: (a) JBoss Portal Forums and JBoss Transactions JTS, each of which is licensed pursuant to the GNU General Public License v.2; (b) JBoss Rules, which is licensed pursuant to the Apache License v.2.0; (c) an optional download for JBoss Cache for the Berkeley DB for Java database, which is licensed under the (open source) Sleepycat License (if Client does not wish to use the open source version of this database, it may purchase a license from Sleepycat Software); and (d) the BPEL extension for JBoss jBPM, which is licensed under the Common Public License v.1, and, pursuant to the OASIS BPEL4WS standard, requires parties wishing to redistribute to enter various royalty-free patent licenses. Each of the foregoing licenses is available at http://www.opensource.org/licenses/index.php. 1. The Software. "Software Packages" refer to the various software modules that are created and made available for distribution by the JBoss.org open source community at http://www.jboss.org. Each of the Software Packages may be comprised of hundreds of software components. The end user license agreement for each component is located in the component's source code. With the exception of certain image files identified in Section 2 below, the license terms for the components permit Client to copy, modify, and redistribute the component, in both source code and binary code forms. This agreement does not limit Client's rights under, or grant Client rights that supersede, the license terms of any particular component. 2. Intellectual Property Rights. The Software Packages are owned by Red Hat and others and are protected under copyright and other laws. Title to the Software Packages and any component, or to any copy, modification, or merged portion shall remain with the aforementioned, subject to the applicable license. The "JBoss" trademark, "Red Hat" trademark, the individual Software Package trademarks, and the "Shadowman" logo are registered trademarks of Red Hat and its affiliates in the U.S. and other countries. This agreement permits Client to distribute unmodified copies of the Software Packages using the Red Hat trademarks that Red Hat has inserted in the Software Packages on the condition that Client follows Red Hat's trademark guidelines for those trademarks located at http://www.redhat.com/about/corporate/trademark/. Client must abide by these trademark guidelines when distributing the Software Packages, regardless of whether the Software Packages have been modified. If Client modifies the Software Packages, then Client must replace all Red Hat trademarks and logos identified at http://www.jboss.com/company/logos, unless a separate agreement with Red Hat is executed or other permission granted. Merely deleting the files containing the Red Hat trademarks may corrupt the Software Packages. 3. Limited Warranty. Except as specifically stated in this Paragraph 3 or a license for a particular component, to the maximum extent permitted under applicable law, the Software Packages and the components are provided and licensed "as is" without warranty of any kind, expressed or implied, including the implied warranties of merchantability, non-infringement or fitness for a particular purpose. Red Hat warrants that the media on which Software Packages may be furnished will be free from defects in materials and manufacture under normal use for a period of 30 days from the date of delivery to Client. Red Hat does not warrant that the functions contained in the Software Packages will meet Client's requirements or that the operation of the Software Packages will be entirely error free or appear precisely as described in the accompanying documentation. This warranty extends only to the party that purchases the Services pertaining to the Software Packages from Red Hat or a Red Hat authorized distributor. 4. Limitation of Remedies and Liability. To the maximum extent permitted by applicable law, the remedies described below are accepted by Client as its only remedies. Red Hat's entire liability, and Client's exclusive remedies, shall be: If the Software media is defective, Client may return it within 30 days of delivery along with a copy of Client's payment receipt and Red Hat, at its option, will replace it or refund the money paid by Client for the Software. To the maximum extent permitted by applicable law, Red Hat or any Red Hat authorized dealer will not be liable to Client for any incidental or consequential damages, including lost profits or lost savings arising out of the use or inability to use the Software, even if Red Hat or such dealer has been advised of the possibility of such damages. In no event shall Red Hat's liability under this agreement exceed the amount that Client paid to Red Hat under this Agreement during the twelve months preceding the action. 5. Export Control. As required by U.S. law, Client represents and warrants that it: (a) understands that the Software Packages are subject to export controls under the U.S. Commerce Department's Export Administration Regulations ("EAR"); (b) is not located in a prohibited destination country under the EAR or U.S. sanctions regulations (currently Cuba, Iran, Iraq, Libya, North Korea, Sudan and Syria); (c) will not export, re-export, or transfer the Software Packages to any prohibited destination, entity, or individual without the necessary export license(s) or authorizations(s) from the U.S. Government; (d) will not use or transfer the Software Packages for use in any sensitive nuclear, chemical or biological weapons, or missile technology end-uses unless authorized by the U.S. Government by regulation or specific license; (e) understands and agrees that if it is in the United States and exports or transfers the Software Packages to eligible end users, it will, as required by EAR Section 740.17(e), submit semi-annual reports to the Commerce Department's Bureau of Industry & Security (BIS), which include the name and address (including country) of each transferee; and (f) understands that countries other than the United States may restrict the import, use, or export of encryption products and that it shall be solely responsible for compliance with any such import, use, or export restrictions. 6. Third Party Programs. Red Hat may distribute third party software programs with the Software Packages that are not part of the Software Packages and which Client must install separately. These third party programs are subject to their own license terms. The license terms either accompany the programs or can be viewed at http://www.redhat.com/licenses/. If Client does not agree to abide by the applicable license terms for such programs, then Client may not install them. If Client wishes to install the programs on more than one system or transfer the programs to another party, then Client must contact the licensor of the programs. 7. General. If any provision of this agreement is held to be unenforceable, that shall not affect the enforceability of the remaining provisions. This License Agreement shall be governed by the laws of the State of North Carolina and of the United States, without regard to any conflict of laws provisions, except that the United Nations Convention on the International Sale of Goods shall not apply. Copyright 2006 Red Hat, Inc. All rights reserved. "JBoss" and the JBoss logo are registered trademarks of Red Hat, Inc. All other trademarks are the property of their respective owners. Page 1 of 1 18 October 2006 Resteasy-3.0.6.Final/jaxrs/arquillian/RESTEASY-736-as71/licenses/apr-iconv/000077500000000000000000000000001225215345600256745ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/RESTEASY-736-as71/licenses/apr-iconv/LICENSE000066400000000000000000000541451225215345600267120ustar00rootroot00000000000000 Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) 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. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. APACHE PORTABLE RUNTIME SUBCOMPONENTS: The Apache Portable Runtime includes a number of subcomponents with separate copyright notices and license terms. Your use of the source code for the these subcomponents is subject to the terms and conditions of the following licenses. For the include\apr_md5.h component: /* * This is work is derived from material Copyright RSA Data Security, Inc. * * The RSA copyright statement and Licence for that original material is * included below. This is followed by the Apache copyright statement and * licence for the modifications made to that material. */ /* Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All rights reserved. License to copy and use this software is granted provided that it is identified as the "RSA Data Security, Inc. MD5 Message-Digest Algorithm" in all material mentioning or referencing this software or this function. License is also granted to make and use derivative works provided that such works are identified as "derived from the RSA Data Security, Inc. MD5 Message-Digest Algorithm" in all material mentioning or referencing the derived work. RSA Data Security, Inc. makes no representations concerning either the merchantability of this software or the suitability of this software for any particular purpose. It is provided "as is" without express or implied warranty of any kind. These notices must be retained in any copies of any part of this documentation and/or software. */ For the passwd\apr_md5.c component: /* * This is work is derived from material Copyright RSA Data Security, Inc. * * The RSA copyright statement and Licence for that original material is * included below. This is followed by the Apache copyright statement and * licence for the modifications made to that material. */ /* MD5C.C - RSA Data Security, Inc., MD5 message-digest algorithm */ /* Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All rights reserved. License to copy and use this software is granted provided that it is identified as the "RSA Data Security, Inc. MD5 Message-Digest Algorithm" in all material mentioning or referencing this software or this function. License is also granted to make and use derivative works provided that such works are identified as "derived from the RSA Data Security, Inc. MD5 Message-Digest Algorithm" in all material mentioning or referencing the derived work. RSA Data Security, Inc. makes no representations concerning either the merchantability of this software or the suitability of this software for any particular purpose. It is provided "as is" without express or implied warranty of any kind. These notices must be retained in any copies of any part of this documentation and/or software. */ /* * The apr_md5_encode() routine uses much code obtained from the FreeBSD 3.0 * MD5 crypt() function, which is licenced as follows: * ---------------------------------------------------------------------------- * "THE BEER-WARE LICENSE" (Revision 42): * wrote this file. As long as you retain this notice you * can do whatever you want with this stuff. If we meet some day, and you think * this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp * ---------------------------------------------------------------------------- */ For the crypto\apr_md4.c component: * This is derived from material copyright RSA Data Security, Inc. * Their notice is reproduced below in its entirety. * * Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All * rights reserved. * * License to copy and use this software is granted provided that it * is identified as the "RSA Data Security, Inc. MD4 Message-Digest * Algorithm" in all material mentioning or referencing this software * or this function. * * License is also granted to make and use derivative works provided * that such works are identified as "derived from the RSA Data * Security, Inc. MD4 Message-Digest Algorithm" in all material * mentioning or referencing the derived work. * * RSA Data Security, Inc. makes no representations concerning either * the merchantability of this software or the suitability of this * software for any particular purpose. It is provided "as is" * without express or implied warranty of any kind. * * These notices must be retained in any copies of any part of this * documentation and/or software. */ For the include\apr_md4.h component: * * This is derived from material copyright RSA Data Security, Inc. * Their notice is reproduced below in its entirety. * * Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All * rights reserved. * * License to copy and use this software is granted provided that it * is identified as the "RSA Data Security, Inc. MD4 Message-Digest * Algorithm" in all material mentioning or referencing this software * or this function. * * License is also granted to make and use derivative works provided * that such works are identified as "derived from the RSA Data * Security, Inc. MD4 Message-Digest Algorithm" in all material * mentioning or referencing the derived work. * * RSA Data Security, Inc. makes no representations concerning either * the merchantability of this software or the suitability of this * software for any particular purpose. It is provided "as is" * without express or implied warranty of any kind. * * These notices must be retained in any copies of any part of this * documentation and/or software. */ For the test\testdbm.c component: /* ==================================================================== * The Apache Software License, Version 1.1 * * Copyright (c) 2000-2002 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. The end-user documentation included with the redistribution, * if any, must include the following acknowledgment: * "This product includes software developed by the * Apache Software Foundation (http://www.apache.org/)." * Alternately, this acknowledgment may appear in the software itself, * if and wherever such third-party acknowledgments normally appear. * * 4. The names "Apache" and "Apache Software Foundation" must * not be used to endorse or promote products derived from this * software without prior written permission. For written * permission, please contact apache@apache.org. * * 5. Products derived from this software may not be called "Apache", * nor may "Apache" appear in their name, without prior written * permission of the Apache Software Foundation. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 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 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * ==================================================================== * * This software consists of voluntary contributions made by many * individuals on behalf of the Apache Software Foundation. For more * information on the Apache Software Foundation, please see * . * * This file came from the SDBM package (written by oz@nexus.yorku.ca). * That package was under public domain. This file has been ported to * APR, updated to ANSI C and other, newer idioms, and added to the Apache * codebase under the above copyright and license. */ For the test\testmd4.c component: * * This is derived from material copyright RSA Data Security, Inc. * Their notice is reproduced below in its entirety. * * Copyright (C) 1990-2, RSA Data Security, Inc. Created 1990. All * rights reserved. * * RSA Data Security, Inc. makes no representations concerning either * the merchantability of this software or the suitability of this * software for any particular purpose. It is provided "as is" * without express or implied warranty of any kind. * * These notices must be retained in any copies of any part of this * documentation and/or software. */ For the xml\expat\conftools\install-sh component: # # install - install a program, script, or datafile # This comes from X11R5 (mit/util/scripts/install.sh). # # Copyright 1991 by the Massachusetts Institute of Technology # # Permission to use, copy, modify, distribute, and sell this software and its # documentation for any purpose is hereby granted without fee, provided that # the above copyright notice appear in all copies and that both that # copyright notice and this permission notice appear in supporting # documentation, and that the name of M.I.T. not be used in advertising or # publicity pertaining to distribution of the software without specific, # written prior permission. M.I.T. makes no representations about the # suitability of this software for any purpose. It is provided "as is" # without express or implied warranty. # For the expat xml parser component: Copyright (c) 1998, 1999, 2000 Thai Open Source Software Center Ltd and Clark Cooper Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ==================================================================== Resteasy-3.0.6.Final/jaxrs/arquillian/RESTEASY-736-as71/licenses/apr-iconv/NOTICE000066400000000000000000000007431225215345600266040ustar00rootroot00000000000000This product includes software developed by The Apache Software Foundation (http://www.apache.org/). Portions of this software were developed at the National Center for Supercomputing Applications (NCSA) at the University of Illinois at Urbana-Champaign. This software contains code derived from the RSA Data Security Inc. MD5 Message-Digest Algorithm, including various modifications by Spyglass Inc., Carnegie Mellon University, and Bell Communications Research, Inc (Bellcore). Resteasy-3.0.6.Final/jaxrs/arquillian/RESTEASY-736-as71/licenses/apr-util/000077500000000000000000000000001225215345600255335ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/RESTEASY-736-as71/licenses/apr-util/LICENSE000066400000000000000000000463421225215345600265510ustar00rootroot00000000000000 Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) 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. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. APACHE PORTABLE RUNTIME SUBCOMPONENTS: The Apache Portable Runtime includes a number of subcomponents with separate copyright notices and license terms. Your use of the source code for the these subcomponents is subject to the terms and conditions of the following licenses. For the include\apr_md5.h component: /* * This is work is derived from material Copyright RSA Data Security, Inc. * * The RSA copyright statement and Licence for that original material is * included below. This is followed by the Apache copyright statement and * licence for the modifications made to that material. */ /* Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All rights reserved. License to copy and use this software is granted provided that it is identified as the "RSA Data Security, Inc. MD5 Message-Digest Algorithm" in all material mentioning or referencing this software or this function. License is also granted to make and use derivative works provided that such works are identified as "derived from the RSA Data Security, Inc. MD5 Message-Digest Algorithm" in all material mentioning or referencing the derived work. RSA Data Security, Inc. makes no representations concerning either the merchantability of this software or the suitability of this software for any particular purpose. It is provided "as is" without express or implied warranty of any kind. These notices must be retained in any copies of any part of this documentation and/or software. */ For the passwd\apr_md5.c component: /* * This is work is derived from material Copyright RSA Data Security, Inc. * * The RSA copyright statement and Licence for that original material is * included below. This is followed by the Apache copyright statement and * licence for the modifications made to that material. */ /* MD5C.C - RSA Data Security, Inc., MD5 message-digest algorithm */ /* Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All rights reserved. License to copy and use this software is granted provided that it is identified as the "RSA Data Security, Inc. MD5 Message-Digest Algorithm" in all material mentioning or referencing this software or this function. License is also granted to make and use derivative works provided that such works are identified as "derived from the RSA Data Security, Inc. MD5 Message-Digest Algorithm" in all material mentioning or referencing the derived work. RSA Data Security, Inc. makes no representations concerning either the merchantability of this software or the suitability of this software for any particular purpose. It is provided "as is" without express or implied warranty of any kind. These notices must be retained in any copies of any part of this documentation and/or software. */ /* * The apr_md5_encode() routine uses much code obtained from the FreeBSD 3.0 * MD5 crypt() function, which is licenced as follows: * ---------------------------------------------------------------------------- * "THE BEER-WARE LICENSE" (Revision 42): * wrote this file. As long as you retain this notice you * can do whatever you want with this stuff. If we meet some day, and you think * this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp * ---------------------------------------------------------------------------- */ For the crypto\apr_md4.c component: * This is derived from material copyright RSA Data Security, Inc. * Their notice is reproduced below in its entirety. * * Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All * rights reserved. * * License to copy and use this software is granted provided that it * is identified as the "RSA Data Security, Inc. MD4 Message-Digest * Algorithm" in all material mentioning or referencing this software * or this function. * * License is also granted to make and use derivative works provided * that such works are identified as "derived from the RSA Data * Security, Inc. MD4 Message-Digest Algorithm" in all material * mentioning or referencing the derived work. * * RSA Data Security, Inc. makes no representations concerning either * the merchantability of this software or the suitability of this * software for any particular purpose. It is provided "as is" * without express or implied warranty of any kind. * * These notices must be retained in any copies of any part of this * documentation and/or software. */ For the include\apr_md4.h component: * * This is derived from material copyright RSA Data Security, Inc. * Their notice is reproduced below in its entirety. * * Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All * rights reserved. * * License to copy and use this software is granted provided that it * is identified as the "RSA Data Security, Inc. MD4 Message-Digest * Algorithm" in all material mentioning or referencing this software * or this function. * * License is also granted to make and use derivative works provided * that such works are identified as "derived from the RSA Data * Security, Inc. MD4 Message-Digest Algorithm" in all material * mentioning or referencing the derived work. * * RSA Data Security, Inc. makes no representations concerning either * the merchantability of this software or the suitability of this * software for any particular purpose. It is provided "as is" * without express or implied warranty of any kind. * * These notices must be retained in any copies of any part of this * documentation and/or software. */ For the test\testmd4.c component: * * This is derived from material copyright RSA Data Security, Inc. * Their notice is reproduced below in its entirety. * * Copyright (C) 1990-2, RSA Data Security, Inc. Created 1990. All * rights reserved. * * RSA Data Security, Inc. makes no representations concerning either * the merchantability of this software or the suitability of this * software for any particular purpose. It is provided "as is" * without express or implied warranty of any kind. * * These notices must be retained in any copies of any part of this * documentation and/or software. */ For the xml\expat\conftools\install-sh component: # # install - install a program, script, or datafile # This comes from X11R5 (mit/util/scripts/install.sh). # # Copyright 1991 by the Massachusetts Institute of Technology # # Permission to use, copy, modify, distribute, and sell this software and its # documentation for any purpose is hereby granted without fee, provided that # the above copyright notice appear in all copies and that both that # copyright notice and this permission notice appear in supporting # documentation, and that the name of M.I.T. not be used in advertising or # publicity pertaining to distribution of the software without specific, # written prior permission. M.I.T. makes no representations about the # suitability of this software for any purpose. It is provided "as is" # without express or implied warranty. # For the expat xml parser component: Copyright (c) 1998, 1999, 2000 Thai Open Source Software Center Ltd and Clark Cooper Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ==================================================================== Resteasy-3.0.6.Final/jaxrs/arquillian/RESTEASY-736-as71/licenses/apr-util/NOTICE000066400000000000000000000007431225215345600264430ustar00rootroot00000000000000This product includes software developed by The Apache Software Foundation (http://www.apache.org/). Portions of this software were developed at the National Center for Supercomputing Applications (NCSA) at the University of Illinois at Urbana-Champaign. This software contains code derived from the RSA Data Security Inc. MD5 Message-Digest Algorithm, including various modifications by Spyglass Inc., Carnegie Mellon University, and Bell Communications Research, Inc (Bellcore). Resteasy-3.0.6.Final/jaxrs/arquillian/RESTEASY-736-as71/licenses/apr/000077500000000000000000000000001225215345600245605ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/RESTEASY-736-as71/licenses/apr/LICENSE000066400000000000000000000413631225215345600255740ustar00rootroot00000000000000 Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) 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. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. APACHE PORTABLE RUNTIME SUBCOMPONENTS: The Apache Portable Runtime includes a number of subcomponents with separate copyright notices and license terms. Your use of the source code for the these subcomponents is subject to the terms and conditions of the following licenses. From strings/apr_fnmatch.c, include/apr_fnmatch.h, misc/unix/getopt.c, file_io/unix/mktemp.c, strings/apr_strings.c: /* * Copyright (c) 1987, 1993, 1994 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by the University of * California, Berkeley and its contributors. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * 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 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. From network_io/unix/inet_ntop.c, network_io/unix/inet_pton.c: /* Copyright (c) 1996 by Internet Software Consortium. * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS * SOFTWARE. From dso/aix/dso.c: * Based on libdl (dlfcn.c/dlfcn.h) which is * Copyright (c) 1992,1993,1995,1996,1997,1988 * Jens-Uwe Mager, Helios Software GmbH, Hannover, Germany. * * Not derived from licensed software. * * Permission is granted to freely use, copy, modify, and redistribute * this software, provided that the author is not construed to be liable * for any results of using the software, alterations are clearly marked * as such, and this notice is not modified. From strings/apr_strnatcmp.c, include/apr_strings.h: strnatcmp.c -- Perform 'natural order' comparisons of strings in C. Copyright (C) 2000 by Martin Pool This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. From test/CuTest.c, test/CuTest.h: * Copyright (c) 2002-2006 Asim Jalis * * This library is released under the zlib/libpng license as described at * * http://www.opensource.org/licenses/zlib-license.html * * Here is the statement of the license: * * This software is provided 'as-is', without any express or implied warranty. * In no event will the authors be held liable for any damages arising from * the use of this software. * * Permission is granted to anyone to use this software for any purpose, * including commercial applications, and to alter it and redistribute it * freely, subject to the following restrictions: * * 1. The origin of this software must not be misrepresented; you must not * claim that you wrote the original software. If you use this software in a * product, an acknowledgment in the product documentation would be * appreciated but is not required. * * 2. Altered source versions must be plainly marked as such, and must not be * misrepresented as being the original software. * * 3. This notice may not be removed or altered from any source distribution. Resteasy-3.0.6.Final/jaxrs/arquillian/RESTEASY-736-as71/licenses/apr/NOTICE000066400000000000000000000005431225215345600254660ustar00rootroot00000000000000This product includes software developed by The Apache Software Foundation (http://www.apache.org/). Portions of this software were developed at the National Center for Supercomputing Applications (NCSA) at the University of Illinois at Urbana-Champaign. This software contains code derived from the RSA Data Security Inc. MD5 Message-Digest Algorithm. Resteasy-3.0.6.Final/jaxrs/arquillian/RESTEASY-736-as71/licenses/httpd/000077500000000000000000000000001225215345600251215ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/RESTEASY-736-as71/licenses/httpd/LICENSE000066400000000000000000000756441225215345600261460ustar00rootroot00000000000000 Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) 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. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. APACHE HTTP SERVER SUBCOMPONENTS: The Apache HTTP Server includes a number of subcomponents with separate copyright notices and license terms. Your use of the source code for the these subcomponents is subject to the terms and conditions of the following licenses. For the mod_mime_magic component: /* * mod_mime_magic: MIME type lookup via file magic numbers * Copyright (c) 1996-1997 Cisco Systems, Inc. * * This software was submitted by Cisco Systems to the Apache Group in July * 1997. Future revisions and derivatives of this source code must * acknowledge Cisco Systems as the original contributor of this module. * All other licensing and usage conditions are those of the Apache Group. * * Some of this code is derived from the free version of the file command * originally posted to comp.sources.unix. Copyright info for that program * is included below as required. * --------------------------------------------------------------------------- * - Copyright (c) Ian F. Darwin, 1987. Written by Ian F. Darwin. * * This software is not subject to any license of the American Telephone and * Telegraph Company or of the Regents of the University of California. * * Permission is granted to anyone to use this software for any purpose on any * computer system, and to alter it and redistribute it freely, subject to * the following restrictions: * * 1. The author is not responsible for the consequences of use of this * software, no matter how awful, even if they arise from flaws in it. * * 2. The origin of this software must not be misrepresented, either by * explicit claim or by omission. Since few users ever read sources, credits * must appear in the documentation. * * 3. Altered versions must be plainly marked as such, and must not be * misrepresented as being the original software. Since few users ever read * sources, credits must appear in the documentation. * * 4. This notice may not be removed or altered. * ------------------------------------------------------------------------- * */ For the modules\mappers\mod_imagemap.c component: "macmartinized" polygon code copyright 1992 by Eric Haines, erich@eye.com For the server\util_md5.c component: /************************************************************************ * NCSA HTTPd Server * Software Development Group * National Center for Supercomputing Applications * University of Illinois at Urbana-Champaign * 605 E. Springfield, Champaign, IL 61820 * httpd@ncsa.uiuc.edu * * Copyright (C) 1995, Board of Trustees of the University of Illinois * ************************************************************************ * * md5.c: NCSA HTTPd code which uses the md5c.c RSA Code * * Original Code Copyright (C) 1994, Jeff Hostetler, Spyglass, Inc. * Portions of Content-MD5 code Copyright (C) 1993, 1994 by Carnegie Mellon * University (see Copyright below). * Portions of Content-MD5 code Copyright (C) 1991 Bell Communications * Research, Inc. (Bellcore) (see Copyright below). * Portions extracted from mpack, John G. Myers - jgm+@cmu.edu * Content-MD5 Code contributed by Martin Hamilton (martin@net.lut.ac.uk) * */ /* these portions extracted from mpack, John G. Myers - jgm+@cmu.edu */ /* (C) Copyright 1993,1994 by Carnegie Mellon University * All Rights Reserved. * * Permission to use, copy, modify, distribute, and sell this software * and its documentation for any purpose is hereby granted without * fee, provided that the above copyright notice appear in all copies * and that both that copyright notice and this permission notice * appear in supporting documentation, and that the name of Carnegie * Mellon University not be used in advertising or publicity * pertaining to distribution of the software without specific, * written prior permission. Carnegie Mellon University makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied * warranty. * * CARNEGIE MELLON UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY * AND FITNESS, IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY BE LIABLE * FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS * SOFTWARE. */ /* * Copyright (c) 1991 Bell Communications Research, Inc. (Bellcore) * * Permission to use, copy, modify, and distribute this material * for any purpose and without fee is hereby granted, provided * that the above copyright notice and this permission notice * appear in all copies, and that the name of Bellcore not be * used in advertising or publicity pertaining to this * material without the specific, prior written permission * of an authorized representative of Bellcore. BELLCORE * MAKES NO REPRESENTATIONS ABOUT THE ACCURACY OR SUITABILITY * OF THIS MATERIAL FOR ANY PURPOSE. IT IS PROVIDED "AS IS", * WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES. */ For the srclib\apr\include\apr_md5.h component: /* * This is work is derived from material Copyright RSA Data Security, Inc. * * The RSA copyright statement and Licence for that original material is * included below. This is followed by the Apache copyright statement and * licence for the modifications made to that material. */ /* Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All rights reserved. License to copy and use this software is granted provided that it is identified as the "RSA Data Security, Inc. MD5 Message-Digest Algorithm" in all material mentioning or referencing this software or this function. License is also granted to make and use derivative works provided that such works are identified as "derived from the RSA Data Security, Inc. MD5 Message-Digest Algorithm" in all material mentioning or referencing the derived work. RSA Data Security, Inc. makes no representations concerning either the merchantability of this software or the suitability of this software for any particular purpose. It is provided "as is" without express or implied warranty of any kind. These notices must be retained in any copies of any part of this documentation and/or software. */ For the srclib\apr\passwd\apr_md5.c component: /* * This is work is derived from material Copyright RSA Data Security, Inc. * * The RSA copyright statement and Licence for that original material is * included below. This is followed by the Apache copyright statement and * licence for the modifications made to that material. */ /* MD5C.C - RSA Data Security, Inc., MD5 message-digest algorithm */ /* Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All rights reserved. License to copy and use this software is granted provided that it is identified as the "RSA Data Security, Inc. MD5 Message-Digest Algorithm" in all material mentioning or referencing this software or this function. License is also granted to make and use derivative works provided that such works are identified as "derived from the RSA Data Security, Inc. MD5 Message-Digest Algorithm" in all material mentioning or referencing the derived work. RSA Data Security, Inc. makes no representations concerning either the merchantability of this software or the suitability of this software for any particular purpose. It is provided "as is" without express or implied warranty of any kind. These notices must be retained in any copies of any part of this documentation and/or software. */ /* * The apr_md5_encode() routine uses much code obtained from the FreeBSD 3.0 * MD5 crypt() function, which is licenced as follows: * ---------------------------------------------------------------------------- * "THE BEER-WARE LICENSE" (Revision 42): * wrote this file. As long as you retain this notice you * can do whatever you want with this stuff. If we meet some day, and you think * this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp * ---------------------------------------------------------------------------- */ For the srclib\apr-util\crypto\apr_md4.c component: * This is derived from material copyright RSA Data Security, Inc. * Their notice is reproduced below in its entirety. * * Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All * rights reserved. * * License to copy and use this software is granted provided that it * is identified as the "RSA Data Security, Inc. MD4 Message-Digest * Algorithm" in all material mentioning or referencing this software * or this function. * * License is also granted to make and use derivative works provided * that such works are identified as "derived from the RSA Data * Security, Inc. MD4 Message-Digest Algorithm" in all material * mentioning or referencing the derived work. * * RSA Data Security, Inc. makes no representations concerning either * the merchantability of this software or the suitability of this * software for any particular purpose. It is provided "as is" * without express or implied warranty of any kind. * * These notices must be retained in any copies of any part of this * documentation and/or software. */ For the srclib\apr-util\include\apr_md4.h component: * * This is derived from material copyright RSA Data Security, Inc. * Their notice is reproduced below in its entirety. * * Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All * rights reserved. * * License to copy and use this software is granted provided that it * is identified as the "RSA Data Security, Inc. MD4 Message-Digest * Algorithm" in all material mentioning or referencing this software * or this function. * * License is also granted to make and use derivative works provided * that such works are identified as "derived from the RSA Data * Security, Inc. MD4 Message-Digest Algorithm" in all material * mentioning or referencing the derived work. * * RSA Data Security, Inc. makes no representations concerning either * the merchantability of this software or the suitability of this * software for any particular purpose. It is provided "as is" * without express or implied warranty of any kind. * * These notices must be retained in any copies of any part of this * documentation and/or software. */ For the srclib\apr-util\test\testdbm.c component: /* ==================================================================== * The Apache Software License, Version 1.1 * * Copyright (c) 2000-2002 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. The end-user documentation included with the redistribution, * if any, must include the following acknowledgment: * "This product includes software developed by the * Apache Software Foundation (http://www.apache.org/)." * Alternately, this acknowledgment may appear in the software itself, * if and wherever such third-party acknowledgments normally appear. * * 4. The names "Apache" and "Apache Software Foundation" must * not be used to endorse or promote products derived from this * software without prior written permission. For written * permission, please contact apache@apache.org. * * 5. Products derived from this software may not be called "Apache", * nor may "Apache" appear in their name, without prior written * permission of the Apache Software Foundation. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 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 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * ==================================================================== * * This software consists of voluntary contributions made by many * individuals on behalf of the Apache Software Foundation. For more * information on the Apache Software Foundation, please see * . * * This file came from the SDBM package (written by oz@nexus.yorku.ca). * That package was under public domain. This file has been ported to * APR, updated to ANSI C and other, newer idioms, and added to the Apache * codebase under the above copyright and license. */ For the srclib\apr-util\test\testmd4.c component: * * This is derived from material copyright RSA Data Security, Inc. * Their notice is reproduced below in its entirety. * * Copyright (C) 1990-2, RSA Data Security, Inc. Created 1990. All * rights reserved. * * RSA Data Security, Inc. makes no representations concerning either * the merchantability of this software or the suitability of this * software for any particular purpose. It is provided "as is" * without express or implied warranty of any kind. * * These notices must be retained in any copies of any part of this * documentation and/or software. */ For the srclib\apr-util\xml\expat\conftools\install-sh component: # # install - install a program, script, or datafile # This comes from X11R5 (mit/util/scripts/install.sh). # # Copyright 1991 by the Massachusetts Institute of Technology # # Permission to use, copy, modify, distribute, and sell this software and its # documentation for any purpose is hereby granted without fee, provided that # the above copyright notice appear in all copies and that both that # copyright notice and this permission notice appear in supporting # documentation, and that the name of M.I.T. not be used in advertising or # publicity pertaining to distribution of the software without specific, # written prior permission. M.I.T. makes no representations about the # suitability of this software for any purpose. It is provided "as is" # without express or implied warranty. # For the srclib\pcre\install-sh component: # # Copyright 1991 by the Massachusetts Institute of Technology # # Permission to use, copy, modify, distribute, and sell this software and its # documentation for any purpose is hereby granted without fee, provided that # the above copyright notice appear in all copies and that both that # copyright notice and this permission notice appear in supporting # documentation, and that the name of M.I.T. not be used in advertising or # publicity pertaining to distribution of the software without specific, # written prior permission. M.I.T. makes no representations about the # suitability of this software for any purpose. It is provided "as is" # without express or implied warranty. For the pcre component: PCRE LICENCE ------------ PCRE is a library of functions to support regular expressions whose syntax and semantics are as close as possible to those of the Perl 5 language. Release 5 of PCRE is distributed under the terms of the "BSD" licence, as specified below. The documentation for PCRE, supplied in the "doc" directory, is distributed under the same terms as the software itself. Written by: Philip Hazel University of Cambridge Computing Service, Cambridge, England. Phone: +44 1223 334714. Copyright (c) 1997-2004 University of Cambridge All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the University of Cambridge nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 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 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. End PCRE LICENCE For the test\zb.c component: /* ZeusBench V1.01 =============== This program is Copyright (C) Zeus Technology Limited 1996. This program may be used and copied freely providing this copyright notice is not removed. This software is provided "as is" and any express or implied waranties, including but not limited to, the implied warranties of merchantability and fitness for a particular purpose are disclaimed. In no event shall Zeus Technology Ltd. be liable for any direct, indirect, incidental, special, exemplary, or consequential damaged (including, but not limited to, procurement of substitute good or services; loss of use, data, or profits; or business interruption) however caused and on theory of liability. Whether in contract, strict liability or tort (including negligence or otherwise) arising in any way out of the use of this software, even if advised of the possibility of such damage. Written by Adam Twiss (adam@zeus.co.uk). March 1996 Thanks to the following people for their input: Mike Belshe (mbelshe@netscape.com) Michael Campanella (campanella@stevms.enet.dec.com) */ For the expat xml parser component: Copyright (c) 1998, 1999, 2000 Thai Open Source Software Center Ltd and Clark Cooper Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ==================================================================== Resteasy-3.0.6.Final/jaxrs/arquillian/RESTEASY-736-as71/licenses/httpd/NOTICE000066400000000000000000000014741225215345600260330ustar00rootroot00000000000000Apache HTTP Server Copyright 2006 The Apache Software Foundation. This product includes software developed at The Apache Software Foundation (http://www.apache.org/). Portions of this software were developed at the National Center for Supercomputing Applications (NCSA) at the University of Illinois at Urbana-Champaign. This software contains code derived from the RSA Data Security Inc. MD5 Message-Digest Algorithm, including various modifications by Spyglass Inc., Carnegie Mellon University, and Bell Communications Research, Inc (Bellcore). Regular expression support is provided by the PCRE library package, which is open source software, written by Philip Hazel, and copyright by the University of Cambridge, England. The original software is available from ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/ Resteasy-3.0.6.Final/jaxrs/arquillian/RESTEASY-736-as71/licenses/info-zip/000077500000000000000000000000001225215345600255315ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/RESTEASY-736-as71/licenses/info-zip/LICENSE000066400000000000000000000060201225215345600265340ustar00rootroot00000000000000This is version 2005-Feb-10 of the Info-ZIP copyright and license. The definitive version of this document should be available at ftp://ftp.info-zip.org/pub/infozip/license.html indefinitely. Copyright (c) 1990-2005 Info-ZIP. All rights reserved. For the purposes of this copyright and license, "Info-ZIP" is defined as the following set of individuals: Mark Adler, John Bush, Karl Davis, Harald Denker, Jean-Michel Dubois, Jean-loup Gailly, Hunter Goatley, Ed Gordon, Ian Gorman, Chris Herborth, Dirk Haase, Greg Hartwig, Robert Heath, Jonathan Hudson, Paul Kienitz, David Kirschbaum, Johnny Lee, Onno van der Linden, Igor Mandrichenko, Steve P. Miller, Sergio Monesi, Keith Owens, George Petrov, Greg Roelofs, Kai Uwe Rommel, Steve Salisbury, Dave Smith, Steven M. Schweda, Christian Spieler, Cosmin Truta, Antoine Verheijen, Paul von Behren, Rich Wales, Mike White This software is provided "as is," without warranty of any kind, express or implied. In no event shall Info-ZIP or its contributors be held liable for any direct, indirect, incidental, special or consequential damages arising out of the use of or inability to use this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. Redistributions of source code must retain the above copyright notice, definition, disclaimer, and this list of conditions. 2. Redistributions in binary form (compiled executables) must reproduce the above copyright notice, definition, disclaimer, and this list of conditions in documentation and/or other materials provided with the distribution. The sole exception to this condition is redistribution of a standard UnZipSFX binary (including SFXWiz) as part of a self-extracting archive; that is permitted without inclusion of this license, as long as the normal SFX banner has not been removed from the binary or disabled. 3. Altered versions--including, but not limited to, ports to new operating systems, existing ports with new graphical interfaces, and dynamic, shared, or static library versions--must be plainly marked as such and must not be misrepresented as being the original source. Such altered versions also must not be misrepresented as being Info-ZIP releases--including, but not limited to, labeling of the altered versions with the names "Info-ZIP" (or any variation thereof, including, but not limited to, different capitalizations), "Pocket UnZip," "WiZ" or "MacZip" without the explicit permission of Info-ZIP. Such altered versions are further prohibited from misrepresentative use of the Zip-Bugs or Info-ZIP e-mail addresses or of the Info-ZIP URL(s). 4. Info-ZIP retains the right to use the names "Info-ZIP," "Zip," "UnZip," "UnZipSFX," "WiZ," "Pocket UnZip," "Pocket Zip," and "MacZip" for its own source and binary releases. Resteasy-3.0.6.Final/jaxrs/arquillian/RESTEASY-736-as71/licenses/openssl/000077500000000000000000000000001225215345600254615ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/RESTEASY-736-as71/licenses/openssl/LICENSE000066400000000000000000000142071225215345600264720ustar00rootroot00000000000000 LICENSE ISSUES ============== The OpenSSL toolkit stays under a dual license, i.e. both the conditions of the OpenSSL License and the original SSLeay license apply to the toolkit. See below for the actual license texts. Actually both licenses are BSD-style Open Source licenses. In case of any license issues related to OpenSSL please contact openssl-core@openssl.org. OpenSSL License --------------- /* ==================================================================== * Copyright (c) 1998-2005 The OpenSSL Project. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. All advertising materials mentioning features or use of this * software must display the following acknowledgment: * "This product includes software developed by the OpenSSL Project * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" * * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to * endorse or promote products derived from this software without * prior written permission. For written permission, please contact * openssl-core@openssl.org. * * 5. Products derived from this software may not be called "OpenSSL" * nor may "OpenSSL" appear in their names without prior written * permission of the OpenSSL Project. * * 6. Redistributions of any form whatsoever must retain the following * acknowledgment: * "This product includes software developed by the OpenSSL Project * for use in the OpenSSL Toolkit (http://www.openssl.org/)" * * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * 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 OF THIS SOFTWARE, EVEN IF ADVISED * OF THE POSSIBILITY OF SUCH DAMAGE. * ==================================================================== * * This product includes cryptographic software written by Eric Young * (eay@cryptsoft.com). This product includes software written by Tim * Hudson (tjh@cryptsoft.com). * */ Original SSLeay License ----------------------- /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * * This package is an SSL implementation written * by Eric Young (eay@cryptsoft.com). * The implementation was written so as to conform with Netscapes SSL. * * This library is free for commercial and non-commercial use as long as * the following conditions are aheared to. The following conditions * apply to all code found in this distribution, be it the RC4, RSA, * lhash, DES, etc., code; not just the SSL code. The SSL documentation * included with this distribution is covered by the same copyright terms * except that the holder is Tim Hudson (tjh@cryptsoft.com). * * Copyright remains Eric Young's, and as such any Copyright notices in * the code are not to be removed. * If this package is used in a product, Eric Young should be given attribution * as the author of the parts of the library used. * This can be in the form of a textual message at program startup or * in documentation (online or textual) provided with the package. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * "This product includes cryptographic software written by * Eric Young (eay@cryptsoft.com)" * The word 'cryptographic' can be left out if the rouines from the library * being used are not cryptographic related :-). * 4. If you include any Windows specific code (or a derivative thereof) from * the apps directory (application code) you must include an acknowledgement: * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" * * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * 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 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * The licence and distribution terms for any publically available version or * derivative of this code cannot be changed. i.e. this code cannot simply be * copied and put under another distribution licence * [including the GNU Public Licence.] */ Resteasy-3.0.6.Final/jaxrs/arquillian/RESTEASY-736-as71/licenses/zlib/000077500000000000000000000000001225215345600247365ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/RESTEASY-736-as71/licenses/zlib/README000066400000000000000000000131001225215345600256110ustar00rootroot00000000000000ZLIB DATA COMPRESSION LIBRARY zlib 1.2.3 is a general purpose data compression library. All the code is thread safe. The data format used by the zlib library is described by RFCs (Request for Comments) 1950 to 1952 in the files http://www.ietf.org/rfc/rfc1950.txt (zlib format), rfc1951.txt (deflate format) and rfc1952.txt (gzip format). These documents are also available in other formats from ftp://ftp.uu.net/graphics/png/documents/zlib/zdoc-index.html All functions of the compression library are documented in the file zlib.h (volunteer to write man pages welcome, contact zlib@gzip.org). A usage example of the library is given in the file example.c which also tests that the library is working correctly. Another example is given in the file minigzip.c. The compression library itself is composed of all source files except example.c and minigzip.c. To compile all files and run the test program, follow the instructions given at the top of Makefile. In short "make test; make install" should work for most machines. For Unix: "./configure; make test; make install". For MSDOS, use one of the special makefiles such as Makefile.msc. For VMS, use make_vms.com. Questions about zlib should be sent to , or to Gilles Vollant for the Windows DLL version. The zlib home page is http://www.zlib.org or http://www.gzip.org/zlib/ Before reporting a problem, please check this site to verify that you have the latest version of zlib; otherwise get the latest version and check whether the problem still exists or not. PLEASE read the zlib FAQ http://www.gzip.org/zlib/zlib_faq.html before asking for help. Mark Nelson wrote an article about zlib for the Jan. 1997 issue of Dr. Dobb's Journal; a copy of the article is available in http://dogma.net/markn/articles/zlibtool/zlibtool.htm The changes made in version 1.2.3 are documented in the file ChangeLog. Unsupported third party contributions are provided in directory "contrib". A Java implementation of zlib is available in the Java Development Kit http://java.sun.com/j2se/1.4.2/docs/api/java/util/zip/package-summary.html See the zlib home page http://www.zlib.org for details. A Perl interface to zlib written by Paul Marquess is in the CPAN (Comprehensive Perl Archive Network) sites http://www.cpan.org/modules/by-module/Compress/ A Python interface to zlib written by A.M. Kuchling is available in Python 1.5 and later versions, see http://www.python.org/doc/lib/module-zlib.html A zlib binding for TCL written by Andreas Kupries is availlable at http://www.oche.de/~akupries/soft/trf/trf_zip.html An experimental package to read and write files in .zip format, written on top of zlib by Gilles Vollant , is available in the contrib/minizip directory of zlib. Notes for some targets: - For Windows DLL versions, please see win32/DLL_FAQ.txt - For 64-bit Irix, deflate.c must be compiled without any optimization. With -O, one libpng test fails. The test works in 32 bit mode (with the -n32 compiler flag). The compiler bug has been reported to SGI. - zlib doesn't work with gcc 2.6.3 on a DEC 3000/300LX under OSF/1 2.1 it works when compiled with cc. - On Digital Unix 4.0D (formely OSF/1) on AlphaServer, the cc option -std1 is necessary to get gzprintf working correctly. This is done by configure. - zlib doesn't work on HP-UX 9.05 with some versions of /bin/cc. It works with other compilers. Use "make test" to check your compiler. - gzdopen is not supported on RISCOS, BEOS and by some Mac compilers. - For PalmOs, see http://palmzlib.sourceforge.net/ - When building a shared, i.e. dynamic library on Mac OS X, the library must be installed before testing (do "make install" before "make test"), since the library location is specified in the library. Acknowledgments: The deflate format used by zlib was defined by Phil Katz. The deflate and zlib specifications were written by L. Peter Deutsch. Thanks to all the people who reported problems and suggested various improvements in zlib; they are too numerous to cite here. Copyright notice: (C) 1995-2004 Jean-loup Gailly and Mark Adler This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. Jean-loup Gailly Mark Adler jloup@gzip.org madler@alumni.caltech.edu If you use the zlib library in a product, we would appreciate *not* receiving lengthy legal documents to sign. The sources are provided for free but without warranty of any kind. The library has been entirely written by Jean-loup Gailly and Mark Adler; it does not include third-party code. If you redistribute modified sources, we would appreciate that you include in the file ChangeLog history information documenting your changes. Please read the FAQ for more information on the distribution of modified source versions. Resteasy-3.0.6.Final/jaxrs/arquillian/RESTEASY-736-as71/pom.xml000077500000000000000000000122231225215345600235110ustar00rootroot00000000000000 4.0.0 org.jboss.resteasy resteasy-jaxrs-all 3.0.6.Final ../../pom.xml RESTEASY-736-as71 jar RESTEASY-736-as71 UTF-8 3.0.6.Final org.jboss.arquillian arquillian-bom 1.0.0.Final import pom org.jboss.weld weld-core 1.1.5.AS71.Final org.jboss.spec jboss-javaee-6.0 1.0.0.Final pom provided org.jboss.spec.javax.ejb jboss-ejb-api_3.1_spec 1.0.1.Final provided org.jboss.as jboss-as-arquillian-container-managed 7.1.1.Final test org.jboss.arquillian.protocol arquillian-protocol-servlet test org.jboss.resteasy jaxrs-api ${project.version} org.jboss.resteasy resteasy-jaxrs ${project.version} org.jboss.resteasy async-http-jbossweb ${resteasy.version} org.jboss.resteasy.test as7-dist-async 1.1 jar org.jboss.web jbossweb 7.0.13.Final javax.servlet servlet-api provided junit junit 4.8.1 org.jboss.arquillian.junit arquillian-junit-container test org.slf4j slf4j-simple 1.6.4 test org.apache.maven.plugins maven-compiler-plugin 2.3.2 1.6 1.6 org.apache.maven.plugins maven-surefire-plugin 2.12 maven-dependency-plugin unpack process-test-classes unpack org.jboss.resteasy.test as7-dist-async 1.1 jar false target src/test/resources Resteasy-3.0.6.Final/jaxrs/arquillian/RESTEASY-736-as71/src/000077500000000000000000000000001225215345600227605ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/RESTEASY-736-as71/src/main/000077500000000000000000000000001225215345600237045ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/RESTEASY-736-as71/src/main/java/000077500000000000000000000000001225215345600246255ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/RESTEASY-736-as71/src/main/java/org/000077500000000000000000000000001225215345600254145ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/RESTEASY-736-as71/src/main/java/org/jboss/000077500000000000000000000000001225215345600265345ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/RESTEASY-736-as71/src/main/java/org/jboss/resteasy/000077500000000000000000000000001225215345600303735ustar00rootroot00000000000000000077500000000000000000000000001225215345600324135ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/RESTEASY-736-as71/src/main/java/org/jboss/resteasy/resteasy736TestApplication.java000066400000000000000000000010331225215345600363560ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/RESTEASY-736-as71/src/main/java/org/jboss/resteasy/resteasy736package org.jboss.resteasy.resteasy736; import javax.ws.rs.core.Application; import javax.ws.rs.ext.Provider; import java.util.HashSet; import java.util.Set; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright Aug 15, 2012 */ @Provider public class TestApplication extends Application { public Set> getClasses() { HashSet> classes = new HashSet>(); classes.add(TestResource.class); return classes; } } TestResource.java000066400000000000000000000023041225215345600357040ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/RESTEASY-736-as71/src/main/java/org/jboss/resteasy/resteasy736package org.jboss.resteasy.resteasy736; import org.jboss.resteasy.annotations.Suspend; import org.jboss.resteasy.spi.AsynchronousResponse; import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.Produces; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright Aug 15, 2012 */ @Path("/") @Produces("text/plain") public class TestResource { @GET @Path("test") public void test(final @Suspend(5000) AsynchronousResponse response) { Thread t = new Thread() { @Override public void run() { try { System.out.println("TestResource: async thread started"); Thread.sleep(10000); Response jaxrs = Response.ok("test").type(MediaType.TEXT_PLAIN).build(); response.setResponse(jaxrs); System.out.println("TestResource: async thread finished"); } catch (Exception e) { e.printStackTrace(); } } }; t.start(); } } Resteasy-3.0.6.Final/jaxrs/arquillian/RESTEASY-736-as71/src/test/000077500000000000000000000000001225215345600237375ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/RESTEASY-736-as71/src/test/java/000077500000000000000000000000001225215345600246605ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/RESTEASY-736-as71/src/test/java/org/000077500000000000000000000000001225215345600254475ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/RESTEASY-736-as71/src/test/java/org/jboss/000077500000000000000000000000001225215345600265675ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/RESTEASY-736-as71/src/test/java/org/jboss/resteasy/000077500000000000000000000000001225215345600304265ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/RESTEASY-736-as71/src/test/java/org/jboss/resteasy/test/000077500000000000000000000000001225215345600314055ustar00rootroot00000000000000000077500000000000000000000000001225215345600334255ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/RESTEASY-736-as71/src/test/java/org/jboss/resteasy/test/resteasy736AsyncTimeoutTest.java000066400000000000000000000041431225215345600375560ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/RESTEASY-736-as71/src/test/java/org/jboss/resteasy/test/resteasy736package org.jboss.resteasy.test.resteasy736; import org.jboss.arquillian.container.test.api.Deployment; import org.jboss.arquillian.junit.Arquillian; import org.jboss.resteasy.client.ClientRequest; import org.jboss.resteasy.client.ClientResponse; import org.jboss.resteasy.resteasy736.TestApplication; import org.jboss.resteasy.resteasy736.TestResource; import org.jboss.shrinkwrap.api.Archive; import org.jboss.shrinkwrap.api.ShrinkWrap; import org.jboss.shrinkwrap.api.spec.WebArchive; import org.junit.Test; import org.junit.runner.RunWith; import static org.junit.Assert.assertTrue; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright Aug 3, 2012 */ @RunWith(Arquillian.class) public class AsyncTimeoutTest { @Deployment public static Archive createTestArchive() { WebArchive war = ShrinkWrap.create(WebArchive.class, "RESTEASY-736.war") .addClasses(TestApplication.class, TestResource.class) .addClasses(AsyncTimeoutTest.class) .addAsWebInfResource("web.xml"); System.out.println(war.toString(true)); return war; } @Test public void testAsynchTimeout() throws Exception { ClientRequest request = new ClientRequest("http://localhost:8080/RESTEASY-736/test/"); long start = System.currentTimeMillis(); System.out.println("start: " + start); ClientResponse response = null; try { response = request.get(String.class); } catch (Exception e) { System.out.println(e); } finally { System.out.println("finish: " + System.currentTimeMillis()); long elapsed = System.currentTimeMillis() - start; System.out.println("elapsed: " + elapsed + " ms");; System.out.println("status: " + response.getStatus()); assertTrue(response != null); System.out.println("response: " + response.getEntity()); assertTrue(response.getStatus() == 503); assertTrue(elapsed < 10000); } } } Resteasy-3.0.6.Final/jaxrs/arquillian/RESTEASY-736-as71/src/test/resources/000077500000000000000000000000001225215345600257515ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/RESTEASY-736-as71/src/test/resources/arquillian.xml000066400000000000000000000037231225215345600306410ustar00rootroot00000000000000 target/deployments target/jboss-as-7.1.1.Final standalone.xml -Xmx512m -XX:MaxPermSize=128m -Djava.library.path=target/jboss-as-7.1.1.Final/bin/native Resteasy-3.0.6.Final/jaxrs/arquillian/RESTEASY-736-as71/src/test/resources/web.xml000066400000000000000000000016661225215345600272610ustar00rootroot00000000000000 RESTEASY-736 Resteasy org.jboss.resteasy.plugins.server.servlet.HttpServlet30Dispatcher javax.ws.rs.Application org.jboss.resteasy.resteasy736.TestApplication true Resteasy /* Resteasy-3.0.6.Final/jaxrs/arquillian/RESTEASY-736-jetty/000077500000000000000000000000001225215345600225555ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/RESTEASY-736-jetty/.gitignore000066400000000000000000000000221225215345600245370ustar00rootroot00000000000000/target .DS_Store Resteasy-3.0.6.Final/jaxrs/arquillian/RESTEASY-736-jetty/pom.xml000077500000000000000000000077671225215345600241160ustar00rootroot00000000000000 4.0.0 org.jboss.resteasy resteasy-jaxrs-all 3.0.6.Final ../../pom.xml RESTEASY-736-jetty jar RESTEASY-736-jetty UTF-8 8.1.1.v20120215 3.0.6.Final org.jboss.arquillian arquillian-bom 1.0.0.Final import pom org.jboss.arquillian.container arquillian-jetty-embedded-7 1.0.0.CR1 test org.eclipse.jetty jetty-webapp ${jetty.version} test org.eclipse.jetty jetty-plus ${jetty.version} test org.jboss.arquillian.protocol arquillian-protocol-servlet test org.jboss.resteasy jaxrs-api ${resteasy.version} org.jboss.resteasy resteasy-jaxrs ${resteasy.version} org.jboss.resteasy async-http-servlet-3.0 ${resteasy.version} junit junit 4.8.1 org.jboss.arquillian.junit arquillian-junit-container test org.slf4j slf4j-api 1.6.4 javax.servlet javax.servlet-api 3.0.1 provided org.apache.maven.plugins maven-compiler-plugin 2.3.2 1.6 1.6 org.apache.maven.plugins maven-surefire-plugin 2.12 src/test/resources Resteasy-3.0.6.Final/jaxrs/arquillian/RESTEASY-736-jetty/src/000077500000000000000000000000001225215345600233445ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/RESTEASY-736-jetty/src/main/000077500000000000000000000000001225215345600242705ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/RESTEASY-736-jetty/src/main/java/000077500000000000000000000000001225215345600252115ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/RESTEASY-736-jetty/src/main/java/org/000077500000000000000000000000001225215345600260005ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/RESTEASY-736-jetty/src/main/java/org/jboss/000077500000000000000000000000001225215345600271205ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/RESTEASY-736-jetty/src/main/java/org/jboss/resteasy/000077500000000000000000000000001225215345600307575ustar00rootroot00000000000000000077500000000000000000000000001225215345600327775ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/RESTEASY-736-jetty/src/main/java/org/jboss/resteasy/resteasy736TestApplication.java000066400000000000000000000010331225215345600367420ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/RESTEASY-736-jetty/src/main/java/org/jboss/resteasy/resteasy736package org.jboss.resteasy.resteasy736; import javax.ws.rs.core.Application; import javax.ws.rs.ext.Provider; import java.util.HashSet; import java.util.Set; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright Aug 15, 2012 */ @Provider public class TestApplication extends Application { public Set> getClasses() { HashSet> classes = new HashSet>(); classes.add(TestResource.class); return classes; } } TestResource.java000066400000000000000000000037061225215345600362770ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/RESTEASY-736-jetty/src/main/java/org/jboss/resteasy/resteasy736package org.jboss.resteasy.resteasy736; import org.jboss.resteasy.annotations.Suspend; import org.jboss.resteasy.spi.AsynchronousResponse; import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.Produces; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright Aug 15, 2012 */ @Path("/") @Produces("text/plain") public class TestResource { @GET @Path("test") public void test(final @Suspend(5000) AsynchronousResponse response) { Thread t = new Thread() { @Override public void run() { try { System.out.println("TestResource: async thread started"); Thread.sleep(10000); Response jaxrs = Response.ok("test").type(MediaType.TEXT_PLAIN).build(); response.setResponse(jaxrs); System.out.println("TestResource: async thread finished"); } catch (Exception e) { e.printStackTrace(); } } }; t.start(); } @GET @Path("default") public void defaultTest(final @Suspend AsynchronousResponse response) { Thread t = new Thread() { @Override public void run() { try { System.out.println("TestResource: async thread started"); Thread.sleep(35000); // Jetty async timeout defaults to 30000. Response jaxrs = Response.ok("test").type(MediaType.TEXT_PLAIN).build(); response.setResponse(jaxrs); System.out.println("TestResource: async thread finished"); } catch (Exception e) { e.printStackTrace(); } } }; t.start(); } } Resteasy-3.0.6.Final/jaxrs/arquillian/RESTEASY-736-jetty/src/test/000077500000000000000000000000001225215345600243235ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/RESTEASY-736-jetty/src/test/java/000077500000000000000000000000001225215345600252445ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/RESTEASY-736-jetty/src/test/java/org/000077500000000000000000000000001225215345600260335ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/RESTEASY-736-jetty/src/test/java/org/jboss/000077500000000000000000000000001225215345600271535ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/RESTEASY-736-jetty/src/test/java/org/jboss/resteasy/000077500000000000000000000000001225215345600310125ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/RESTEASY-736-jetty/src/test/java/org/jboss/resteasy/test/000077500000000000000000000000001225215345600317715ustar00rootroot00000000000000000077500000000000000000000000001225215345600340115ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/RESTEASY-736-jetty/src/test/java/org/jboss/resteasy/test/resteasy736AsyncTimeoutTest.java000066400000000000000000000062211225215345600401410ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/RESTEASY-736-jetty/src/test/java/org/jboss/resteasy/test/resteasy736package org.jboss.resteasy.test.resteasy736; import org.jboss.arquillian.container.test.api.Deployment; import org.jboss.arquillian.junit.Arquillian; import org.jboss.resteasy.client.ClientRequest; import org.jboss.resteasy.client.ClientResponse; import org.jboss.resteasy.resteasy736.TestApplication; import org.jboss.resteasy.resteasy736.TestResource; import org.jboss.shrinkwrap.api.Archive; import org.jboss.shrinkwrap.api.ShrinkWrap; import org.jboss.shrinkwrap.api.spec.WebArchive; import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; import static org.junit.Assert.*; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright Aug 3, 2012 */ @RunWith(Arquillian.class) public class AsyncTimeoutTest { @Deployment public static Archive createTestArchive() { WebArchive war = ShrinkWrap.create(WebArchive.class, "RESTEASY-736.war") .addClasses(TestApplication.class, TestResource.class) .addClasses(AsyncTimeoutTest.class) .addAsWebInfResource("web.xml"); System.out.println(war.toString(true)); return war; } @Test public void testAsynchTimeout() throws Exception { ClientRequest request = new ClientRequest("http://localhost:9090/RESTEASY-736/test/"); long start = System.currentTimeMillis(); System.out.println("start: " + start); ClientResponse response = null; try { response = request.get(String.class); } catch (Exception e) { System.out.println(e); } finally { System.out.println("finish: " + System.currentTimeMillis()); long elapsed = System.currentTimeMillis() - start; System.out.println("elapsed: " + elapsed + " ms");; System.out.println("status: " + response.getStatus()); assertTrue(response != null); System.out.println("response: " + response.getEntity()); assertTrue(response.getStatus() == 503); assertTrue(elapsed < 10000); } } @Ignore // Fails on master branch. @Test public void testDefaultAsynchTimeout() throws Exception { ClientRequest request = new ClientRequest("http://localhost:9090/RESTEASY-736/default/"); long start = System.currentTimeMillis(); System.out.println("start: " + start); ClientResponse response = null; try { response = request.get(String.class); } catch (Exception e) { System.out.println(e); } finally { System.out.println("finish: " + System.currentTimeMillis()); long elapsed = System.currentTimeMillis() - start; System.out.println("elapsed: " + elapsed + " ms");; System.out.println("status: " + response.getStatus()); assertTrue(response != null); System.out.println("response: " + response.getEntity()); assertTrue(response.getStatus() == 503); assertTrue(elapsed < 35000); // Jetty async timeout defaults to 30000. } } } Resteasy-3.0.6.Final/jaxrs/arquillian/RESTEASY-736-jetty/src/test/resources/000077500000000000000000000000001225215345600263355ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/RESTEASY-736-jetty/src/test/resources/arquillian.xml000066400000000000000000000024751225215345600312300ustar00rootroot00000000000000 target/deployments Resteasy-3.0.6.Final/jaxrs/arquillian/RESTEASY-736-jetty/src/test/resources/web.xml000066400000000000000000000016661225215345600276450ustar00rootroot00000000000000 RESTEASY-736 Resteasy org.jboss.resteasy.plugins.server.servlet.HttpServlet30Dispatcher javax.ws.rs.Application org.jboss.resteasy.resteasy736.TestApplication true Resteasy /* Resteasy-3.0.6.Final/jaxrs/arquillian/RESTEASY-760-jetty/000077500000000000000000000000001225215345600225525ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/RESTEASY-760-jetty/pom.xml000077500000000000000000000077561225215345600241110ustar00rootroot00000000000000 4.0.0 org.jboss.resteasy resteasy-jaxrs-all 3.0.6.Final ../../pom.xml RESTEASY-760-jetty jar RESTEASY-760-jetty UTF-8 8.1.1.v20120215 3.0.6.Final org.jboss.arquillian arquillian-bom 1.0.0.Final import pom org.jboss.arquillian.container arquillian-jetty-embedded-7 1.0.0.CR1 test org.eclipse.jetty jetty-webapp ${jetty.version} test org.eclipse.jetty jetty-plus ${jetty.version} test org.jboss.arquillian.protocol arquillian-protocol-servlet test org.jboss.resteasy jaxrs-api ${resteasy.version} org.jboss.resteasy resteasy-jaxrs ${resteasy.version} org.jboss.resteasy async-http-servlet-3.0 ${resteasy.version} junit junit 4.8.1 org.jboss.arquillian.junit arquillian-junit-container test javax.servlet javax.servlet-api 3.0.1 provided org.apache.maven.plugins maven-compiler-plugin 2.3.2 1.6 1.6 org.apache.maven.plugins maven-surefire-plugin 2.12 src/test/resources Resteasy-3.0.6.Final/jaxrs/arquillian/RESTEASY-760-jetty/src/000077500000000000000000000000001225215345600233415ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/RESTEASY-760-jetty/src/main/000077500000000000000000000000001225215345600242655ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/RESTEASY-760-jetty/src/main/java/000077500000000000000000000000001225215345600252065ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/RESTEASY-760-jetty/src/main/java/org/000077500000000000000000000000001225215345600257755ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/RESTEASY-760-jetty/src/main/java/org/jboss/000077500000000000000000000000001225215345600271155ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/RESTEASY-760-jetty/src/main/java/org/jboss/resteasy/000077500000000000000000000000001225215345600307545ustar00rootroot00000000000000000077500000000000000000000000001225215345600327715ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/RESTEASY-760-jetty/src/main/java/org/jboss/resteasy/resteasy760TestApplication.java000066400000000000000000000010041225215345600367320ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/RESTEASY-760-jetty/src/main/java/org/jboss/resteasy/resteasy760package org.jboss.resteasy.resteasy760; import java.util.HashSet; import java.util.Set; import javax.ws.rs.core.Application; import javax.ws.rs.ext.Provider; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright Aug 15, 2012 */ @Provider public class TestApplication extends Application { public Set> getClasses() { HashSet> classes = new HashSet>(); classes.add(TestResource.class); return classes; } } TestResource.java000066400000000000000000000040351225215345600362650ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/RESTEASY-760-jetty/src/main/java/org/jboss/resteasy/resteasy760package org.jboss.resteasy.resteasy760; import javax.ws.rs.Consumes; import javax.ws.rs.Encoded; import javax.ws.rs.FormParam; import javax.ws.rs.GET; import javax.ws.rs.POST; import javax.ws.rs.PUT; import javax.ws.rs.Path; import javax.ws.rs.Produces; /** * * @author Ron Sigal * @author Achim Bitzer * @version $Revision: 1.1 $ * * Copyright Aug 15, 2012 */ @Path("/") @Produces("text/plain") public class TestResource { @PUT @Path("put/noquery") @Consumes("application/x-www-form-urlencoded") public String noQueryPut(@FormParam("formParam") String formParam) { return formParam; } @PUT @Path("put/noquery/encoded") @Consumes("application/x-www-form-urlencoded") public String noQueryPutEncoded(@Encoded @FormParam("formParam") String formParam) { return formParam; } @POST @Path("post/noquery") @Consumes("application/x-www-form-urlencoded") public String noQueryPost(@FormParam("formParam") String formParam) { return formParam; } @POST @Path("post/noquery/encoded") @Consumes("application/x-www-form-urlencoded") public String noQueryPostEncoded(@Encoded @FormParam("formParam") String formParam) { return formParam; } @PUT @Path("put/query") @Consumes("application/x-www-form-urlencoded") public String queryPut(@FormParam("formParam") String formParam) { return formParam; } @PUT @Path("put/query/encoded") @Consumes("application/x-www-form-urlencoded") public String queryPutEncoded(@Encoded @FormParam("formParam") String formParam) { return formParam; } @POST @Path("post/query") @Consumes("application/x-www-form-urlencoded") public String queryPost(@FormParam("formParam") String formParam) { return formParam; } @POST @Path("post/query/encoded") @Consumes("application/x-www-form-urlencoded") public String queryPostEncoded(@Encoded @FormParam("formParam") String formParam) { return formParam; } } Resteasy-3.0.6.Final/jaxrs/arquillian/RESTEASY-760-jetty/src/test/000077500000000000000000000000001225215345600243205ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/RESTEASY-760-jetty/src/test/java/000077500000000000000000000000001225215345600252415ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/RESTEASY-760-jetty/src/test/java/org/000077500000000000000000000000001225215345600260305ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/RESTEASY-760-jetty/src/test/java/org/jboss/000077500000000000000000000000001225215345600271505ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/RESTEASY-760-jetty/src/test/java/org/jboss/resteasy/000077500000000000000000000000001225215345600310075ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/RESTEASY-760-jetty/src/test/java/org/jboss/resteasy/test/000077500000000000000000000000001225215345600317665ustar00rootroot00000000000000000077500000000000000000000000001225215345600340035ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/RESTEASY-760-jetty/src/test/java/org/jboss/resteasy/test/resteasy760FormParameterTest.java000077500000000000000000000127261225215345600402650ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/RESTEASY-760-jetty/src/test/java/org/jboss/resteasy/test/resteasy760package org.jboss.resteasy.test.resteasy760; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; import org.jboss.arquillian.container.test.api.Deployment; import org.jboss.arquillian.junit.Arquillian; import org.jboss.resteasy.client.ClientRequest; import org.jboss.resteasy.client.ClientResponse; import org.jboss.resteasy.resteasy760.TestApplication; import org.jboss.resteasy.resteasy760.TestResource; import org.jboss.shrinkwrap.api.Archive; import org.jboss.shrinkwrap.api.ShrinkWrap; import org.jboss.shrinkwrap.api.spec.WebArchive; import org.junit.Test; import org.junit.runner.RunWith; /** * * @author Ron Sigal * @author Achim Bitzer * @version $Revision: 1.1 $ * * Copyright Aug 3, 2012 */ @RunWith(Arquillian.class) public class FormParameterTest { @Deployment public static Archive createTestArchive() { WebArchive war = ShrinkWrap.create(WebArchive.class, "RESTEASY-760.war") .addClasses(TestApplication.class, TestResource.class) .addClasses(FormParameterTest.class) .addAsWebInfResource("web.xml"); System.out.println(war.toString(true)); return war; } @Test public void testFormParamWithNoQueryParamPut() throws Exception { ClientRequest request = new ClientRequest("http://localhost:9090/RESTEASY-760/put/noquery/"); request.formParameter("formParam", "abc xyz"); request.header("Content-Type", "application/x-www-form-urlencoded"); ClientResponse response = request.put(String.class); assertTrue(response != null); System.out.println("response: " + response.getEntity()); assertEquals("abc xyz", response.getEntity()); } @Test public void testFormParamWithNoQueryParamPutEncoded() throws Exception { ClientRequest request = new ClientRequest("http://localhost:9090/RESTEASY-760/put/noquery/encoded"); request.formParameter("formParam", "abc xyz"); request.header("Content-Type", "application/x-www-form-urlencoded"); ClientResponse response = request.put(String.class); assertTrue(response != null); System.out.println("response: " + response.getEntity()); assertEquals("abc+xyz", response.getEntity()); } @Test public void testFormParamWithNoQueryParamPost() throws Exception { ClientRequest request = new ClientRequest("http://localhost:9090/RESTEASY-760/post/noquery/"); request.formParameter("formParam", "abc xyz"); request.header("Content-Type", "application/x-www-form-urlencoded"); ClientResponse response = request.post(String.class); assertTrue(response != null); System.out.println("response: " + response.getEntity()); assertEquals("abc xyz", response.getEntity()); } @Test public void testFormParamWithNoQueryParamPostEncoded() throws Exception { ClientRequest request = new ClientRequest("http://localhost:9090/RESTEASY-760/post/noquery/encoded"); request.formParameter("formParam", "abc xyz"); request.header("Content-Type", "application/x-www-form-urlencoded"); ClientResponse response = request.post(String.class); assertTrue(response != null); System.out.println("response: " + response.getEntity()); assertEquals("abc+xyz", response.getEntity()); } @Test public void testFormParamWithQueryParamPut() throws Exception { ClientRequest request = new ClientRequest("http://localhost:9090/RESTEASY-760/put/query?query=xyz"); request.formParameter("formParam", "abc xyz"); request.header("Content-Type", "application/x-www-form-urlencoded"); ClientResponse response = request.put(String.class); assertTrue(response != null); System.out.println("response: " + response.getEntity()); assertEquals("abc xyz", response.getEntity()); } @Test public void testFormParamWithQueryParamPutEncoded() throws Exception { ClientRequest request = new ClientRequest("http://localhost:9090/RESTEASY-760/put/query/encoded?query=xyz"); request.formParameter("formParam", "abc xyz"); request.header("Content-Type", "application/x-www-form-urlencoded"); ClientResponse response = request.put(String.class); assertTrue(response != null); System.out.println("response: " + response.getEntity()); assertEquals("abc+xyz", response.getEntity()); } @Test public void testFormParamWithQueryParamPost() throws Exception { ClientRequest request = new ClientRequest("http://localhost:9090/RESTEASY-760/post/query?query=xyz"); request.formParameter("formParam", "abc xyz"); request.header("Content-Type", "application/x-www-form-urlencoded"); ClientResponse response = request.post(String.class); assertTrue(response != null); System.out.println("response: " + response.getEntity()); assertEquals("abc xyz", response.getEntity()); } @Test public void testFormParamWithQueryParamPostEncoded() throws Exception { ClientRequest request = new ClientRequest("http://localhost:9090/RESTEASY-760/post/query/encoded?query=xyz"); request.formParameter("formParam", "abc xyz"); request.header("Content-Type", "application/x-www-form-urlencoded"); ClientResponse response = request.post(String.class); assertTrue(response != null); System.out.println("response: " + response.getEntity()); assertEquals("abc+xyz", response.getEntity()); } } Resteasy-3.0.6.Final/jaxrs/arquillian/RESTEASY-760-jetty/src/test/resources/000077500000000000000000000000001225215345600263325ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/RESTEASY-760-jetty/src/test/resources/arquillian.xml000066400000000000000000000024751225215345600312250ustar00rootroot00000000000000 target/deployments Resteasy-3.0.6.Final/jaxrs/arquillian/RESTEASY-760-jetty/src/test/resources/web.xml000066400000000000000000000016641225215345600276400ustar00rootroot00000000000000 RESTEASY-736 Resteasy org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher javax.ws.rs.Application org.jboss.resteasy.resteasy760.TestApplication true Resteasy /* Resteasy-3.0.6.Final/jaxrs/arquillian/RESTEASY-767-jetty/000077500000000000000000000000001225215345600225615ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/RESTEASY-767-jetty/pom.xml000066400000000000000000000103771225215345600241060ustar00rootroot00000000000000 4.0.0 org.jboss.resteasy resteasy-jaxrs-all 2.3.6.Final ../../pom.xml RESTEASY-767-jetty jar RESTEASY-767-jetty UTF-8 8.1.1.v20120215 2.3.6.Final org.jboss.arquillian arquillian-bom 1.0.0.Final import pom org.jboss.arquillian.container arquillian-jetty-embedded-7 1.0.0.CR1 test org.eclipse.jetty jetty-webapp ${jetty.version} test org.eclipse.jetty jetty-plus ${jetty.version} test org.jboss.arquillian.protocol arquillian-protocol-servlet test org.jboss.resteasy jaxrs-api ${resteasy.version} org.jboss.resteasy resteasy-jaxrs ${resteasy.version} org.jboss.resteasy async-http-servlet-3.0 ${resteasy.version} junit junit 4.10 org.jboss.arquillian.junit arquillian-junit-container test org.slf4j slf4j-api 1.6.4 javax.servlet javax.servlet-api 3.0.1 provided commons-logging commons-logging 1.1.1 test org.apache.maven.plugins maven-compiler-plugin 2.3.2 1.6 1.6 org.apache.maven.plugins maven-surefire-plugin 2.12 src/test/resources Resteasy-3.0.6.Final/jaxrs/arquillian/RESTEASY-767-jetty/src/000077500000000000000000000000001225215345600233505ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/RESTEASY-767-jetty/src/main/000077500000000000000000000000001225215345600242745ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/RESTEASY-767-jetty/src/main/java/000077500000000000000000000000001225215345600252155ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/RESTEASY-767-jetty/src/main/java/org/000077500000000000000000000000001225215345600260045ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/RESTEASY-767-jetty/src/main/java/org/jboss/000077500000000000000000000000001225215345600271245ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/RESTEASY-767-jetty/src/main/java/org/jboss/resteasy/000077500000000000000000000000001225215345600307635ustar00rootroot00000000000000000077500000000000000000000000001225215345600330075ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/RESTEASY-767-jetty/src/main/java/org/jboss/resteasy/resteasy767TestApplication.java000066400000000000000000000011641225215345600367570ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/RESTEASY-767-jetty/src/main/java/org/jboss/resteasy/resteasy767package org.jboss.resteasy.resteasy767; import java.util.HashSet; import java.util.Set; import javax.ws.rs.core.Application; import javax.ws.rs.ext.Provider; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright Aug 15, 2012 */ @Provider public class TestApplication extends Application { public Set> getClasses() { HashSet> classes = new HashSet>(); classes.add(TestResource.class); classes.add(TestMessageBodyWriterInterceptor.class); classes.add(TestPostProcessInterceptor.class); return classes; } } TestMessageBodyWriterInterceptor.java000066400000000000000000000014311225215345600423270ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/RESTEASY-767-jetty/src/main/java/org/jboss/resteasy/resteasy767package org.jboss.resteasy.resteasy767; import java.io.IOException; import javax.ws.rs.WebApplicationException; import javax.ws.rs.ext.Provider; import org.jboss.resteasy.annotations.interception.ServerInterceptor; import org.jboss.resteasy.spi.interception.MessageBodyWriterContext; import org.jboss.resteasy.spi.interception.MessageBodyWriterInterceptor; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright Feb 27, 2013 */ @Provider @ServerInterceptor public class TestMessageBodyWriterInterceptor implements MessageBodyWriterInterceptor { public static boolean called; public void write(MessageBodyWriterContext context) throws IOException, WebApplicationException { called = true; context.proceed(); } }TestPostProcessInterceptor.java000066400000000000000000000011551225215345600412170ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/RESTEASY-767-jetty/src/main/java/org/jboss/resteasy/resteasy767package org.jboss.resteasy.resteasy767; import javax.ws.rs.ext.Provider; import org.jboss.resteasy.annotations.interception.ServerInterceptor; import org.jboss.resteasy.core.ServerResponse; import org.jboss.resteasy.spi.interception.PostProcessInterceptor; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright Feb 27, 2013 */ @Provider @ServerInterceptor public class TestPostProcessInterceptor implements PostProcessInterceptor { public static boolean called; @Override public void postProcess(ServerResponse response) { called = true; } } TestResource.java000066400000000000000000000024371225215345600363070ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/RESTEASY-767-jetty/src/main/java/org/jboss/resteasy/resteasy767package org.jboss.resteasy.resteasy767; import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.core.Response; import org.jboss.resteasy.annotations.Suspend; import org.jboss.resteasy.spi.AsynchronousResponse; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright Feb 28, 2013 */ @Path("/") public class TestResource { @GET @Path("sync") public Response sync() { return Response.ok().entity("sync").build(); } @GET @Path("async/delay") public void asyncDelay(final @Suspend(10000) AsynchronousResponse response) throws Exception { Thread t = new Thread() { @Override public void run() { try { Thread.sleep(5000); Response jaxrs = Response.ok("async/delay").build(); response.setResponse(jaxrs); } catch (Exception e) { e.printStackTrace(); } } }; t.start(); } @GET @Path("async/nodelay") public void asyncNoDelay(final @Suspend(10000) AsynchronousResponse response) throws Exception { Response jaxrs = Response.ok("async/nodelay").build(); response.setResponse(jaxrs); } } Resteasy-3.0.6.Final/jaxrs/arquillian/RESTEASY-767-jetty/src/test/000077500000000000000000000000001225215345600243275ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/RESTEASY-767-jetty/src/test/java/000077500000000000000000000000001225215345600252505ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/RESTEASY-767-jetty/src/test/java/org/000077500000000000000000000000001225215345600260375ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/RESTEASY-767-jetty/src/test/java/org/jboss/000077500000000000000000000000001225215345600271575ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/RESTEASY-767-jetty/src/test/java/org/jboss/resteasy/000077500000000000000000000000001225215345600310165ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/RESTEASY-767-jetty/src/test/java/org/jboss/resteasy/test/000077500000000000000000000000001225215345600317755ustar00rootroot00000000000000000077500000000000000000000000001225215345600340215ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/RESTEASY-767-jetty/src/test/java/org/jboss/resteasy/test/resteasy767AsyncPostProcessingTest.java000066400000000000000000000077071225215345600415170ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/RESTEASY-767-jetty/src/test/java/org/jboss/resteasy/test/resteasy767package org.jboss.resteasy.test.resteasy767; import static org.junit.Assert.assertEquals; import junit.framework.Assert; import org.jboss.arquillian.container.test.api.Deployment; import org.jboss.arquillian.junit.Arquillian; import org.jboss.resteasy.client.ClientRequest; import org.jboss.resteasy.client.ClientResponse; import org.jboss.resteasy.resteasy767.TestApplication; import org.jboss.resteasy.resteasy767.TestMessageBodyWriterInterceptor; import org.jboss.resteasy.resteasy767.TestPostProcessInterceptor; import org.jboss.resteasy.resteasy767.TestResource; import org.jboss.shrinkwrap.api.Archive; import org.jboss.shrinkwrap.api.ShrinkWrap; import org.jboss.shrinkwrap.api.spec.WebArchive; import org.junit.Test; import org.junit.runner.RunWith; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright Feb 27, 2013 */ @RunWith(Arquillian.class) public class AsyncPostProcessingTest { @Deployment public static Archive createTestArchive() { WebArchive war = ShrinkWrap.create(WebArchive.class, "RESTEASY-767.war") .addClasses(TestApplication.class, TestResource.class) .addClasses(TestMessageBodyWriterInterceptor.class, TestPostProcessInterceptor.class) .addAsWebInfResource("web.xml"); System.out.println(war.toString(true)); return war; } @Test public void testSync() throws Exception { reset(); ClientRequest request = new ClientRequest("http://localhost:9090/RESTEASY-767/sync"); ClientResponse response = request.get(); System.out.println("Status: " + response.getStatus()); assertEquals(200, response.getStatus()); System.out.println("TestMessageBodyWriterInterceptor.called: " + TestMessageBodyWriterInterceptor.called); System.out.println("TestPostProcessInterceptor.called: " + TestPostProcessInterceptor.called); System.out.println("returned entity: " + response.getEntity(String.class)); Assert.assertTrue(TestMessageBodyWriterInterceptor.called); Assert.assertTrue(TestPostProcessInterceptor.called); Assert.assertEquals("sync", response.getEntity(String.class)); } @Test public void testAsyncWithDelay() throws Exception { reset(); ClientRequest request = new ClientRequest("http://localhost:9090/RESTEASY-767/async/delay"); ClientResponse response = request.get(); System.out.println("Status: " + response.getStatus()); assertEquals(200, response.getStatus()); System.out.println("TestMessageBodyWriterInterceptor.called: " + TestMessageBodyWriterInterceptor.called); System.out.println("TestPostProcessInterceptor.called: " + TestPostProcessInterceptor.called); System.out.println("returned entity: " + response.getEntity(String.class)); Assert.assertTrue(TestMessageBodyWriterInterceptor.called); Assert.assertTrue(TestPostProcessInterceptor.called); Assert.assertEquals("async/delay", response.getEntity(String.class)); } @Test public void testAsyncWithNoDelay() throws Exception { reset(); ClientRequest request = new ClientRequest("http://localhost:9090/RESTEASY-767/async/nodelay"); ClientResponse response = request.get(); System.out.println("Status: " + response.getStatus()); assertEquals(200, response.getStatus()); System.out.println("TestMessageBodyWriterInterceptor.called: " + TestMessageBodyWriterInterceptor.called); System.out.println("TestPostProcessInterceptor.called: " + TestPostProcessInterceptor.called); System.out.println("returned entity: " + response.getEntity(String.class)); Assert.assertTrue(TestMessageBodyWriterInterceptor.called); Assert.assertTrue(TestPostProcessInterceptor.called); Assert.assertEquals("async/nodelay", response.getEntity(String.class)); } private void reset() { TestMessageBodyWriterInterceptor.called = false; TestPostProcessInterceptor.called = false; } } Resteasy-3.0.6.Final/jaxrs/arquillian/RESTEASY-767-jetty/src/test/resources/000077500000000000000000000000001225215345600263415ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/RESTEASY-767-jetty/src/test/resources/arquillian.xml000066400000000000000000000024751225215345600312340ustar00rootroot00000000000000 target/deployments Resteasy-3.0.6.Final/jaxrs/arquillian/RESTEASY-767-jetty/src/test/resources/web.xml000066400000000000000000000015171225215345600276440ustar00rootroot00000000000000 RESTEASY-736 Resteasy org.jboss.resteasy.plugins.server.servlet.HttpServlet30Dispatcher javax.ws.rs.Application org.jboss.resteasy.resteasy767.TestApplication true Resteasy /* Resteasy-3.0.6.Final/jaxrs/arquillian/RESTEASY-800-AS71/000077500000000000000000000000001225215345600220615ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/RESTEASY-800-AS71/.gitignore000066400000000000000000000000221225215345600240430ustar00rootroot00000000000000/target .DS_Store Resteasy-3.0.6.Final/jaxrs/arquillian/RESTEASY-800-AS71/pom.xml000077500000000000000000000113271225215345600234050ustar00rootroot00000000000000 4.0.0 org.jboss.resteasy resteasy-jaxrs-all 3.0.6.Final ../../pom.xml RESTEASY-800-AS71 jar RESTEASY-800-AS71 http://maven.apache.org UTF-8 7.1.1.Final org.apache.maven.plugins maven-compiler-plugin 2.3.2 1.6 1.6 maven-surefire-plugin 2.12 maven-dependency-plugin unpack process-test-classes unpack org.jboss.as jboss-as-dist 7.1.1.Final zip false target org.apache.maven.plugins maven-antrun-plugin 1.6 unpack resteasy process-test-classes run org.jboss.arquillian arquillian-bom 1.0.3.Final import pom org.jboss.spec jboss-javaee-6.0 1.0.0.Final pom provided junit junit 4.8.1 test org.jboss.arquillian.junit arquillian-junit-container test org.jboss.as jboss-as-arquillian-container-managed 7.1.1.Final test org.jboss.arquillian.protocol arquillian-protocol-servlet test org.jboss.resteasy jaxrs-api ${project.version} org.jboss.resteasy resteasy-jaxrs ${project.version} Resteasy-3.0.6.Final/jaxrs/arquillian/RESTEASY-800-AS71/src/000077500000000000000000000000001225215345600226505ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/RESTEASY-800-AS71/src/main/000077500000000000000000000000001225215345600235745ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/RESTEASY-800-AS71/src/main/java/000077500000000000000000000000001225215345600245155ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/RESTEASY-800-AS71/src/main/java/org/000077500000000000000000000000001225215345600253045ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/RESTEASY-800-AS71/src/main/java/org/jboss/000077500000000000000000000000001225215345600264245ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/RESTEASY-800-AS71/src/main/java/org/jboss/resteasy/000077500000000000000000000000001225215345600302635ustar00rootroot00000000000000000077500000000000000000000000001225215345600322735ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/RESTEASY-800-AS71/src/main/java/org/jboss/resteasy/resteasy800TestApplication.java000066400000000000000000000010031225215345600362330ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/RESTEASY-800-AS71/src/main/java/org/jboss/resteasy/resteasy800package org.jboss.resteasy.resteasy800; import java.util.HashSet; import java.util.Set; import javax.ws.rs.core.Application; import javax.ws.rs.ext.Provider; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright Mar 5, 2013 */ @Provider public class TestApplication extends Application { public Set> getClasses() { HashSet> classes = new HashSet>(); classes.add(TestResource.class); return classes; } } TestResource.java000066400000000000000000000006121225215345600355640ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/RESTEASY-800-AS71/src/main/java/org/jboss/resteasy/resteasy800package org.jboss.resteasy.resteasy800; import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.core.Response; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright Mar 5, 2013 */ @Path("/") public class TestResource { @GET @Path("test") public Response test() { return Response.ok("test").build(); } } Resteasy-3.0.6.Final/jaxrs/arquillian/RESTEASY-800-AS71/src/test/000077500000000000000000000000001225215345600236275ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/RESTEASY-800-AS71/src/test/java/000077500000000000000000000000001225215345600245505ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/RESTEASY-800-AS71/src/test/java/org/000077500000000000000000000000001225215345600253375ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/RESTEASY-800-AS71/src/test/java/org/jboss/000077500000000000000000000000001225215345600264575ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/RESTEASY-800-AS71/src/test/java/org/jboss/resteasy/000077500000000000000000000000001225215345600303165ustar00rootroot00000000000000000077500000000000000000000000001225215345600323265ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/RESTEASY-800-AS71/src/test/java/org/jboss/resteasy/resteasy800ModulesTest.java000066400000000000000000000031101225215345600354340ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/RESTEASY-800-AS71/src/test/java/org/jboss/resteasy/resteasy800package org.jboss.resteasy.resteasy800; import static org.junit.Assert.assertEquals; import org.jboss.arquillian.container.test.api.Deployment; import org.jboss.arquillian.junit.Arquillian; import org.jboss.resteasy.client.ClientRequest; import org.jboss.resteasy.client.ClientResponse; import org.jboss.resteasy.resteasy800.TestApplication; import org.jboss.resteasy.resteasy800.TestResource; import org.jboss.shrinkwrap.api.Archive; import org.jboss.shrinkwrap.api.ShrinkWrap; import org.jboss.shrinkwrap.api.spec.WebArchive; import org.junit.Test; import org.junit.runner.RunWith; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright Mar 5, 2013 */ @RunWith(Arquillian.class) public class ModulesTest { private static final Logger log = LoggerFactory.getLogger(ModulesTest.class); @Deployment public static Archive createTestArchive() { WebArchive war = ShrinkWrap.create(WebArchive.class, "RESTEASY-800.war") .addClasses(TestApplication.class, TestResource.class) .addAsWebInfResource("web.xml"); System.out.println(war.toString(true)); return war; } @Test public void testModules() throws Exception { ClientRequest request = new ClientRequest("http://localhost:8080/RESTEASY-800/test"); ClientResponse response = request.get(String.class); log.info("status: " + response.getStatus()); log.info("entity: " + response.getEntity()); assertEquals(200, response.getStatus()); } } Resteasy-3.0.6.Final/jaxrs/arquillian/RESTEASY-800-AS71/src/test/resources/000077500000000000000000000000001225215345600256415ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/RESTEASY-800-AS71/src/test/resources/arquillian.xml000066400000000000000000000017341225215345600305310ustar00rootroot00000000000000 target/deployments target/jboss-as-7.1.1.Final standalone-full.xml Resteasy-3.0.6.Final/jaxrs/arquillian/RESTEASY-800-AS71/src/test/resources/web.xml000066400000000000000000000016641225215345600271470ustar00rootroot00000000000000 RESTEASY-802 Resteasy org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher javax.ws.rs.Application org.jboss.resteasy.resteasy800.TestApplication true Resteasy /* Resteasy-3.0.6.Final/jaxrs/arquillian/ValidationTest-AS7/000077500000000000000000000000001225215345600231665ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/ValidationTest-AS7/.gitignore000066400000000000000000000000221225215345600251500ustar00rootroot00000000000000/target .DS_Store Resteasy-3.0.6.Final/jaxrs/arquillian/ValidationTest-AS7/pom.xml000077500000000000000000000130651225215345600245130ustar00rootroot00000000000000 4.0.0 org.jboss.resteasy resteasy-jaxrs-all 3.0.6.Final ../../pom.xml Validation-test-AS7 jar Validation test AS7 http://maven.apache.org UTF-8 7.1.1.Final org.apache.maven.plugins maven-compiler-plugin 2.3.2 1.6 1.6 maven-surefire-plugin 2.12 maven-dependency-plugin unpack process-test-classes unpack org.jboss.as jboss-as-dist 7.1.1.Final zip false target org.apache.maven.plugins maven-antrun-plugin 1.6 unpack resteasy process-test-classes run org.jboss.arquillian arquillian-bom 1.0.3.Final import pom org.jboss.spec jboss-javaee-6.0 1.0.0.Final pom provided junit junit 4.8.1 test org.jboss.arquillian.junit arquillian-junit-container test org.jboss.as jboss-as-arquillian-container-managed 7.1.1.Final test org.jboss.arquillian.protocol arquillian-protocol-servlet test org.jboss.resteasy jaxrs-api ${project.version} org.jboss.resteasy resteasy-jaxrs ${project.version} org.jboss.resteasy resteasy-hibernatevalidator-provider ${project.version} javax.validation validation-api 1.0.0.GA org.hibernate hibernate-validator 4.3.1.Final javax.el javax.el-api 2.2.4 org.glassfish.web javax.el 2.2.4 Resteasy-3.0.6.Final/jaxrs/arquillian/ValidationTest-AS7/src/000077500000000000000000000000001225215345600237555ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/ValidationTest-AS7/src/main/000077500000000000000000000000001225215345600247015ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/ValidationTest-AS7/src/main/java/000077500000000000000000000000001225215345600256225ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/ValidationTest-AS7/src/main/java/org/000077500000000000000000000000001225215345600264115ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/ValidationTest-AS7/src/main/java/org/jboss/000077500000000000000000000000001225215345600275315ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/ValidationTest-AS7/src/main/java/org/jboss/resteasy/000077500000000000000000000000001225215345600313705ustar00rootroot00000000000000000077500000000000000000000000001225215345600334435ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/ValidationTest-AS7/src/main/java/org/jboss/resteasy/validationFoo.java000066400000000000000000000010351225215345600350300ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/ValidationTest-AS7/src/main/java/org/jboss/resteasy/validationpackage org.jboss.resteasy.validation; import java.io.Serializable; @FooConstraint(min = 1, max = 3) public class Foo implements Serializable { private static final long serialVersionUID = -1068336400309384949L; public String s; public Foo(String s) { this.s = s; } public String toString() { return "Foo[" + s + "]"; } public boolean equals(Object o) { if (o == null || !(o instanceof Foo)) { return false; } return this.s.equals(Foo.class.cast(o).s); } } FooConstraint.java000066400000000000000000000016341225215345600371020ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/ValidationTest-AS7/src/main/java/org/jboss/resteasy/validationpackage org.jboss.resteasy.validation; import static java.lang.annotation.ElementType.METHOD; import static java.lang.annotation.ElementType.PARAMETER; import static java.lang.annotation.ElementType.TYPE; import static java.lang.annotation.RetentionPolicy.RUNTIME; import java.lang.annotation.Documented; import java.lang.annotation.Retention; import java.lang.annotation.Target; import javax.validation.Constraint; import javax.validation.Payload; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright May 18, 2013 */ @Documented @Constraint(validatedBy = FooValidator.class) @Target({ TYPE, PARAMETER, METHOD }) @Retention(RUNTIME) public @interface FooConstraint { String message() default "s must have length: {min} <= length <= {max}"; Class[] groups() default {}; Class[] payload() default {}; int min(); int max(); } FooReaderWriter.java000066400000000000000000000040331225215345600373510ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/ValidationTest-AS7/src/main/java/org/jboss/resteasy/validationpackage org.jboss.resteasy.validation; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.lang.annotation.Annotation; import java.lang.reflect.Type; import javax.ws.rs.Consumes; import javax.ws.rs.Produces; import javax.ws.rs.WebApplicationException; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.MultivaluedMap; import javax.ws.rs.ext.MessageBodyReader; import javax.ws.rs.ext.MessageBodyWriter; import javax.ws.rs.ext.Provider; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright May 18, 2013 */ @Provider @Produces("application/foo") @Consumes("application/foo") public class FooReaderWriter implements MessageBodyReader, MessageBodyWriter { public boolean isWriteable(Class type, Type genericType, Annotation[] annotations, MediaType mediaType) { return Foo.class.equals(type); } public long getSize(Foo t, Class type, Type genericType, Annotation[] annotations, MediaType mediaType) { return -1; } public void writeTo(Foo t, Class type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap httpHeaders, OutputStream entityStream) throws IOException, WebApplicationException { byte[] b = t.s.getBytes(); entityStream.write(b.length); entityStream.write(t.s.getBytes()); entityStream.flush(); } public boolean isReadable(Class type, Type genericType, Annotation[] annotations, MediaType mediaType) { return Foo.class.equals(type); } public Foo readFrom(Class type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap httpHeaders, InputStream entityStream) throws IOException, WebApplicationException { int length = entityStream.read(); byte[] b = new byte[length]; entityStream.read(b); String s = new String(b); return new Foo(s); } } FooValidator.java000066400000000000000000000012351225215345600367000ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/ValidationTest-AS7/src/main/java/org/jboss/resteasy/validationpackage org.jboss.resteasy.validation; import javax.validation.ConstraintValidator; import javax.validation.ConstraintValidatorContext; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright May 18, 2013 */ public class FooValidator implements ConstraintValidator { int min; int max; public void initialize(FooConstraint constraintAnnotation) { min = constraintAnnotation.min(); max = constraintAnnotation.max(); } public boolean isValid(Foo value, ConstraintValidatorContext context) { return min <= value.s.length() && value.s.length() <= max; } }JaxRsActivator.java000066400000000000000000000007751225215345600372230ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/ValidationTest-AS7/src/main/java/org/jboss/resteasy/validationpackage org.jboss.resteasy.validation; import javax.ws.rs.ApplicationPath; import javax.ws.rs.core.Application; /** * A class extending {@link Application} and annotated with @ApplicationPath is the Java EE 6 * "no XML" approach to activating JAX-RS. * *

* Resources are served relative to the servlet path specified in the {@link ApplicationPath} * annotation. *

*/ @ApplicationPath("/rest") public class JaxRsActivator extends Application { /* class body intentionally left blank */ }TestClassConstraint.java000066400000000000000000000014311225215345600402570ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/ValidationTest-AS7/src/main/java/org/jboss/resteasy/validationpackage org.jboss.resteasy.validation; import static java.lang.annotation.ElementType.TYPE; import static java.lang.annotation.RetentionPolicy.RUNTIME; import java.lang.annotation.Documented; import java.lang.annotation.Retention; import java.lang.annotation.Target; import javax.validation.Constraint; import javax.validation.Payload; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright May 18, 2013 */ @Documented @Constraint(validatedBy = TestClassValidator.class) @Target({TYPE}) @Retention(RUNTIME) public @interface TestClassConstraint { String message() default "Concatenation of s and t must have length > {value}"; Class[] groups() default {}; Class[] payload() default {}; int value(); } TestClassValidator.java000066400000000000000000000021101225215345600400530ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/ValidationTest-AS7/src/main/java/org/jboss/resteasy/validationpackage org.jboss.resteasy.validation; import javax.validation.ConstraintValidator; import javax.validation.ConstraintValidatorContext; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright May 18, 2013 */ public class TestClassValidator implements ConstraintValidator { int length; public void initialize(TestClassConstraint constraintAnnotation) { length = constraintAnnotation.value(); System.out.println(this + " length: " + length); } public boolean isValid(TestResourceWithAllViolationTypes value, ConstraintValidatorContext context) { System.out.println(this + " value: " + value); System.out.println(this + " value.s: " + value.s); System.out.println(this + " value.retrieveS(): " + value.retrieveS()); System.out.println(this + " value.getT(): " + value.getT()); boolean b = value.retrieveS().length() + value.getT().length() >= length; System.out.println("b: " + b); return b; // return true; } } TestResourceWithAllViolationTypes.java000066400000000000000000000020611225215345600431330ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/ValidationTest-AS7/src/main/java/org/jboss/resteasy/validationpackage org.jboss.resteasy.validation; import javax.validation.constraints.Size; import javax.ws.rs.POST; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import org.jboss.resteasy.plugins.validation.hibernate.ValidateRequest; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright May 18, 2013 */ @Path("all") @TestClassConstraint(5) @ValidateRequest public class TestResourceWithAllViolationTypes { @Size(min=2, max=4) @PathParam("s") String s; private String t; @Size(min=3, max=5) public String getT() { return t; } public String retrieveS() { return s; } @PathParam("t") public void setT(String t) { System.out.println(this + " t: " + t); this.t = t; } @POST @Path("{s}/{t}") @FooConstraint(min=4,max=5) public Foo post(@FooConstraint(min=3,max=5) Foo foo, @PathParam("s") String s) { System.out.println(this + " s: " + s); System.out.println(this + " this.s: " + this.s); return foo; } } TestResourceWithReturnValues.java000066400000000000000000000014121225215345600421470ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/ValidationTest-AS7/src/main/java/org/jboss/resteasy/validationpackage org.jboss.resteasy.validation; import javax.validation.Valid; import javax.ws.rs.POST; import javax.ws.rs.Path; import org.jboss.resteasy.plugins.validation.hibernate.ValidateRequest; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright May 18, 2013 */ @Path("/return") @ValidateRequest public class TestResourceWithReturnValues { @POST @Path("/native") @Valid public Foo postNative(Foo foo) { return foo; } @POST @Path("/imposed") @FooConstraint(min=3,max=5) public Foo postImposed(Foo foo) { return foo; } @POST @Path("nativeAndImposed") @Valid @FooConstraint(min=3,max=5) public Foo postNativeAndImposed(Foo foo) { return foo; } } Resteasy-3.0.6.Final/jaxrs/arquillian/ValidationTest-AS7/src/main/resources/000077500000000000000000000000001225215345600267135ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/ValidationTest-AS7/src/main/resources/META-INF/000077500000000000000000000000001225215345600300535ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/ValidationTest-AS7/src/main/resources/META-INF/services/000077500000000000000000000000001225215345600316765ustar00rootroot00000000000000javax.ws.rs.ext.Providers000066400000000000000000000000611225215345600364760ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/ValidationTest-AS7/src/main/resources/META-INF/servicesorg.jboss.resteasy.validation.FooReaderWriter Resteasy-3.0.6.Final/jaxrs/arquillian/ValidationTest-AS7/src/test/000077500000000000000000000000001225215345600247345ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/ValidationTest-AS7/src/test/java/000077500000000000000000000000001225215345600256555ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/ValidationTest-AS7/src/test/java/org/000077500000000000000000000000001225215345600264445ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/ValidationTest-AS7/src/test/java/org/jboss/000077500000000000000000000000001225215345600275645ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/ValidationTest-AS7/src/test/java/org/jboss/resteasy/000077500000000000000000000000001225215345600314235ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/ValidationTest-AS7/src/test/java/org/jboss/resteasy/test/000077500000000000000000000000001225215345600324025ustar00rootroot00000000000000000077500000000000000000000000001225215345600344555ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/ValidationTest-AS7/src/test/java/org/jboss/resteasy/test/validationTestValidation.java000066400000000000000000000234731225215345600402630ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/ValidationTest-AS7/src/test/java/org/jboss/resteasy/test/validationpackage org.jboss.resteasy.test.validation; import java.util.Iterator; import junit.framework.Assert; import org.jboss.arquillian.container.test.api.Deployment; import org.jboss.arquillian.junit.Arquillian; import org.jboss.resteasy.api.validation.ResteasyConstraintViolation; import org.jboss.resteasy.api.validation.ResteasyViolationException; import org.jboss.resteasy.api.validation.Validation; import org.jboss.resteasy.client.ClientRequest; import org.jboss.resteasy.client.ClientResponse; import org.jboss.resteasy.validation.Foo; import org.jboss.resteasy.validation.FooConstraint; import org.jboss.resteasy.validation.FooReaderWriter; import org.jboss.resteasy.validation.FooValidator; import org.jboss.resteasy.validation.JaxRsActivator; import org.jboss.resteasy.validation.TestClassConstraint; import org.jboss.resteasy.validation.TestClassValidator; import org.jboss.resteasy.validation.TestResourceWithAllViolationTypes; import org.jboss.resteasy.validation.TestResourceWithReturnValues; import org.jboss.shrinkwrap.api.Archive; import org.jboss.shrinkwrap.api.ShrinkWrap; import org.jboss.shrinkwrap.api.spec.WebArchive; import org.junit.Test; import org.junit.runner.RunWith; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Created Mar 16, 2012 */ @RunWith(Arquillian.class) public class TestValidation { @Deployment public static Archive createTestArchive() { WebArchive war = ShrinkWrap.create(WebArchive.class, "Validation-test.war") .addClasses(JaxRsActivator.class) .addClasses(Foo.class, FooConstraint.class, FooReaderWriter.class, FooValidator.class) .addClasses(TestClassConstraint.class, TestClassValidator.class) .addClasses(TestResourceWithAllViolationTypes.class, TestResourceWithReturnValues.class) .addAsResource("META-INF/services/javax.ws.rs.ext.Providers") ; System.out.println(war.toString(true)); return war; } @Test public void testReturnValues() throws Exception { // Valid native constraint ClientRequest request = new ClientRequest("http://localhost:8080/Validation-test/rest/return/native"); Foo foo = new Foo("a"); request.body("application/foo", foo); ClientResponse response = request.post(Foo.class); Assert.assertEquals(200, response.getStatus()); Assert.assertEquals(foo, response.getEntity()); // Valid imposed constraint request = new ClientRequest("http://localhost:8080/Validation-test/rest/return/imposed"); foo = new Foo("abcde"); request.body("application/foo", foo); response = request.post(Foo.class); Assert.assertEquals(200, response.getStatus()); Assert.assertEquals(foo, response.getEntity()); // Valid native and imposed constraints. request = new ClientRequest("http://localhost:8080/Validation-test/rest/return/nativeAndImposed"); foo = new Foo("abc"); request.body("application/foo", foo); response = request.post(Foo.class); Assert.assertEquals(200, response.getStatus()); Assert.assertEquals(foo, response.getEntity()); { // Invalid native constraint request = new ClientRequest("http://localhost:8080/Validation-test/rest/return/native"); request.body("application/foo", new Foo("abcdef")); response = request.post(); Assert.assertEquals(500, response.getStatus()); String header = response.getResponseHeaders().getFirst(Validation.VALIDATION_HEADER); Assert.assertNotNull(header); Assert.assertTrue(Boolean.valueOf(header)); String entity = response.getEntity(String.class); System.out.println("entity: " + entity); ResteasyViolationException e = new ResteasyViolationException(entity); ResteasyConstraintViolation violation = e.getReturnValueViolations().iterator().next(); System.out.println("violation: " + violation); Assert.assertTrue(violation.getMessage().equals("s must have length: 1 <= length <= 3")); Assert.assertEquals("Foo[abcdef]", violation.getValue()); } { // Invalid imposed constraint request = new ClientRequest("http://localhost:8080/Validation-test/rest/return/imposed"); request.body("application/foo", new Foo("abcdef")); response = request.post(Foo.class); Assert.assertEquals(500, response.getStatus()); String header = response.getResponseHeaders().getFirst(Validation.VALIDATION_HEADER); Assert.assertNotNull(header); Assert.assertTrue(Boolean.valueOf(header)); String entity = response.getEntity(String.class); System.out.println("entity: " + entity); ResteasyViolationException e = new ResteasyViolationException(entity); countViolations(e, 1, 0, 0, 0, 0, 1); ResteasyConstraintViolation violation = e.getReturnValueViolations().iterator().next(); System.out.println("violation: " + violation); Assert.assertTrue(violation.getMessage().equals("s must have length: 3 <= length <= 5")); Assert.assertEquals("Foo[abcdef]", violation.getValue()); } { // Invalid native and imposed constraints request = new ClientRequest("http://localhost:8080/Validation-test/rest/return/nativeAndImposed"); request.body("application/foo", new Foo("abcdef")); response = request.post(Foo.class); Assert.assertEquals(500, response.getStatus()); String header = response.getResponseHeaders().getFirst(Validation.VALIDATION_HEADER); Assert.assertNotNull(header); Assert.assertTrue(Boolean.valueOf(header)); String entity = response.getEntity(String.class); System.out.println("entity: " + entity); ResteasyViolationException e = new ResteasyViolationException(entity); countViolations(e, 2, 0, 0, 0, 0, 2); Iterator it = e.getReturnValueViolations().iterator(); ResteasyConstraintViolation cv1 = it.next(); ResteasyConstraintViolation cv2 = it.next(); if (cv1.getMessage().indexOf('1') < 0) { ResteasyConstraintViolation temp = cv1; cv1 = cv2; cv2 = temp; } Assert.assertTrue(cv1.getMessage().equals("s must have length: 1 <= length <= 3")); Assert.assertEquals("Foo[abcdef]", cv1.getValue()); Assert.assertTrue(cv2.getMessage().equals("s must have length: 3 <= length <= 5")); Assert.assertEquals("Foo[abcdef]", cv2.getValue()); } } @Test public void testViolationsBeforeReturnValue() throws Exception { // Valid ClientRequest request = new ClientRequest("http://localhost:8080/Validation-test/rest/all/abc/wxyz"); Foo foo = new Foo("pqrs"); request.body("application/foo", foo); ClientResponse response = request.post(Foo.class); Assert.assertEquals(200, response.getStatus()); Assert.assertEquals(foo, response.getEntity()); // Invalid: Should have 1 each of field, property, class, and parameter violations, // and no return value violations. request = new ClientRequest("http://localhost:8080/Validation-test/rest/all/a/z"); foo = new Foo("p"); request.body("application/foo", foo); response = request.post(Foo.class); Assert.assertEquals(400, response.getStatus()); String header = response.getResponseHeaders().getFirst(Validation.VALIDATION_HEADER); Assert.assertNotNull(header); Assert.assertTrue(Boolean.valueOf(header)); String entity = response.getEntity(String.class); System.out.println("entity: " + entity); ResteasyViolationException e = new ResteasyViolationException(entity); countViolations(e, 4, 1, 1, 1, 1, 0); ResteasyConstraintViolation violation = e.getFieldViolations().iterator().next(); System.out.println("violation: " + violation); Assert.assertEquals("size must be between 2 and 4", violation.getMessage()); Assert.assertEquals("a", violation.getValue()); violation = e.getPropertyViolations().iterator().next(); System.out.println("violation: " + violation); Assert.assertEquals("size must be between 3 and 5", violation.getMessage()); Assert.assertEquals("z", violation.getValue()); violation = e.getClassViolations().iterator().next(); System.out.println("violation: " + violation); Assert.assertEquals("Concatenation of s and t must have length > 5", violation.getMessage()); System.out.println("violation value: " + violation.getValue()); Assert.assertTrue(violation.getValue().startsWith("org.jboss.resteasy.validation.TestResourceWithAllViolationTypes@")); violation = e.getParameterViolations().iterator().next(); System.out.println("violation: " + violation); Assert.assertEquals("s must have length: 3 <= length <= 5", violation.getMessage()); Assert.assertEquals("Foo[p]", violation.getValue()); } private void countViolations(ResteasyViolationException e, int totalCount, int fieldCount, int propertyCount, int classCount, int parameterCount, int returnValueCount) { Assert.assertEquals(totalCount, e.getViolations().size()); Assert.assertEquals(fieldCount, e.getFieldViolations().size()); Assert.assertEquals(propertyCount, e.getPropertyViolations().size()); Assert.assertEquals(classCount, e.getClassViolations().size()); Assert.assertEquals(parameterCount, e.getParameterViolations().size()); Assert.assertEquals(returnValueCount, e.getReturnValueViolations().size()); } } Resteasy-3.0.6.Final/jaxrs/arquillian/ValidationTest-AS7/src/test/resources/000077500000000000000000000000001225215345600267465ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/ValidationTest-AS7/src/test/resources/arquillian.xml000066400000000000000000000020511225215345600316270ustar00rootroot00000000000000 target/deployments target/jboss-as-7.1.1.Final standalone-full.xml Resteasy-3.0.6.Final/jaxrs/arquillian/ValidationTest-WF8/000077500000000000000000000000001225215345600232005ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/ValidationTest-WF8/pom.xml000077500000000000000000000130761225215345600245270ustar00rootroot00000000000000 4.0.0 org.jboss.resteasy resteasy-jaxrs-all 3.0.6.Final ../../pom.xml Validation-test-WF8 jar Validation test WF8 http://maven.apache.org UTF-8 8.0.0.Alpha2-SNAPSHOT org.apache.maven.plugins maven-compiler-plugin 2.3.2 1.6 1.6 maven-surefire-plugin 2.12 maven-dependency-plugin unpack process-test-classes unpack org.wildfly wildfly-dist ${as-version} zip false target org.apache.maven.plugins maven-antrun-plugin 1.6 unpack resteasy process-test-classes run org.jboss.arquillian arquillian-bom 1.0.3.Final import pom org.jboss.spec jboss-javaee-6.0 1.0.0.Final pom provided junit junit 4.8.1 test org.jboss.arquillian.junit arquillian-junit-container test org.wildfly wildfly-arquillian-container-managed 8.0.0.Alpha1 test org.jboss.arquillian.protocol arquillian-protocol-servlet test org.jboss.resteasy jaxrs-api ${project.version} org.jboss.resteasy resteasy-jaxrs ${project.version} org.jboss.resteasy resteasy-validator-provider-11 ${project.version} javax.validation validation-api 1.1.0.Final org.hibernate hibernate-validator 5.0.1.Final javax.el javax.el-api 2.2.4 org.glassfish.web javax.el 2.2.4 Resteasy-3.0.6.Final/jaxrs/arquillian/ValidationTest-WF8/src/000077500000000000000000000000001225215345600237675ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/ValidationTest-WF8/src/main/000077500000000000000000000000001225215345600247135ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/ValidationTest-WF8/src/main/java/000077500000000000000000000000001225215345600256345ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/ValidationTest-WF8/src/main/java/org/000077500000000000000000000000001225215345600264235ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/ValidationTest-WF8/src/main/java/org/jboss/000077500000000000000000000000001225215345600275435ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/ValidationTest-WF8/src/main/java/org/jboss/resteasy/000077500000000000000000000000001225215345600314025ustar00rootroot00000000000000000077500000000000000000000000001225215345600334555ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/ValidationTest-WF8/src/main/java/org/jboss/resteasy/validationFoo.java000066400000000000000000000010351225215345600350420ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/ValidationTest-WF8/src/main/java/org/jboss/resteasy/validationpackage org.jboss.resteasy.validation; import java.io.Serializable; @FooConstraint(min = 1, max = 3) public class Foo implements Serializable { private static final long serialVersionUID = -1068336400309384949L; public String s; public Foo(String s) { this.s = s; } public String toString() { return "Foo[" + s + "]"; } public boolean equals(Object o) { if (o == null || !(o instanceof Foo)) { return false; } return this.s.equals(Foo.class.cast(o).s); } } FooConstraint.java000066400000000000000000000016341225215345600371140ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/ValidationTest-WF8/src/main/java/org/jboss/resteasy/validationpackage org.jboss.resteasy.validation; import static java.lang.annotation.ElementType.METHOD; import static java.lang.annotation.ElementType.PARAMETER; import static java.lang.annotation.ElementType.TYPE; import static java.lang.annotation.RetentionPolicy.RUNTIME; import java.lang.annotation.Documented; import java.lang.annotation.Retention; import java.lang.annotation.Target; import javax.validation.Constraint; import javax.validation.Payload; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright May 18, 2013 */ @Documented @Constraint(validatedBy = FooValidator.class) @Target({ TYPE, PARAMETER, METHOD }) @Retention(RUNTIME) public @interface FooConstraint { String message() default "s must have length: {min} <= length <= {max}"; Class[] groups() default {}; Class[] payload() default {}; int min(); int max(); } FooReaderWriter.java000066400000000000000000000040331225215345600373630ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/ValidationTest-WF8/src/main/java/org/jboss/resteasy/validationpackage org.jboss.resteasy.validation; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.lang.annotation.Annotation; import java.lang.reflect.Type; import javax.ws.rs.Consumes; import javax.ws.rs.Produces; import javax.ws.rs.WebApplicationException; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.MultivaluedMap; import javax.ws.rs.ext.MessageBodyReader; import javax.ws.rs.ext.MessageBodyWriter; import javax.ws.rs.ext.Provider; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright May 18, 2013 */ @Provider @Produces("application/foo") @Consumes("application/foo") public class FooReaderWriter implements MessageBodyReader, MessageBodyWriter { public boolean isWriteable(Class type, Type genericType, Annotation[] annotations, MediaType mediaType) { return Foo.class.equals(type); } public long getSize(Foo t, Class type, Type genericType, Annotation[] annotations, MediaType mediaType) { return -1; } public void writeTo(Foo t, Class type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap httpHeaders, OutputStream entityStream) throws IOException, WebApplicationException { byte[] b = t.s.getBytes(); entityStream.write(b.length); entityStream.write(t.s.getBytes()); entityStream.flush(); } public boolean isReadable(Class type, Type genericType, Annotation[] annotations, MediaType mediaType) { return Foo.class.equals(type); } public Foo readFrom(Class type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap httpHeaders, InputStream entityStream) throws IOException, WebApplicationException { int length = entityStream.read(); byte[] b = new byte[length]; entityStream.read(b); String s = new String(b); return new Foo(s); } } FooValidator.java000066400000000000000000000012351225215345600367120ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/ValidationTest-WF8/src/main/java/org/jboss/resteasy/validationpackage org.jboss.resteasy.validation; import javax.validation.ConstraintValidator; import javax.validation.ConstraintValidatorContext; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright May 18, 2013 */ public class FooValidator implements ConstraintValidator { int min; int max; public void initialize(FooConstraint constraintAnnotation) { min = constraintAnnotation.min(); max = constraintAnnotation.max(); } public boolean isValid(Foo value, ConstraintValidatorContext context) { return min <= value.s.length() && value.s.length() <= max; } }JaxRsActivator.java000066400000000000000000000007751225215345600372350ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/ValidationTest-WF8/src/main/java/org/jboss/resteasy/validationpackage org.jboss.resteasy.validation; import javax.ws.rs.ApplicationPath; import javax.ws.rs.core.Application; /** * A class extending {@link Application} and annotated with @ApplicationPath is the Java EE 6 * "no XML" approach to activating JAX-RS. * *

* Resources are served relative to the servlet path specified in the {@link ApplicationPath} * annotation. *

*/ @ApplicationPath("/rest") public class JaxRsActivator extends Application { /* class body intentionally left blank */ }TestClassConstraint.java000066400000000000000000000014311225215345600402710ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/ValidationTest-WF8/src/main/java/org/jboss/resteasy/validationpackage org.jboss.resteasy.validation; import static java.lang.annotation.ElementType.TYPE; import static java.lang.annotation.RetentionPolicy.RUNTIME; import java.lang.annotation.Documented; import java.lang.annotation.Retention; import java.lang.annotation.Target; import javax.validation.Constraint; import javax.validation.Payload; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright May 18, 2013 */ @Documented @Constraint(validatedBy = TestClassValidator.class) @Target({TYPE}) @Retention(RUNTIME) public @interface TestClassConstraint { String message() default "Concatenation of s and t must have length > {value}"; Class[] groups() default {}; Class[] payload() default {}; int value(); } TestClassValidator.java000066400000000000000000000021101225215345600400650ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/ValidationTest-WF8/src/main/java/org/jboss/resteasy/validationpackage org.jboss.resteasy.validation; import javax.validation.ConstraintValidator; import javax.validation.ConstraintValidatorContext; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright May 18, 2013 */ public class TestClassValidator implements ConstraintValidator { int length; public void initialize(TestClassConstraint constraintAnnotation) { length = constraintAnnotation.value(); System.out.println(this + " length: " + length); } public boolean isValid(TestResourceWithAllViolationTypes value, ConstraintValidatorContext context) { System.out.println(this + " value: " + value); System.out.println(this + " value.s: " + value.s); System.out.println(this + " value.retrieveS(): " + value.retrieveS()); System.out.println(this + " value.getT(): " + value.getT()); boolean b = value.retrieveS().length() + value.getT().length() >= length; System.out.println("b: " + b); return b; // return true; } } TestResourceLazyValidator.java000066400000000000000000000033351225215345600414610ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/ValidationTest-WF8/src/main/java/org/jboss/resteasy/validationpackage org.jboss.resteasy.validation; import java.lang.ref.WeakReference; import java.lang.reflect.Field; import javax.validation.ValidatorFactory; import javax.validation.constraints.AssertTrue; import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.Produces; import javax.ws.rs.core.Context; import javax.ws.rs.core.MediaType; import javax.ws.rs.ext.ContextResolver; import javax.ws.rs.ext.Providers; import org.jboss.resteasy.plugins.validation.ValidatorContextResolver; import org.jboss.resteasy.spi.validation.GeneralValidator; //import org.jboss.resteasy.spi.validation.GeneralValidator; //import org.jboss.as.ee.beanvalidation.LazyValidatorFactory; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright June 12, 2013 */ @Path("/") public class TestResourceLazyValidator { @GET @Path("lazy") @Produces("text/plain") @AssertTrue public boolean testLazyValidator(@Context Providers providers) { ContextResolver resolver = providers.getContextResolver(GeneralValidator.class, MediaType.WILDCARD_TYPE); if (resolver == null) { return false; } Field field = null; try { field = ValidatorContextResolver.class.getDeclaredField("validatorFactory"); field.setAccessible(true); Object factory = field.get(resolver); System.out.println("ValidatorFactory: " + factory); if (factory == null) { return false; } return factory.getClass().getName().equals("org.jboss.as.ee.beanvalidation.LazyValidatorFactory"); } catch (Exception e) { e.printStackTrace(); return false; } } } TestResourceWithAllViolationTypes.java000066400000000000000000000017271225215345600431550ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/ValidationTest-WF8/src/main/java/org/jboss/resteasy/validationpackage org.jboss.resteasy.validation; import javax.validation.constraints.Size; import javax.ws.rs.POST; import javax.ws.rs.Path; import javax.ws.rs.PathParam; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright May 18, 2013 */ @Path("all") @TestClassConstraint(5) public class TestResourceWithAllViolationTypes { @Size(min=2, max=4) @PathParam("s") String s; private String t; @Size(min=3, max=5) public String getT() { return t; } public String retrieveS() { return s; } @PathParam("t") public void setT(String t) { System.out.println(this + " t: " + t); this.t = t; } @POST @Path("{s}/{t}") @FooConstraint(min=4,max=5) public Foo post(@FooConstraint(min=3,max=5) Foo foo, @PathParam("s") String s) { System.out.println(this + " s: " + s); System.out.println(this + " this.s: " + this.s); return foo; } } TestResourceWithGetterViolation.java000066400000000000000000000012671225215345600426510ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/ValidationTest-WF8/src/main/java/org/jboss/resteasy/validationpackage org.jboss.resteasy.validation; import javax.validation.constraints.Size; import javax.ws.rs.GET; import javax.ws.rs.Path; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright May 18, 2013 */ @Path("") public class TestResourceWithGetterViolation { private static int count = 0; @GET @Path("get") @Size(min=2, max=4) public String getS() { /* * Called twice by Hibernate Validator 5 during field, property, class * constraint validation. */ System.out.println("getS(): count: " + count); String s = count++ <= 1 ? "abc" : "a"; System.out.println("s: " + s); return s; } } TestResourceWithReturnValues.java000066400000000000000000000012601225215345600421620ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/ValidationTest-WF8/src/main/java/org/jboss/resteasy/validationpackage org.jboss.resteasy.validation; import javax.validation.Valid; import javax.ws.rs.POST; import javax.ws.rs.Path; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright May 18, 2013 */ @Path("/return") public class TestResourceWithReturnValues { @POST @Path("/native") @Valid public Foo postNative(Foo foo) { return foo; } @POST @Path("/imposed") @FooConstraint(min=3,max=5) public Foo postImposed(Foo foo) { return foo; } @POST @Path("nativeAndImposed") @Valid @FooConstraint(min=3,max=5) public Foo postNativeAndImposed(Foo foo) { return foo; } } Resteasy-3.0.6.Final/jaxrs/arquillian/ValidationTest-WF8/src/main/resources/000077500000000000000000000000001225215345600267255ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/ValidationTest-WF8/src/main/resources/META-INF/000077500000000000000000000000001225215345600300655ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/ValidationTest-WF8/src/main/resources/META-INF/services/000077500000000000000000000000001225215345600317105ustar00rootroot00000000000000javax.ws.rs.ext.Providers000066400000000000000000000000611225215345600365100ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/ValidationTest-WF8/src/main/resources/META-INF/servicesorg.jboss.resteasy.validation.FooReaderWriter Resteasy-3.0.6.Final/jaxrs/arquillian/ValidationTest-WF8/src/test/000077500000000000000000000000001225215345600247465ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/ValidationTest-WF8/src/test/java/000077500000000000000000000000001225215345600256675ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/ValidationTest-WF8/src/test/java/org/000077500000000000000000000000001225215345600264565ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/ValidationTest-WF8/src/test/java/org/jboss/000077500000000000000000000000001225215345600275765ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/ValidationTest-WF8/src/test/java/org/jboss/resteasy/000077500000000000000000000000001225215345600314355ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/ValidationTest-WF8/src/test/java/org/jboss/resteasy/test/000077500000000000000000000000001225215345600324145ustar00rootroot00000000000000000077500000000000000000000000001225215345600344675ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/ValidationTest-WF8/src/test/java/org/jboss/resteasy/test/validationTestExecutableValidationDisabled.java000066400000000000000000000171141225215345600437220ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/ValidationTest-WF8/src/test/java/org/jboss/resteasy/test/validationpackage org.jboss.resteasy.test.validation; import junit.framework.Assert; import org.jboss.arquillian.container.test.api.Deployment; import org.jboss.arquillian.junit.Arquillian; import org.jboss.resteasy.api.validation.ResteasyConstraintViolation; import org.jboss.resteasy.api.validation.ResteasyViolationException; import org.jboss.resteasy.api.validation.Validation; import org.jboss.resteasy.client.ClientRequest; import org.jboss.resteasy.client.ClientResponse; import org.jboss.resteasy.validation.Foo; import org.jboss.resteasy.validation.FooConstraint; import org.jboss.resteasy.validation.FooReaderWriter; import org.jboss.resteasy.validation.FooValidator; import org.jboss.resteasy.validation.JaxRsActivator; import org.jboss.resteasy.validation.TestClassConstraint; import org.jboss.resteasy.validation.TestClassValidator; import org.jboss.resteasy.validation.TestResourceWithAllViolationTypes; import org.jboss.resteasy.validation.TestResourceWithReturnValues; import org.jboss.shrinkwrap.api.Archive; import org.jboss.shrinkwrap.api.ShrinkWrap; import org.jboss.shrinkwrap.api.spec.WebArchive; import org.junit.Test; import org.junit.runner.RunWith; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Created Junk 8, 2013 */ @RunWith(Arquillian.class) public class TestExecutableValidationDisabled { @Deployment public static Archive createTestArchive() { WebArchive war = ShrinkWrap.create(WebArchive.class, "Validation-test.war") .addClasses(JaxRsActivator.class) .addClasses(Foo.class, FooConstraint.class, FooReaderWriter.class, FooValidator.class) .addClasses(TestClassConstraint.class, TestClassValidator.class) .addClasses(TestResourceWithAllViolationTypes.class, TestResourceWithReturnValues.class) .addAsResource("META-INF/services/javax.ws.rs.ext.Providers") .addAsResource("validation-disabled.xml", "META-INF/validation.xml") ; System.out.println(war.toString(true)); return war; } @Test public void testReturnValues() throws Exception { // Valid native constraint ClientRequest request = new ClientRequest("http://localhost:8080/Validation-test/rest/return/native"); Foo foo = new Foo("a"); request.body("application/foo", foo); ClientResponse response = request.post(Foo.class); Assert.assertEquals(200, response.getStatus()); Assert.assertEquals(foo, response.getEntity()); // Valid imposed constraint request = new ClientRequest("http://localhost:8080/Validation-test/rest/return/imposed"); foo = new Foo("abcde"); request.body("application/foo", foo); response = request.post(Foo.class); Assert.assertEquals(200, response.getStatus()); Assert.assertEquals(foo, response.getEntity()); // Valid native and imposed constraints. request = new ClientRequest("http://localhost:8080/Validation-test/rest/return/nativeAndImposed"); foo = new Foo("abc"); request.body("application/foo", foo); response = request.post(Foo.class); Assert.assertEquals(200, response.getStatus()); Assert.assertEquals(foo, response.getEntity()); { // Invalid native constraint // BUT EXECUTABLE VALIDATION IS DISABLE. request = new ClientRequest("http://localhost:8080/Validation-test/rest/return/native"); foo = new Foo("abcdef"); request.body("application/foo", foo); response = request.post(Foo.class); Assert.assertEquals(200, response.getStatus()); Assert.assertEquals(foo, response.getEntity()); } { // Invalid imposed constraint // BUT EXECUTABLE VALIDATION IS DISABLE. request = new ClientRequest("http://localhost:8080/Validation-test/rest/return/imposed"); foo = new Foo("abcdef"); request.body("application/foo", foo); response = request.post(Foo.class); Assert.assertEquals(200, response.getStatus()); Assert.assertEquals(foo, response.getEntity()); } { // Invalid native and imposed constraints // BUT EXECUTABLE VALIDATION IS DISABLE. request = new ClientRequest("http://localhost:8080/Validation-test/rest/return/nativeAndImposed"); foo = new Foo("abcdef"); request.body("application/foo", foo); response = request.post(Foo.class); Assert.assertEquals(200, response.getStatus()); Assert.assertEquals(foo, response.getEntity()); } } @Test public void testViolationsBeforeReturnValue() throws Exception { // Valid ClientRequest request = new ClientRequest("http://localhost:8080/Validation-test/rest/all/abc/wxyz"); Foo foo = new Foo("pqrs"); request.body("application/foo", foo); ClientResponse response = request.post(Foo.class); Assert.assertEquals(200, response.getStatus()); Assert.assertEquals(foo, response.getEntity()); // Invalid: Should have 1 each of field, property, class, and parameter violations, // and no return value violations. // BUT EXECUTABLE VALIDATION IS DISABLE. There will be no parameter violation. request = new ClientRequest("http://localhost:8080/Validation-test/rest/all/a/z"); foo = new Foo("p"); request.body("application/foo", foo); response = request.post(Foo.class); Assert.assertEquals(400, response.getStatus()); String header = response.getResponseHeaders().getFirst(Validation.VALIDATION_HEADER); Assert.assertNotNull(header); Assert.assertTrue(Boolean.valueOf(header)); String entity = response.getEntity(String.class); System.out.println("entity: " + entity); ResteasyViolationException e = new ResteasyViolationException(entity); countViolations(e, 3, 1, 1, 1, 0, 0); ResteasyConstraintViolation violation = e.getFieldViolations().iterator().next(); System.out.println("violation: " + violation); Assert.assertEquals("size must be between 2 and 4", violation.getMessage()); Assert.assertEquals("a", violation.getValue()); violation = e.getPropertyViolations().iterator().next(); System.out.println("violation: " + violation); Assert.assertEquals("size must be between 3 and 5", violation.getMessage()); Assert.assertEquals("z", violation.getValue()); violation = e.getClassViolations().iterator().next(); System.out.println("violation: " + violation); Assert.assertEquals("Concatenation of s and t must have length > 5", violation.getMessage()); System.out.println("violation value: " + violation.getValue()); Assert.assertTrue(violation.getValue().startsWith("org.jboss.resteasy.validation.TestResourceWithAllViolationTypes@")); } private void countViolations(ResteasyViolationException e, int totalCount, int fieldCount, int propertyCount, int classCount, int parameterCount, int returnValueCount) { Assert.assertEquals(totalCount, e.getViolations().size()); Assert.assertEquals(fieldCount, e.getFieldViolations().size()); Assert.assertEquals(propertyCount, e.getPropertyViolations().size()); Assert.assertEquals(classCount, e.getClassViolations().size()); Assert.assertEquals(parameterCount, e.getParameterViolations().size()); Assert.assertEquals(returnValueCount, e.getReturnValueViolations().size()); } } TestGetterReturnValueNotValidated.java000066400000000000000000000036441225215345600441270ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/ValidationTest-WF8/src/test/java/org/jboss/resteasy/test/validationpackage org.jboss.resteasy.test.validation; import junit.framework.Assert; import org.jboss.arquillian.container.test.api.Deployment; import org.jboss.arquillian.junit.Arquillian; import org.jboss.resteasy.api.validation.Validation; import org.jboss.resteasy.client.ClientRequest; import org.jboss.resteasy.client.ClientResponse; import org.jboss.resteasy.validation.JaxRsActivator; import org.jboss.resteasy.validation.TestResourceWithGetterViolation; import org.jboss.shrinkwrap.api.Archive; import org.jboss.shrinkwrap.api.ShrinkWrap; import org.jboss.shrinkwrap.api.spec.WebArchive; import org.junit.Test; import org.junit.runner.RunWith; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Created June 8, 2013 */ @RunWith(Arquillian.class) public class TestGetterReturnValueNotValidated { @Deployment public static Archive createTestArchive() { WebArchive war = ShrinkWrap.create(WebArchive.class, "Validation-test.war") .addClasses(JaxRsActivator.class) .addClasses(TestResourceWithGetterViolation.class) .addAsResource("META-INF/services/javax.ws.rs.ext.Providers") ; System.out.println(war.toString(true)); return war; } @Test public void testReturnValues() throws Exception { // Valid native constraint ClientRequest request = new ClientRequest("http://localhost:8080/Validation-test/rest/get"); ClientResponse response = request.get(String.class); System.out.println("status: " + response.getStatus()); Assert.assertEquals(200, response.getStatus()); String header = response.getResponseHeaders().getFirst(Validation.VALIDATION_HEADER); Assert.assertNull(header); Object entity = response.getEntity(); System.out.println("entity: " + entity); Assert.assertEquals("a", entity); } } TestGetterReturnValueValidated.java000066400000000000000000000056071225215345600434470ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/ValidationTest-WF8/src/test/java/org/jboss/resteasy/test/validationpackage org.jboss.resteasy.test.validation; import junit.framework.Assert; import org.jboss.arquillian.container.test.api.Deployment; import org.jboss.arquillian.junit.Arquillian; import org.jboss.resteasy.api.validation.ResteasyViolationException; import org.jboss.resteasy.api.validation.Validation; import org.jboss.resteasy.client.ClientRequest; import org.jboss.resteasy.client.ClientResponse; import org.jboss.resteasy.validation.JaxRsActivator; import org.jboss.resteasy.validation.TestResourceWithGetterViolation; import org.jboss.shrinkwrap.api.Archive; import org.jboss.shrinkwrap.api.ShrinkWrap; import org.jboss.shrinkwrap.api.spec.WebArchive; import org.junit.Test; import org.junit.runner.RunWith; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Created June 8, 2013 */ @RunWith(Arquillian.class) public class TestGetterReturnValueValidated { @Deployment public static Archive createTestArchive() { WebArchive war = ShrinkWrap.create(WebArchive.class, "Validation-test.war") .addClasses(JaxRsActivator.class) .addClasses(TestResourceWithGetterViolation.class) .addAsResource("META-INF/services/javax.ws.rs.ext.Providers") .addAsResource("validation-getter.xml", "META-INF/validation.xml") ; System.out.println(war.toString(true)); return war; } @Test public void testReturnValues() throws Exception { // Valid native constraint ClientRequest request = new ClientRequest("http://localhost:8080/Validation-test/rest/get"); ClientResponse response = request.get(String.class); System.out.println("status: " + response.getStatus()); Assert.assertEquals(500, response.getStatus()); String header = response.getResponseHeaders().getFirst(Validation.VALIDATION_HEADER); Assert.assertNotNull(header); Assert.assertTrue(Boolean.valueOf(header)); String entity = response.getEntity(String.class); System.out.println("entity: " + entity); ResteasyViolationException e = new ResteasyViolationException(entity); System.out.println(e.toString()); countViolations(e, 1, 0, 0, 0, 0, 1); } private void countViolations(ResteasyViolationException e, int totalCount, int fieldCount, int propertyCount, int classCount, int parameterCount, int returnValueCount) { Assert.assertEquals(totalCount, e.getViolations().size()); Assert.assertEquals(fieldCount, e.getFieldViolations().size()); Assert.assertEquals(propertyCount, e.getPropertyViolations().size()); Assert.assertEquals(classCount, e.getClassViolations().size()); Assert.assertEquals(parameterCount, e.getParameterViolations().size()); Assert.assertEquals(returnValueCount, e.getReturnValueViolations().size()); } } TestLazyValidator.java000066400000000000000000000027741225215345600407710ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/ValidationTest-WF8/src/test/java/org/jboss/resteasy/test/validationpackage org.jboss.resteasy.test.validation; import junit.framework.Assert; import org.jboss.arquillian.container.test.api.Deployment; import org.jboss.arquillian.junit.Arquillian; import org.jboss.resteasy.client.ClientRequest; import org.jboss.resteasy.client.ClientResponse; import org.jboss.resteasy.validation.JaxRsActivator; import org.jboss.resteasy.validation.TestResourceLazyValidator; import org.jboss.shrinkwrap.api.Archive; import org.jboss.shrinkwrap.api.ShrinkWrap; import org.jboss.shrinkwrap.api.spec.WebArchive; import org.junit.Test; import org.junit.runner.RunWith; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Created Junk 8, 2013 */ @RunWith(Arquillian.class) public class TestLazyValidator { @Deployment public static Archive createTestArchive() { WebArchive war = ShrinkWrap.create(WebArchive.class, "Validation-test.war") .addClasses(JaxRsActivator.class) .addClasses(TestResourceLazyValidator.class) ; System.out.println(war.toString(true)); return war; } @Test public void testLazyValidator() throws Exception { // Valid native constraint ClientRequest request = new ClientRequest("http://localhost:8080/Validation-test/rest/lazy"); ClientResponse response = request.get(); Assert.assertEquals(200, response.getStatus()); Assert.assertTrue(response.getEntity(boolean.class)); } } TestValidation.java000066400000000000000000000236601225215345600402730ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/ValidationTest-WF8/src/test/java/org/jboss/resteasy/test/validationpackage org.jboss.resteasy.test.validation; import java.util.Iterator; import junit.framework.Assert; import org.jboss.arquillian.container.test.api.Deployment; import org.jboss.arquillian.junit.Arquillian; import org.jboss.resteasy.api.validation.ResteasyConstraintViolation; import org.jboss.resteasy.api.validation.ResteasyViolationException; import org.jboss.resteasy.api.validation.Validation; import org.jboss.resteasy.client.ClientRequest; import org.jboss.resteasy.client.ClientResponse; import org.jboss.resteasy.validation.Foo; import org.jboss.resteasy.validation.FooConstraint; import org.jboss.resteasy.validation.FooReaderWriter; import org.jboss.resteasy.validation.FooValidator; import org.jboss.resteasy.validation.JaxRsActivator; import org.jboss.resteasy.validation.TestClassConstraint; import org.jboss.resteasy.validation.TestClassValidator; import org.jboss.resteasy.validation.TestResourceWithAllViolationTypes; import org.jboss.resteasy.validation.TestResourceWithReturnValues; import org.jboss.shrinkwrap.api.Archive; import org.jboss.shrinkwrap.api.ShrinkWrap; import org.jboss.shrinkwrap.api.spec.WebArchive; import org.junit.Test; import org.junit.runner.RunWith; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Created Mar 16, 2012 */ @RunWith(Arquillian.class) public class TestValidation { @Deployment public static Archive createTestArchive() { WebArchive war = ShrinkWrap.create(WebArchive.class, "Validation-test.war") .addClasses(JaxRsActivator.class) .addClasses(Foo.class, FooConstraint.class, FooReaderWriter.class, FooValidator.class) .addClasses(TestClassConstraint.class, TestClassValidator.class) .addClasses(TestResourceWithAllViolationTypes.class, TestResourceWithReturnValues.class) .addAsResource("META-INF/services/javax.ws.rs.ext.Providers") ; System.out.println(war.toString(true)); return war; } @Test public void testReturnValues() throws Exception { // Valid native constraint ClientRequest request = new ClientRequest("http://localhost:8080/Validation-test/rest/return/native"); Foo foo = new Foo("a"); request.body("application/foo", foo); ClientResponse response = request.post(Foo.class); Assert.assertEquals(200, response.getStatus()); Assert.assertEquals(foo, response.getEntity()); // Valid imposed constraint request = new ClientRequest("http://localhost:8080/Validation-test/rest/return/imposed"); foo = new Foo("abcde"); request.body("application/foo", foo); response = request.post(Foo.class); Assert.assertEquals(200, response.getStatus()); Assert.assertEquals(foo, response.getEntity()); // Valid native and imposed constraints. request = new ClientRequest("http://localhost:8080/Validation-test/rest/return/nativeAndImposed"); foo = new Foo("abc"); request.body("application/foo", foo); response = request.post(Foo.class); Assert.assertEquals(200, response.getStatus()); Assert.assertEquals(foo, response.getEntity()); { // Invalid native constraint request = new ClientRequest("http://localhost:8080/Validation-test/rest/return/native"); request.body("application/foo", new Foo("abcdef")); response = request.post(); String entity = response.getEntity(String.class); System.out.println("entity: " + entity); Assert.assertEquals(500, response.getStatus()); String header = response.getResponseHeaders().getFirst(Validation.VALIDATION_HEADER); Assert.assertNotNull(header); Assert.assertTrue(Boolean.valueOf(header)); ResteasyViolationException e = new ResteasyViolationException(entity); ResteasyConstraintViolation violation = e.getReturnValueViolations().iterator().next(); System.out.println("violation: " + violation); Assert.assertTrue(violation.getMessage().equals("s must have length: 1 <= length <= 3")); Assert.assertEquals("Foo[abcdef]", violation.getValue()); } { // Invalid imposed constraint request = new ClientRequest("http://localhost:8080/Validation-test/rest/return/imposed"); request.body("application/foo", new Foo("abcdef")); response = request.post(Foo.class); Assert.assertEquals(500, response.getStatus()); String header = response.getResponseHeaders().getFirst(Validation.VALIDATION_HEADER); Assert.assertNotNull(header); Assert.assertTrue(Boolean.valueOf(header)); String entity = response.getEntity(String.class); System.out.println("entity: " + entity); ResteasyViolationException e = new ResteasyViolationException(entity); countViolations(e, 1, 0, 0, 0, 0, 1); ResteasyConstraintViolation violation = e.getReturnValueViolations().iterator().next(); System.out.println("violation: " + violation); Assert.assertTrue(violation.getMessage().equals("s must have length: 3 <= length <= 5")); Assert.assertEquals("Foo[abcdef]", violation.getValue()); } { // Invalid native and imposed constraints request = new ClientRequest("http://localhost:8080/Validation-test/rest/return/nativeAndImposed"); request.body("application/foo", new Foo("abcdef")); response = request.post(Foo.class); Assert.assertEquals(500, response.getStatus()); String header = response.getResponseHeaders().getFirst(Validation.VALIDATION_HEADER); Assert.assertNotNull(header); Assert.assertTrue(Boolean.valueOf(header)); String entity = response.getEntity(String.class); System.out.println("entity: " + entity); ResteasyViolationException e = new ResteasyViolationException(entity); countViolations(e, 2, 0, 0, 0, 0, 2); Iterator it = e.getReturnValueViolations().iterator(); ResteasyConstraintViolation cv1 = it.next(); ResteasyConstraintViolation cv2 = it.next(); if (cv1.getMessage().indexOf('1') < 0) { ResteasyConstraintViolation temp = cv1; cv1 = cv2; cv2 = temp; } Assert.assertTrue(cv1.getMessage().equals("s must have length: 1 <= length <= 3")); Assert.assertEquals("Foo[abcdef]", cv1.getValue()); Assert.assertTrue(cv2.getMessage().equals("s must have length: 3 <= length <= 5")); Assert.assertEquals("Foo[abcdef]", cv2.getValue()); } } @Test public void testViolationsBeforeReturnValue() throws Exception { // Valid ClientRequest request = new ClientRequest("http://localhost:8080/Validation-test/rest/all/abc/wxyz"); Foo foo = new Foo("pqrs"); request.body("application/foo", foo); ClientResponse response = request.post(Foo.class); Assert.assertEquals(200, response.getStatus()); Assert.assertEquals(foo, response.getEntity()); // Invalid: Should have 1 each of field, property, class, and parameter violations, // and no return value violations. request = new ClientRequest("http://localhost:8080/Validation-test/rest/all/a/z"); foo = new Foo("p"); request.body("application/foo", foo); response = request.post(Foo.class); Assert.assertEquals(400, response.getStatus()); String header = response.getResponseHeaders().getFirst(Validation.VALIDATION_HEADER); Assert.assertNotNull(header); Assert.assertTrue(Boolean.valueOf(header)); String entity = response.getEntity(String.class); System.out.println("entity: " + entity); ResteasyViolationException e = new ResteasyViolationException(entity); System.out.println("testViolationsBeforeReturnValue(): exception:"); System.out.println(e.toString()); countViolations(e, 4, 1, 1, 1, 1, 0); ResteasyConstraintViolation violation = e.getFieldViolations().iterator().next(); System.out.println("violation: " + violation); Assert.assertEquals("size must be between 2 and 4", violation.getMessage()); Assert.assertEquals("a", violation.getValue()); violation = e.getPropertyViolations().iterator().next(); System.out.println("violation: " + violation); Assert.assertEquals("size must be between 3 and 5", violation.getMessage()); Assert.assertEquals("z", violation.getValue()); violation = e.getClassViolations().iterator().next(); System.out.println("violation: " + violation); Assert.assertEquals("Concatenation of s and t must have length > 5", violation.getMessage()); System.out.println("violation value: " + violation.getValue()); Assert.assertTrue(violation.getValue().startsWith("org.jboss.resteasy.validation.TestResourceWithAllViolationTypes@")); violation = e.getParameterViolations().iterator().next(); System.out.println("violation: " + violation); Assert.assertEquals("s must have length: 3 <= length <= 5", violation.getMessage()); Assert.assertEquals("Foo[p]", violation.getValue()); } private void countViolations(ResteasyViolationException e, int totalCount, int fieldCount, int propertyCount, int classCount, int parameterCount, int returnValueCount) { Assert.assertEquals(totalCount, e.getViolations().size()); Assert.assertEquals(fieldCount, e.getFieldViolations().size()); Assert.assertEquals(propertyCount, e.getPropertyViolations().size()); Assert.assertEquals(classCount, e.getClassViolations().size()); Assert.assertEquals(parameterCount, e.getParameterViolations().size()); Assert.assertEquals(returnValueCount, e.getReturnValueViolations().size()); } } Resteasy-3.0.6.Final/jaxrs/arquillian/ValidationTest-WF8/src/test/resources/000077500000000000000000000000001225215345600267605ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/ValidationTest-WF8/src/test/resources/arquillian.xml000066400000000000000000000020621225215345600316430ustar00rootroot00000000000000 target/deployments target/wildfly-8.0.0.Alpha2-SNAPSHOT standalone-full.xml Resteasy-3.0.6.Final/jaxrs/arquillian/ValidationTest-WF8/src/test/resources/validation-disabled.xml000066400000000000000000000006321225215345600334020ustar00rootroot00000000000000 Resteasy-3.0.6.Final/jaxrs/arquillian/ValidationTest-WF8/src/test/resources/validation-getter.xml000066400000000000000000000011001225215345600331140ustar00rootroot00000000000000 GETTER_METHODS Resteasy-3.0.6.Final/jaxrs/arquillian/ValidationTest/000077500000000000000000000000001225215345600225765ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/ValidationTest/.gitignore000066400000000000000000000000221225215345600245600ustar00rootroot00000000000000/target .DS_Store Resteasy-3.0.6.Final/jaxrs/arquillian/ValidationTest/pom.xml000077500000000000000000000152531225215345600241240ustar00rootroot00000000000000 4.0.0 org.jboss.resteasy resteasy-jaxrs-all 3.0.6.Final ../../pom.xml Validation-test-wf8 jar Validation test http://maven.apache.org UTF-8 8.0.0.Alpha2-SNAPSHOT org.apache.maven.plugins maven-compiler-plugin 2.3.2 1.6 1.6 maven-surefire-plugin 2.12 maven-dependency-plugin unpack process-test-classes unpack org.wildfly wildfly-dist ${as-version} zip false target org.apache.maven.plugins maven-antrun-plugin 1.6 unpack resteasy process-test-classes run org.jboss.arquillian arquillian-bom 1.0.3.Final import pom org.jboss.spec jboss-javaee-6.0 1.0.0.Final pom provided junit junit 4.8.1 test org.jboss.arquillian.junit arquillian-junit-container test org.wildfly wildfly-arquillian-container-managed 8.0.0.Alpha1 test org.jboss.arquillian.protocol arquillian-protocol-servlet test org.jboss.resteasy jaxrs-api ${project.version} org.jboss.resteasy resteasy-jaxrs ${project.version} javax.validation validation-api 1.1.0.Final org.hibernate hibernate-validator 5.0.1.Final javax.el javax.el-api 2.2.4 org.glassfish.web javax.el 2.2.4 Resteasy-3.0.6.Final/jaxrs/arquillian/ValidationTest/src/000077500000000000000000000000001225215345600233655ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/ValidationTest/src/main/000077500000000000000000000000001225215345600243115ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/ValidationTest/src/main/java/000077500000000000000000000000001225215345600252325ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/ValidationTest/src/main/java/org/000077500000000000000000000000001225215345600260215ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/ValidationTest/src/main/java/org/jboss/000077500000000000000000000000001225215345600271415ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/ValidationTest/src/main/java/org/jboss/resteasy/000077500000000000000000000000001225215345600310005ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/ValidationTest/src/main/java/org/jboss/resteasy/validation/000077500000000000000000000000001225215345600331325ustar00rootroot00000000000000Foo.java000066400000000000000000000010351225215345600344400ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/ValidationTest/src/main/java/org/jboss/resteasy/validationpackage org.jboss.resteasy.validation; import java.io.Serializable; @FooConstraint(min = 1, max = 3) public class Foo implements Serializable { private static final long serialVersionUID = -1068336400309384949L; public String s; public Foo(String s) { this.s = s; } public String toString() { return "Foo[" + s + "]"; } public boolean equals(Object o) { if (o == null || !(o instanceof Foo)) { return false; } return this.s.equals(Foo.class.cast(o).s); } } FooConstraint.java000066400000000000000000000016341225215345600365120ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/ValidationTest/src/main/java/org/jboss/resteasy/validationpackage org.jboss.resteasy.validation; import static java.lang.annotation.ElementType.METHOD; import static java.lang.annotation.ElementType.PARAMETER; import static java.lang.annotation.ElementType.TYPE; import static java.lang.annotation.RetentionPolicy.RUNTIME; import java.lang.annotation.Documented; import java.lang.annotation.Retention; import java.lang.annotation.Target; import javax.validation.Constraint; import javax.validation.Payload; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright May 18, 2013 */ @Documented @Constraint(validatedBy = FooValidator.class) @Target({ TYPE, PARAMETER, METHOD }) @Retention(RUNTIME) public @interface FooConstraint { String message() default "s must have length: {min} <= length <= {max}"; Class[] groups() default {}; Class[] payload() default {}; int min(); int max(); } FooReaderWriter.java000066400000000000000000000040331225215345600367610ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/ValidationTest/src/main/java/org/jboss/resteasy/validationpackage org.jboss.resteasy.validation; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.lang.annotation.Annotation; import java.lang.reflect.Type; import javax.ws.rs.Consumes; import javax.ws.rs.Produces; import javax.ws.rs.WebApplicationException; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.MultivaluedMap; import javax.ws.rs.ext.MessageBodyReader; import javax.ws.rs.ext.MessageBodyWriter; import javax.ws.rs.ext.Provider; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright May 18, 2013 */ @Provider @Produces("application/foo") @Consumes("application/foo") public class FooReaderWriter implements MessageBodyReader, MessageBodyWriter { public boolean isWriteable(Class type, Type genericType, Annotation[] annotations, MediaType mediaType) { return Foo.class.equals(type); } public long getSize(Foo t, Class type, Type genericType, Annotation[] annotations, MediaType mediaType) { return -1; } public void writeTo(Foo t, Class type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap httpHeaders, OutputStream entityStream) throws IOException, WebApplicationException { byte[] b = t.s.getBytes(); entityStream.write(b.length); entityStream.write(t.s.getBytes()); entityStream.flush(); } public boolean isReadable(Class type, Type genericType, Annotation[] annotations, MediaType mediaType) { return Foo.class.equals(type); } public Foo readFrom(Class type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap httpHeaders, InputStream entityStream) throws IOException, WebApplicationException { int length = entityStream.read(); byte[] b = new byte[length]; entityStream.read(b); String s = new String(b); return new Foo(s); } } FooValidator.java000066400000000000000000000012351225215345600363100ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/ValidationTest/src/main/java/org/jboss/resteasy/validationpackage org.jboss.resteasy.validation; import javax.validation.ConstraintValidator; import javax.validation.ConstraintValidatorContext; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright May 18, 2013 */ public class FooValidator implements ConstraintValidator { int min; int max; public void initialize(FooConstraint constraintAnnotation) { min = constraintAnnotation.min(); max = constraintAnnotation.max(); } public boolean isValid(Foo value, ConstraintValidatorContext context) { return min <= value.s.length() && value.s.length() <= max; } }JaxRsActivator.java000066400000000000000000000007751225215345600366330ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/ValidationTest/src/main/java/org/jboss/resteasy/validationpackage org.jboss.resteasy.validation; import javax.ws.rs.ApplicationPath; import javax.ws.rs.core.Application; /** * A class extending {@link Application} and annotated with @ApplicationPath is the Java EE 6 * "no XML" approach to activating JAX-RS. * *

* Resources are served relative to the servlet path specified in the {@link ApplicationPath} * annotation. *

*/ @ApplicationPath("/rest") public class JaxRsActivator extends Application { /* class body intentionally left blank */ }TestClassConstraint.java000066400000000000000000000014311225215345600376670ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/ValidationTest/src/main/java/org/jboss/resteasy/validationpackage org.jboss.resteasy.validation; import static java.lang.annotation.ElementType.TYPE; import static java.lang.annotation.RetentionPolicy.RUNTIME; import java.lang.annotation.Documented; import java.lang.annotation.Retention; import java.lang.annotation.Target; import javax.validation.Constraint; import javax.validation.Payload; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright May 18, 2013 */ @Documented @Constraint(validatedBy = TestClassValidator.class) @Target({TYPE}) @Retention(RUNTIME) public @interface TestClassConstraint { String message() default "Concatenation of s and t must have length > {value}"; Class[] groups() default {}; Class[] payload() default {}; int value(); } TestClassValidator.java000066400000000000000000000021101225215345600374630ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/ValidationTest/src/main/java/org/jboss/resteasy/validationpackage org.jboss.resteasy.validation; import javax.validation.ConstraintValidator; import javax.validation.ConstraintValidatorContext; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright May 18, 2013 */ public class TestClassValidator implements ConstraintValidator { int length; public void initialize(TestClassConstraint constraintAnnotation) { length = constraintAnnotation.value(); System.out.println(this + " length: " + length); } public boolean isValid(TestResourceWithAllViolationTypes value, ConstraintValidatorContext context) { System.out.println(this + " value: " + value); System.out.println(this + " value.s: " + value.s); System.out.println(this + " value.retrieveS(): " + value.retrieveS()); System.out.println(this + " value.getT(): " + value.getT()); boolean b = value.retrieveS().length() + value.getT().length() >= length; System.out.println("b: " + b); return b; // return true; } } TestResourceWithAllViolationTypes.java000066400000000000000000000017271225215345600425530ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/ValidationTest/src/main/java/org/jboss/resteasy/validationpackage org.jboss.resteasy.validation; import javax.validation.constraints.Size; import javax.ws.rs.POST; import javax.ws.rs.Path; import javax.ws.rs.PathParam; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright May 18, 2013 */ @Path("all") @TestClassConstraint(5) public class TestResourceWithAllViolationTypes { @Size(min=2, max=4) @PathParam("s") String s; private String t; @Size(min=3, max=5) public String getT() { return t; } public String retrieveS() { return s; } @PathParam("t") public void setT(String t) { System.out.println(this + " t: " + t); this.t = t; } @POST @Path("{s}/{t}") @FooConstraint(min=4,max=5) public Foo post(@FooConstraint(min=3,max=5) Foo foo, @PathParam("s") String s) { System.out.println(this + " s: " + s); System.out.println(this + " this.s: " + this.s); return foo; } } TestResourceWithReturnValues.java000066400000000000000000000012601225215345600415600ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/ValidationTest/src/main/java/org/jboss/resteasy/validationpackage org.jboss.resteasy.validation; import javax.validation.Valid; import javax.ws.rs.POST; import javax.ws.rs.Path; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright May 18, 2013 */ @Path("/return") public class TestResourceWithReturnValues { @POST @Path("/native") @Valid public Foo postNative(Foo foo) { return foo; } @POST @Path("/imposed") @FooConstraint(min=3,max=5) public Foo postImposed(Foo foo) { return foo; } @POST @Path("nativeAndImposed") @Valid @FooConstraint(min=3,max=5) public Foo postNativeAndImposed(Foo foo) { return foo; } } Resteasy-3.0.6.Final/jaxrs/arquillian/ValidationTest/src/main/resources/000077500000000000000000000000001225215345600263235ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/ValidationTest/src/main/resources/META-INF/000077500000000000000000000000001225215345600274635ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/ValidationTest/src/main/resources/META-INF/services/000077500000000000000000000000001225215345600313065ustar00rootroot00000000000000javax.ws.rs.ext.Providers000066400000000000000000000000611225215345600361060ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/ValidationTest/src/main/resources/META-INF/servicesorg.jboss.resteasy.validation.FooReaderWriter Resteasy-3.0.6.Final/jaxrs/arquillian/ValidationTest/src/test/000077500000000000000000000000001225215345600243445ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/ValidationTest/src/test/java/000077500000000000000000000000001225215345600252655ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/ValidationTest/src/test/java/org/000077500000000000000000000000001225215345600260545ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/ValidationTest/src/test/java/org/jboss/000077500000000000000000000000001225215345600271745ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/ValidationTest/src/test/java/org/jboss/resteasy/000077500000000000000000000000001225215345600310335ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/ValidationTest/src/test/java/org/jboss/resteasy/test/000077500000000000000000000000001225215345600320125ustar00rootroot00000000000000000077500000000000000000000000001225215345600340655ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/ValidationTest/src/test/java/org/jboss/resteasy/test/validationTestValidation.java000066400000000000000000000261371225215345600376730ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/ValidationTest/src/test/java/org/jboss/resteasy/test/validationpackage org.jboss.resteasy.test.validation; import static org.jboss.resteasy.test.TestPortProvider.generateURL; import java.io.Serializable; import java.util.Iterator; import javax.ws.rs.core.MediaType; import junit.framework.Assert; import org.jboss.arquillian.container.test.api.Deployment; import org.jboss.arquillian.junit.Arquillian; import org.jboss.resteasy.client.ClientRequest; import org.jboss.resteasy.client.ClientResponse; import org.jboss.resteasy.plugins.providers.SerializableProvider; import org.jboss.resteasy.spi.validation.ResteasyConstraintViolation; import org.jboss.resteasy.spi.validation.ResteasyViolationException; import org.jboss.resteasy.spi.validation.Validation; import org.jboss.resteasy.validation.Foo; import org.jboss.resteasy.validation.FooConstraint; import org.jboss.resteasy.validation.FooReaderWriter; import org.jboss.resteasy.validation.FooValidator; import org.jboss.resteasy.validation.JaxRsActivator; import org.jboss.resteasy.validation.TestClassConstraint; import org.jboss.resteasy.validation.TestClassValidator; import org.jboss.resteasy.validation.TestResourceWithAllViolationTypes; import org.jboss.resteasy.validation.TestResourceWithReturnValues; import org.jboss.shrinkwrap.api.ShrinkWrap; import org.jboss.shrinkwrap.api.asset.EmptyAsset; import org.jboss.shrinkwrap.api.spec.WebArchive; import org.jboss.shrinkwrap.api.Archive; import org.junit.Test; import org.junit.runner.RunWith; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Created Mar 16, 2012 */ @RunWith(Arquillian.class) public class TestValidation { @Deployment public static Archive createTestArchive() { WebArchive war = ShrinkWrap.create(WebArchive.class, "Validation-test.war") .addClasses(JaxRsActivator.class) .addClasses(Foo.class, FooConstraint.class, FooReaderWriter.class, FooValidator.class) .addClasses(TestClassConstraint.class, TestClassValidator.class) .addClasses(TestResourceWithAllViolationTypes.class, TestResourceWithReturnValues.class) .addAsResource("META-INF/services/javax.ws.rs.ext.Providers") ; System.out.println(war.toString(true)); return war; } @Test public void testReturnValues() throws Exception { // Valid native constraint ClientRequest request = new ClientRequest("http://localhost:8080/Validation-test/rest/return/native"); Foo foo = new Foo("a"); request.body("application/foo", foo); ClientResponse response = request.post(Foo.class); Assert.assertEquals(200, response.getStatus()); Assert.assertEquals(foo, response.getEntity()); // Valid imposed constraint request = new ClientRequest("http://localhost:8080/Validation-test/rest/return/imposed"); foo = new Foo("abcde"); request.body("application/foo", foo); response = request.post(Foo.class); Assert.assertEquals(200, response.getStatus()); Assert.assertEquals(foo, response.getEntity()); // Valid native and imposed constraints. request = new ClientRequest("http://localhost:8080/Validation-test/rest/return/nativeAndImposed"); foo = new Foo("abc"); request.body("application/foo", foo); response = request.post(Foo.class); Assert.assertEquals(200, response.getStatus()); Assert.assertEquals(foo, response.getEntity()); { // Invalid native constraint request = new ClientRequest("http://localhost:8080/Validation-test/rest/return/native"); request.body("application/foo", new Foo("abcdef")); response = request.post(); Assert.assertEquals(500, response.getStatus()); String header = response.getResponseHeaders().getFirst(Validation.VALIDATION_HEADER); Assert.assertNotNull(header); Assert.assertTrue(Boolean.valueOf(header)); MediaType mediaType = response.getMediaType(); Assert.assertEquals(SerializableProvider.APPLICATION_SERIALIZABLE_TYPE, mediaType); Object entity = response.getEntity(Serializable.class); System.out.println("entity: " + entity); Assert.assertTrue(entity instanceof ResteasyViolationException); ResteasyViolationException exception = ResteasyViolationException.class.cast(entity); ResteasyConstraintViolation violation = exception.getReturnValueViolations().iterator().next(); System.out.println("violation: " + violation); Assert.assertTrue(violation.getMessage().equals("s must have length: 1 <= length <= 3")); Assert.assertEquals("Foo[abcdef]", violation.getValue()); } { // Invalid imposed constraint request = new ClientRequest("http://localhost:8080/Validation-test/rest/return/imposed"); request.body("application/foo", new Foo("abcdef")); response = request.post(Foo.class); Assert.assertEquals(500, response.getStatus()); String header = response.getResponseHeaders().getFirst(Validation.VALIDATION_HEADER); Assert.assertNotNull(header); Assert.assertTrue(Boolean.valueOf(header)); MediaType mediaType = response.getMediaType(); Assert.assertEquals(SerializableProvider.APPLICATION_SERIALIZABLE_TYPE, mediaType); Object entity = response.getEntity(Serializable.class); System.out.println("entity: " + entity); Assert.assertTrue(entity instanceof ResteasyViolationException); ResteasyViolationException exception = ResteasyViolationException.class.cast(entity); countViolations(exception, 1, 0, 0, 0, 0, 1); ResteasyConstraintViolation violation = exception.getReturnValueViolations().iterator().next(); System.out.println("violation: " + violation); Assert.assertTrue(violation.getMessage().equals("s must have length: 3 <= length <= 5")); Assert.assertEquals("Foo[abcdef]", violation.getValue()); } { // Invalid native and imposed constraints request = new ClientRequest("http://localhost:8080/Validation-test/rest/return/nativeAndImposed"); request.body("application/foo", new Foo("abcdef")); response = request.post(Foo.class); Assert.assertEquals(500, response.getStatus()); String header = response.getResponseHeaders().getFirst(Validation.VALIDATION_HEADER); Assert.assertNotNull(header); Assert.assertTrue(Boolean.valueOf(header)); MediaType mediaType = response.getMediaType(); Assert.assertEquals(SerializableProvider.APPLICATION_SERIALIZABLE_TYPE, mediaType); Object entity = response.getEntity(Serializable.class); System.out.println("entity: " + entity); Assert.assertTrue(entity instanceof ResteasyViolationException); ResteasyViolationException exception = ResteasyViolationException.class.cast(entity); countViolations(exception, 2, 0, 0, 0, 0, 2); Iterator it = exception.getReturnValueViolations().iterator(); ResteasyConstraintViolation cv1 = it.next(); ResteasyConstraintViolation cv2 = it.next(); if (cv1.getMessage().indexOf('1') < 0) { ResteasyConstraintViolation temp = cv1; cv1 = cv2; cv2 = temp; } Assert.assertTrue(cv1.getMessage().equals("s must have length: 1 <= length <= 3")); Assert.assertEquals("Foo[abcdef]", cv1.getValue()); Assert.assertTrue(cv2.getMessage().equals("s must have length: 3 <= length <= 5")); Assert.assertEquals("Foo[abcdef]", cv2.getValue()); } } @Test public void testViolationsBeforeReturnValue() throws Exception { // Valid ClientRequest request = new ClientRequest("http://localhost:8080/Validation-test/rest/all/abc/wxyz"); Foo foo = new Foo("pqrs"); request.body("application/foo", foo); ClientResponse response = request.post(Foo.class); Assert.assertEquals(200, response.getStatus()); Assert.assertEquals(foo, response.getEntity()); // Invalid: Should have 1 each of field, property, class, and parameter violations, // and no return value violations. request = new ClientRequest("http://localhost:8080/Validation-test/rest/all/a/z"); foo = new Foo("p"); request.body("application/foo", foo); response = request.post(Foo.class); Assert.assertEquals(400, response.getStatus()); String header = response.getResponseHeaders().getFirst(Validation.VALIDATION_HEADER); Assert.assertNotNull(header); Assert.assertTrue(Boolean.valueOf(header)); MediaType mediaType = response.getMediaType(); Assert.assertEquals(SerializableProvider.APPLICATION_SERIALIZABLE_TYPE, mediaType); Object entity = response.getEntity(Serializable.class); System.out.println("entity: " + entity); Assert.assertTrue(entity instanceof ResteasyViolationException); ResteasyViolationException exception = ResteasyViolationException.class.cast(entity); countViolations(exception, 4, 1, 1, 1, 1, 0); ResteasyConstraintViolation violation = exception.getFieldViolations().iterator().next(); System.out.println("violation: " + violation); Assert.assertEquals("size must be between 2 and 4", violation.getMessage()); Assert.assertEquals("a", violation.getValue()); violation = exception.getPropertyViolations().iterator().next(); System.out.println("violation: " + violation); Assert.assertEquals("size must be between 3 and 5", violation.getMessage()); Assert.assertEquals("z", violation.getValue()); violation = exception.getClassViolations().iterator().next(); System.out.println("violation: " + violation); Assert.assertEquals("Concatenation of s and t must have length > 5", violation.getMessage()); System.out.println("violation value: " + violation.getValue()); Assert.assertTrue(violation.getValue().startsWith("org.jboss.resteasy.validation.TestResourceWithAllViolationTypes@")); violation = exception.getParameterViolations().iterator().next(); System.out.println("violation: " + violation); Assert.assertEquals("s must have length: 3 <= length <= 5", violation.getMessage()); Assert.assertEquals("Foo[p]", violation.getValue()); } private void countViolations(ResteasyViolationException e, int totalCount, int fieldCount, int propertyCount, int classCount, int parameterCount, int returnValueCount) { Assert.assertEquals(totalCount, e.getViolations().size()); Assert.assertEquals(fieldCount, e.getFieldViolations().size()); Assert.assertEquals(propertyCount, e.getPropertyViolations().size()); Assert.assertEquals(classCount, e.getClassViolations().size()); Assert.assertEquals(parameterCount, e.getParameterViolations().size()); Assert.assertEquals(returnValueCount, e.getReturnValueViolations().size()); } } Resteasy-3.0.6.Final/jaxrs/arquillian/ValidationTest/src/test/resources/000077500000000000000000000000001225215345600263565ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/ValidationTest/src/test/resources/arquillian.xml000066400000000000000000000020621225215345600312410ustar00rootroot00000000000000 target/deployments target/wildfly-8.0.0.Alpha2-SNAPSHOT standalone-full.xml Resteasy-3.0.6.Final/jaxrs/arquillian/ValidationTest/src/test/resources/modules/000077500000000000000000000000001225215345600300265ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/ValidationTest/src/test/resources/modules/javax/000077500000000000000000000000001225215345600311375ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/ValidationTest/src/test/resources/modules/javax/validation/000077500000000000000000000000001225215345600332715ustar00rootroot00000000000000000077500000000000000000000000001225215345600337635ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/ValidationTest/src/test/resources/modules/javax/validation/api000077500000000000000000000000001225215345600347075ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/ValidationTest/src/test/resources/modules/javax/validation/api/mainmodule.xml000066400000000000000000000025341225215345600367220ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/ValidationTest/src/test/resources/modules/javax/validation/api/main Resteasy-3.0.6.Final/jaxrs/arquillian/ValidationTest/src/test/resources/modules/org/000077500000000000000000000000001225215345600306155ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/ValidationTest/src/test/resources/modules/org/hibernate/000077500000000000000000000000001225215345600325565ustar00rootroot00000000000000000077500000000000000000000000001225215345600344645ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/ValidationTest/src/test/resources/modules/org/hibernate/validator000077500000000000000000000000001225215345600354105ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/ValidationTest/src/test/resources/modules/org/hibernate/validator/mainmodule.xml000066400000000000000000000033141225215345600374200ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/ValidationTest/src/test/resources/modules/org/hibernate/validator/main Resteasy-3.0.6.Final/jaxrs/arquillian/pom.xml000077500000000000000000000020551225215345600211660ustar00rootroot00000000000000 org.jboss.resteasy resteasy-jaxrs-all 3.0.6.Final ../pom.xml Arquillian 4.0.0 pom RESTEASY-760-jetty RESTEASY-767-jetty RESTEASY-800-AS71 resteasy-cdi-ejb-test ValidationTest-AS7 arquillian Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/000077500000000000000000000000001225215345600237535ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/.gitignore000066400000000000000000000000221225215345600257350ustar00rootroot00000000000000/target .DS_Store Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/pom.xml000077500000000000000000000301331225215345600252730ustar00rootroot00000000000000 4.0.0 org.jboss.resteasy resteasy-jaxrs-all 3.0.6.Final ../../pom.xml resteasy-cdi-ejb-test jar Resteasy AS7/CDI/EJB Integration Testsuite UTF-8 7.1.1.Final.cdi-ejb 1.2.0.Beta1 org.jboss.arquillian arquillian-bom 1.0.0.Final import pom org.apache.maven.plugins maven-compiler-plugin 2.3.2 1.6 1.6 org.apache.maven.plugins maven-surefire-plugin 2.12 maven-dependency-plugin unpack AS7 process-test-classes unpack org.jboss.resteasy.test as7-dist-cdi-ejb-7.1.1.Final 1.0 jar false target org.apache.maven.plugins maven-antrun-plugin 1.6 unpack resteasy process-test-classes run update AS7 application-roles.properties process-test-classes run update AS7 application-users.properties process-test-classes run src/test/resources org.hornetq hornetq-jms-client 2.2.13.Final org.jboss.weld weld-core 1.2.0-SNAPSHOT org.jboss.spec jboss-javaee-6.0 1.0.0.Final pom provided org.jboss.spec.javax.ejb jboss-ejb-api_3.1_spec 1.0.1.Final provided org.jboss.as jboss-as-arquillian-container-managed 7.1.1.Final test org.jboss.arquillian.protocol arquillian-protocol-servlet test org.jboss.resteasy jaxrs-api ${project.version} org.jboss.resteasy resteasy-jaxrs ${project.version} org.jboss.resteasy resteasy-jaxb-provider ${project.version} junit junit 4.8.1 org.jboss.arquillian.junit arquillian-junit-container test org.slf4j slf4j-simple 1.6.4 test org.jboss.resteasy resteasy-cdi ${project.version} org.hibernate hibernate-validator 4.3.1.Final Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/000077500000000000000000000000001225215345600245425ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/000077500000000000000000000000001225215345600254665ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/000077500000000000000000000000001225215345600264075ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/000077500000000000000000000000001225215345600271765ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/000077500000000000000000000000001225215345600303165ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/000077500000000000000000000000001225215345600321555ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/000077500000000000000000000000001225215345600327145ustar00rootroot00000000000000000077500000000000000000000000001225215345600341225ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/asynchAsynchronousResource.java000066400000000000000000000033041225215345600411700ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/asynchpackage org.jboss.resteasy.cdi.asynch; import java.util.concurrent.ExecutionException; import java.util.concurrent.Future; import java.util.logging.Logger; import javax.ejb.Asynchronous; import javax.ejb.Stateless; import javax.inject.Inject; import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.container.AsyncResponse; import javax.ws.rs.container.Suspended; import javax.ws.rs.core.Response; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright Dec 22, 2012 */ @Stateless @Path("/") public class AsynchronousResource { @Inject private Logger log; @Inject private AsynchronousStatelessLocal stateless; @GET @Path("asynch/simple") public Response asynchSimple() throws ExecutionException, InterruptedException { log.info("entering asynch()"); Future asyncResult = stateless.asynch(); return asyncResult.get() ? Response.ok().build() : Response.serverError().build(); } @GET @Path("asynch/asynch") public void asynchAsynch(@Suspended final AsyncResponse asyncResponse) throws ExecutionException, InterruptedException { log.info("entering asynchAsynch()"); Future asyncResult = stateless.asynch(); Response response = asyncResult.get() ? Response.ok().build() : Response.serverError().build(); Thread.sleep(2000); asyncResponse.resume(response); } @Asynchronous @GET @Path("asynch/ejb") public void asynchEJB(@Suspended final AsyncResponse asyncResponse) throws ExecutionException, InterruptedException { log.info("entering asynchEJB()"); Thread.sleep(2000); asyncResponse.resume(Response.ok().build()); } } AsynchronousStateless.java000066400000000000000000000010601225215345600413450ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/asynchpackage org.jboss.resteasy.cdi.asynch; import java.util.concurrent.Future; import javax.ejb.AsyncResult; import javax.ejb.Stateless; import javax.enterprise.context.Dependent; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright Dec 24, 2012 */ @Stateless @Dependent public class AsynchronousStateless implements AsynchronousStatelessLocal { @Override public Future asynch() throws InterruptedException { Thread.sleep(2000); return new AsyncResult(true); } } AsynchronousStatelessLocal.java000066400000000000000000000005331225215345600423240ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/asynchpackage org.jboss.resteasy.cdi.asynch; import java.util.concurrent.Future; import javax.ejb.Local; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright Dec 22, 2012 */ @Local public interface AsynchronousStatelessLocal { public Future asynch() throws InterruptedException; } JaxRsActivator.java000066400000000000000000000007761225215345600377030ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/asynchpackage org.jboss.resteasy.cdi.asynch; import javax.ws.rs.ApplicationPath; import javax.ws.rs.core.Application; /** * A class extending {@link Application} and annotated with @ApplicationPath is the Java EE 6 * "no XML" approach to activating JAX-RS. * *

* Resources are served relative to the servlet path specified in the {@link ApplicationPath} * annotation. *

*/ @ApplicationPath("/rest") public class JaxRsActivator extends Application { /* class body intentionally left blank */ } package-info.java000066400000000000000000000003251225215345600373110ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/asynch/** * This package (along with @see org.jboss.resteasy.test.cdi.asynch) tests JAX-RS and EJB * asynchronous processing. * * @see org.jboss.resteasy.package-info.java */ package org.jboss.resteasy.cdi.asynch; 000077500000000000000000000000001225215345600350025ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/decoratorsBook.java000066400000000000000000000027601225215345600365440ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/decoratorspackage org.jboss.resteasy.cdi.decorators; import javax.persistence.Entity; import javax.persistence.Id; import javax.validation.constraints.NotNull; import javax.validation.constraints.Size; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; /** * Book is * * 1) a JAXB class, suitable for transport over the network, and * 2) an @Entity class, suitable for JPA storage * * @author Ron Sigal * @version $Revision: 1 $ */ @Entity @XmlRootElement(name = "book") @XmlAccessorType(XmlAccessType.FIELD) public class Book { @XmlElement private int id; @XmlElement @NotNull @Size(min = 1, max = 25) private String name; public Book() { } public Book(String name) { this.name = name; } public Book(int id, String name) { this.id = id; this.name = name; } @Id public int getId() { return id; } public void setId(int id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String toString() { return "Book[" + id + "," + name + "]"; } public boolean equals(Object o) { if (o == null || ! (o instanceof Book)) { return false; } return name.equals(((Book) o).name); } } BookReader.java000066400000000000000000000040001225215345600376540ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/decoratorspackage org.jboss.resteasy.cdi.decorators; import java.io.IOException; import java.io.InputStream; import java.lang.annotation.Annotation; import java.lang.reflect.Type; import java.util.logging.Logger; import javax.inject.Inject; import javax.ws.rs.Consumes; import javax.ws.rs.WebApplicationException; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.MultivaluedMap; import javax.ws.rs.ext.MessageBodyReader; import javax.ws.rs.ext.Provider; import org.jboss.resteasy.cdi.util.Constants; import org.jboss.resteasy.spi.ResteasyProviderFactory; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright Nov 14, 2012 */ @Provider @Consumes(Constants.MEDIA_TYPE_TEST_XML) public class BookReader implements MessageBodyReader { static private MessageBodyReader delegate; @Inject private Logger log; static { System.out.println("In BookReader static {}"); ResteasyProviderFactory factory = ResteasyProviderFactory.getInstance(); delegate = factory.getMessageBodyReader(Book.class, null, null, Constants.MEDIA_TYPE_TEST_XML_TYPE); System.out.println("In BookReader static {}"); } public boolean isReadable(Class type, Type genericType, Annotation[] annotations, MediaType mediaType) { log.info("entering BookReader.isReadable()"); boolean b = Book.class.equals(type); log.info("leaving BookReader.isReadable()"); return b; } public Book readFrom(Class type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap httpHeaders, InputStream entityStream) throws IOException, WebApplicationException { log.info("entering BookReader.readFrom()"); Book book = Book.class.cast(delegate.readFrom(Book.class, genericType, annotations, mediaType, httpHeaders, entityStream)); log.info("BookReader.readFrom() read " + book); log.info("leaving BookReader.readFrom()"); return book; } } BookReaderDecorator.java000066400000000000000000000025541225215345600415330ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/decoratorspackage org.jboss.resteasy.cdi.decorators; import java.io.IOException; import java.io.InputStream; import java.lang.annotation.Annotation; import java.lang.reflect.Type; import java.util.logging.Logger; import javax.decorator.Decorator; import javax.decorator.Delegate; import javax.inject.Inject; import javax.ws.rs.WebApplicationException; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.MultivaluedMap; import javax.ws.rs.ext.MessageBodyReader; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright Nov 13, 2012 */ @Decorator public abstract class BookReaderDecorator implements MessageBodyReader { @Inject private Logger log; @Inject private @Delegate MessageBodyReader reader; @Override public Book readFrom(Class type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap httpHeaders, InputStream entityStream) throws IOException, WebApplicationException { log.info("entering BookReaderDecorator.readFrom()"); VisitList.add(VisitList.READER_DECORATOR_ENTER); Book b = reader.readFrom(type, genericType, annotations, mediaType, httpHeaders, entityStream); VisitList.add(VisitList.READER_DECORATOR_LEAVE); log.info("leaving BookReaderDecorator.readFrom()"); return b; } } BookReaderInterceptor.java000066400000000000000000000017251225215345600421060ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/decoratorspackage org.jboss.resteasy.cdi.decorators; import java.io.IOException; import java.util.logging.Logger; import javax.inject.Inject; import javax.ws.rs.WebApplicationException; import javax.ws.rs.ext.Provider; import javax.ws.rs.ext.ReaderInterceptor; import javax.ws.rs.ext.ReaderInterceptorContext; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright Nov 13, 2012 */ @Provider public class BookReaderInterceptor implements ReaderInterceptor { @Inject private Logger log; @Override public Object aroundReadFrom(ReaderInterceptorContext context) throws IOException, WebApplicationException { log.info("entering BookReaderInterceptor.aroundReadFrom()"); VisitList.add(VisitList.READER_INTERCEPTOR_ENTER); Object result = context.proceed(); VisitList.add(VisitList.READER_INTERCEPTOR_LEAVE); log.info("leaving BookReaderInterceptor.aroundReadFrom()"); return result; } } BookReaderInterceptorDecorator.java000066400000000000000000000021671225215345600437520ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/decoratorspackage org.jboss.resteasy.cdi.decorators; import java.io.IOException; import java.util.logging.Logger; import javax.decorator.Decorator; import javax.decorator.Delegate; import javax.inject.Inject; import javax.ws.rs.WebApplicationException; import javax.ws.rs.ext.ReaderInterceptor; import javax.ws.rs.ext.ReaderInterceptorContext; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright Nov 13, 2012 */ @Decorator public abstract class BookReaderInterceptorDecorator implements ReaderInterceptor { @Inject private Logger log; @Inject private @Delegate BookReaderInterceptor interceptor; @Override public Object aroundReadFrom(ReaderInterceptorContext context) throws IOException, WebApplicationException { log.info("entering BookReaderInterceptorDecorator.aroundReadFrom()"); VisitList.add(VisitList.READER_INTERCEPTOR_DECORATOR_ENTER); Object o = interceptor.aroundReadFrom(context); VisitList.add(VisitList.READER_INTERCEPTOR_DECORATOR_LEAVE); log.info("leaving BookReaderInterceptorDecorator.aroundReadFrom()"); return o; } } BookWriter.java000066400000000000000000000041741225215345600377420ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/decoratorspackage org.jboss.resteasy.cdi.decorators; import java.io.IOException; import java.io.OutputStream; import java.lang.annotation.Annotation; import java.lang.reflect.Type; import javax.ws.rs.Produces; import javax.ws.rs.WebApplicationException; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.MultivaluedMap; import javax.ws.rs.ext.MessageBodyWriter; import javax.ws.rs.ext.Provider; import org.jboss.resteasy.cdi.util.Constants; import org.jboss.resteasy.spi.ResteasyProviderFactory; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright Nov 14, 2012 */ @Provider @Produces(Constants.MEDIA_TYPE_TEST_XML) public class BookWriter implements MessageBodyWriter { static private MessageBodyWriter delegate; static { System.out.println("In BookWriter static {}"); ResteasyProviderFactory factory = ResteasyProviderFactory.getInstance(); delegate = factory.getMessageBodyWriter(Book.class, null, null, Constants.MEDIA_TYPE_TEST_XML_TYPE); } public boolean isWriteable(Class type, Type genericType, Annotation[] annotations, MediaType mediaType) { System.out.println("entering BookWriter.isWriteable()"); boolean b = Book.class.equals(type); System.out.println("leaving BookWriter.isWriteable()"); return b; } public long getSize(Book t, Class type, Type genericType, Annotation[] annotations, MediaType mediaType) { System.out.println("entering BookWriter.getSize()"); System.out.println("leaving BookWriter.getSize()"); return -1; } @Override public void writeTo(Book t, Class type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap httpHeaders, OutputStream entityStream) throws IOException, WebApplicationException { System.out.println("entering BookWriter.writeTo()"); System.out.println("BookWriter.writeTo() writing " + t); delegate.writeTo(t, type, genericType, annotations, mediaType, httpHeaders, entityStream); System.out.println("leaving BookWriter.writeTo()"); } } BookWriterDecorator.java000066400000000000000000000025311225215345600416000ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/decoratorspackage org.jboss.resteasy.cdi.decorators; import java.io.IOException; import java.io.OutputStream; import java.lang.annotation.Annotation; import java.lang.reflect.Type; import java.util.logging.Logger; import javax.decorator.Decorator; import javax.decorator.Delegate; import javax.inject.Inject; import javax.ws.rs.WebApplicationException; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.MultivaluedMap; import javax.ws.rs.ext.MessageBodyWriter; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright Nov 13, 2012 */ @Decorator public abstract class BookWriterDecorator implements MessageBodyWriter { @Inject private Logger log; @Inject private @Delegate MessageBodyWriter writer; @Override public void writeTo(Book t, Class type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap httpHeaders, OutputStream entityStream) throws IOException, WebApplicationException { log.info("entering BookWriterDecorator.writeTo()"); VisitList.add(VisitList.WRITER_DECORATOR_ENTER); writer.writeTo(t, type, genericType, annotations, mediaType, httpHeaders, entityStream); VisitList.add(VisitList.WRITER_DECORATOR_LEAVE); log.info("leaving BookWriterDecorator.writeTo()"); } } BookWriterInterceptor.java000066400000000000000000000016531225215345600421600ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/decoratorspackage org.jboss.resteasy.cdi.decorators; import java.io.IOException; import java.util.logging.Logger; import javax.inject.Inject; import javax.ws.rs.WebApplicationException; import javax.ws.rs.ext.Provider; import javax.ws.rs.ext.WriterInterceptor; import javax.ws.rs.ext.WriterInterceptorContext; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright Nov 13, 2012 */ @Provider public class BookWriterInterceptor implements WriterInterceptor { @Inject private Logger log; @Override public void aroundWriteTo(WriterInterceptorContext context) throws IOException, WebApplicationException { log.info("entering BookWriterInterceptor.aroundWriteTo()"); VisitList.add(VisitList.WRITER_INTERCEPTOR_ENTER); context.proceed(); VisitList.add(VisitList.WRITER_INTERCEPTOR_LEAVE); log.info("leaving BookWriterInterceptor.aroundWriteTo()"); } } BookWriterInterceptorDecorator.java000066400000000000000000000020421225215345600440140ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/decoratorspackage org.jboss.resteasy.cdi.decorators; import java.util.logging.Logger; import javax.decorator.Decorator; import javax.decorator.Delegate; import javax.inject.Inject; import javax.ws.rs.ext.WriterInterceptor; import javax.ws.rs.ext.WriterInterceptorContext; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright Nov 13, 2012 */ @Decorator public abstract class BookWriterInterceptorDecorator implements WriterInterceptor { @Inject private Logger log; @Inject private @Delegate BookWriterInterceptor interceptor; @Override public void aroundWriteTo(WriterInterceptorContext context) throws java.io.IOException, javax.ws.rs.WebApplicationException { log.info("entering BookWriterInterceptorDecorator.aroundWriteTo()"); VisitList.add(VisitList.WRITER_INTERCEPTOR_DECORATOR_ENTER); interceptor.aroundWriteTo(context); VisitList.add(VisitList.WRITER_INTERCEPTOR_DECORATOR_LEAVE); log.info("leaving BookWriterInterceptorDecorator.aroundWriteTo()"); } } FilterBinding.java000066400000000000000000000010441225215345600403640ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/decoratorspackage org.jboss.resteasy.cdi.decorators; import static java.lang.annotation.ElementType.METHOD; import static java.lang.annotation.ElementType.TYPE; import static java.lang.annotation.RetentionPolicy.RUNTIME; import java.lang.annotation.Retention; import java.lang.annotation.Target; import javax.ws.rs.NameBinding; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright Nov 14, 2012 */ @NameBinding @Target({TYPE, METHOD}) @Retention(value = RUNTIME) public @interface FilterBinding { } JaxRsActivator.java000066400000000000000000000010021225215345600405420ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/decoratorspackage org.jboss.resteasy.cdi.decorators; import javax.ws.rs.ApplicationPath; import javax.ws.rs.core.Application; /** * A class extending {@link Application} and annotated with @ApplicationPath is the Java EE 6 * "no XML" approach to activating JAX-RS. * *

* Resources are served relative to the servlet path specified in the {@link ApplicationPath} * annotation. *

*/ @ApplicationPath("/rest") public class JaxRsActivator extends Application { /* class body intentionally left blank */ } RequestFilterDecorator.java000066400000000000000000000017511225215345600423120ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/decoratorspackage org.jboss.resteasy.cdi.decorators; import java.io.IOException; import java.util.logging.Logger; import javax.decorator.Decorator; import javax.decorator.Delegate; import javax.inject.Inject; import javax.ws.rs.container.ContainerRequestContext; import javax.ws.rs.container.ContainerRequestFilter; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright Nov 13, 2012 */ @Decorator public abstract class RequestFilterDecorator implements ContainerRequestFilter { @Inject private Logger log; @Inject private @Delegate TestRequestFilter filter; @Override public void filter(ContainerRequestContext requestContext) throws IOException { log.info("entering RequestFilterDecorator.filter()"); VisitList.add(VisitList.REQUEST_FILTER_DECORATOR_ENTER); filter.filter(requestContext); VisitList.add(VisitList.REQUEST_FILTER_DECORATOR_LEAVE); log.info("leaving RequestFilterDecorator.filter()"); } } ResourceBinding.java000066400000000000000000000010631225215345600407270ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/decoratorspackage org.jboss.resteasy.cdi.decorators; import static java.lang.annotation.ElementType.METHOD; import static java.lang.annotation.ElementType.TYPE; import static java.lang.annotation.RetentionPolicy.RUNTIME; import java.lang.annotation.Retention; import java.lang.annotation.Target; import javax.interceptor.InterceptorBinding; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright Nov 13, 2012 */ @InterceptorBinding @Target({TYPE, METHOD}) @Retention(RUNTIME) public @interface ResourceBinding { } ResourceDecorator.java000066400000000000000000000024131225215345600412770ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/decoratorspackage org.jboss.resteasy.cdi.decorators; import java.util.logging.Logger; import javax.decorator.Decorator; import javax.decorator.Delegate; import javax.inject.Inject; import javax.ws.rs.core.Response; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright Nov 13, 2012 */ @Decorator public abstract class ResourceDecorator implements TestResourceIntf { @Inject private Logger log; @Inject private @Delegate TestResource resource; @Override public Response createBook(Book book) { log.info("entering ResourceDecorator.createBook()"); VisitList.add(VisitList.RESOURCE_DECORATOR_ENTER); Response response = resource.createBook(book); VisitList.add(VisitList.RESOURCE_DECORATOR_LEAVE); log.info("leaving ResourceDecorator.createBook()"); return response; } @Override public Book lookupBookById(int id) { log.info("entering ResourceDecorator.lookupBookById()"); VisitList.add(VisitList.RESOURCE_DECORATOR_ENTER); Book book = resource.lookupBookById(id); VisitList.add(VisitList.RESOURCE_DECORATOR_LEAVE); log.info("leaving ResourceDecorator.lookupBookById()"); return book; } @Override public abstract Response test(); } ResourceInterceptor.java000066400000000000000000000015151225215345600416550ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/decoratorspackage org.jboss.resteasy.cdi.decorators; import java.util.logging.Logger; import javax.inject.Inject; import javax.interceptor.AroundInvoke; import javax.interceptor.Interceptor; import javax.interceptor.InvocationContext; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright Nov 13, 2012 */ @Interceptor @ResourceBinding public class ResourceInterceptor { @Inject private Logger log; @AroundInvoke public Object intercept(InvocationContext ctx) throws Exception { log.info("entering ResourceInterceptor.intercept()"); VisitList.add(VisitList.RESOURCE_INTERCEPTOR_ENTER); Object result = ctx.proceed(); VisitList.add(VisitList.RESOURCE_INTERCEPTOR_LEAVE); log.info("leaving ResourceInterceptor.intercept()"); return result; } } ResponseFilterDecorator.java000066400000000000000000000021411225215345600424520ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/decoratorspackage org.jboss.resteasy.cdi.decorators; import java.io.IOException; import java.util.logging.Logger; import javax.decorator.Decorator; import javax.decorator.Delegate; import javax.inject.Inject; import javax.ws.rs.container.ContainerRequestContext; import javax.ws.rs.container.ContainerResponseContext; import javax.ws.rs.container.ContainerResponseFilter; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright Nov 13, 2012 */ @Decorator public abstract class ResponseFilterDecorator implements ContainerResponseFilter { @Inject private Logger log; @Inject private @Delegate TestResponseFilter filter; @Override public void filter(ContainerRequestContext requestContext, ContainerResponseContext responseContext) throws IOException { log.info("entering RequestFilterDecorator.filter()"); VisitList.add(VisitList.RESPONSE_FILTER_DECORATOR_ENTER); filter.filter(requestContext, responseContext); VisitList.add(VisitList.RESPONSE_FILTER_DECORATOR_LEAVE); log.info("leaving RequestFilterDecorator.filter()"); } } TestRequestFilter.java000066400000000000000000000012611225215345600413030ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/decoratorspackage org.jboss.resteasy.cdi.decorators; import java.io.IOException; import java.util.logging.Logger; import javax.inject.Inject; import javax.ws.rs.container.ContainerRequestContext; import javax.ws.rs.container.ContainerRequestFilter; import javax.ws.rs.ext.Provider; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright Nov 14, 2012 */ @Provider @FilterBinding public class TestRequestFilter implements ContainerRequestFilter { @Inject private Logger log; @Override public void filter(ContainerRequestContext requestContext) throws IOException { log.info("executing TestRequestFilter.filter()"); } } TestResource.java000066400000000000000000000142721225215345600403020ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/decoratorspackage org.jboss.resteasy.cdi.decorators; import java.util.ArrayList; import java.util.HashMap; import java.util.Map; import java.util.concurrent.atomic.AtomicInteger; import java.util.logging.Logger; import javax.enterprise.context.RequestScoped; import javax.inject.Inject; import javax.ws.rs.Consumes; import javax.ws.rs.GET; import javax.ws.rs.POST; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.Produces; import javax.ws.rs.WebApplicationException; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import org.jboss.resteasy.cdi.util.Constants; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright Nov 13, 2012 */ @Path("/") @RequestScoped public class TestResource implements TestResourceIntf { static private Map collection = new HashMap(); static private AtomicInteger counter = new AtomicInteger(); @Inject private Logger log; @Override @POST @Path("create") @Consumes(Constants.MEDIA_TYPE_TEST_XML) @Produces(MediaType.TEXT_PLAIN) @FilterBinding @ResourceBinding public Response createBook(Book book) { log.info("entering TestResource.createBook()"); VisitList.add(VisitList.RESOURCE_ENTER); int id = counter.getAndIncrement(); book.setId(id); collection.put(id, book); log.info("stored: " + id + "->" + book); VisitList.add(VisitList.RESOURCE_LEAVE); log.info("leaving TestResource.createBook()"); return Response.ok(id).build(); } @Override @GET @Path("book/{id:[0-9][0-9]*}") @Produces(Constants.MEDIA_TYPE_TEST_XML) @FilterBinding @ResourceBinding public Book lookupBookById(@PathParam("id") int id) { log.info("entering TestResource.lookupBookById(" + id + ")"); VisitList.add(VisitList.RESOURCE_ENTER); log.info("books: " + collection); Book book = collection.get(id); if (book == null) { throw new WebApplicationException(Response.Status.NOT_FOUND); } VisitList.add(VisitList.RESOURCE_LEAVE); log.info("leaving TestResource.lookupBookById(" + id + ")"); return book; } @Override @POST @Path("test") @Produces(MediaType.TEXT_PLAIN) public Response test() { log.info("entering TestResource.test()"); ArrayList expectedList = new ArrayList(); // Call to createBook() expectedList.add(VisitList.REQUEST_FILTER_DECORATOR_ENTER); expectedList.add(VisitList.REQUEST_FILTER_DECORATOR_LEAVE); expectedList.add(VisitList.READER_INTERCEPTOR_DECORATOR_ENTER); expectedList.add(VisitList.READER_INTERCEPTOR_ENTER); expectedList.add(VisitList.READER_DECORATOR_ENTER); expectedList.add(VisitList.READER_DECORATOR_LEAVE); expectedList.add(VisitList.READER_INTERCEPTOR_LEAVE); expectedList.add(VisitList.READER_INTERCEPTOR_DECORATOR_LEAVE); expectedList.add(VisitList.RESOURCE_INTERCEPTOR_ENTER); expectedList.add(VisitList.RESOURCE_DECORATOR_ENTER); expectedList.add(VisitList.RESOURCE_ENTER); expectedList.add(VisitList.RESOURCE_LEAVE); expectedList.add(VisitList.RESOURCE_DECORATOR_LEAVE); expectedList.add(VisitList.RESOURCE_INTERCEPTOR_LEAVE); expectedList.add(VisitList.RESPONSE_FILTER_DECORATOR_ENTER); expectedList.add(VisitList.RESPONSE_FILTER_DECORATOR_LEAVE); expectedList.add(VisitList.WRITER_INTERCEPTOR_DECORATOR_ENTER); expectedList.add(VisitList.WRITER_INTERCEPTOR_ENTER); expectedList.add(VisitList.WRITER_INTERCEPTOR_LEAVE); expectedList.add(VisitList.WRITER_INTERCEPTOR_DECORATOR_LEAVE); // Call to lookupBookById() expectedList.add(VisitList.REQUEST_FILTER_DECORATOR_ENTER); expectedList.add(VisitList.REQUEST_FILTER_DECORATOR_LEAVE); expectedList.add(VisitList.RESOURCE_INTERCEPTOR_ENTER); expectedList.add(VisitList.RESOURCE_DECORATOR_ENTER); expectedList.add(VisitList.RESOURCE_ENTER); expectedList.add(VisitList.RESOURCE_LEAVE); expectedList.add(VisitList.RESOURCE_DECORATOR_LEAVE); expectedList.add(VisitList.RESOURCE_INTERCEPTOR_LEAVE); expectedList.add(VisitList.RESPONSE_FILTER_DECORATOR_ENTER); expectedList.add(VisitList.RESPONSE_FILTER_DECORATOR_LEAVE); expectedList.add(VisitList.WRITER_INTERCEPTOR_DECORATOR_ENTER); expectedList.add(VisitList.WRITER_INTERCEPTOR_ENTER); expectedList.add(VisitList.WRITER_DECORATOR_ENTER); expectedList.add(VisitList.WRITER_DECORATOR_LEAVE); expectedList.add(VisitList.WRITER_INTERCEPTOR_LEAVE); expectedList.add(VisitList.WRITER_INTERCEPTOR_DECORATOR_LEAVE); // Call to test() expectedList.add(VisitList.READER_INTERCEPTOR_DECORATOR_ENTER); expectedList.add(VisitList.READER_INTERCEPTOR_ENTER); expectedList.add(VisitList.READER_DECORATOR_ENTER); expectedList.add(VisitList.READER_DECORATOR_LEAVE); expectedList.add(VisitList.READER_INTERCEPTOR_LEAVE); expectedList.add(VisitList.READER_INTERCEPTOR_DECORATOR_LEAVE); ArrayList visitList = VisitList.getList(); boolean status = expectedList.size() == visitList.size(); if (!status) { log.info("expectedList.size() [" + expectedList.size() + "] != visitList.size() [" + visitList.size() + "]"); } else { for (int i = 0; i < expectedList.size(); i++) { if (!expectedList.get(i).equals(visitList.get(i))) { status = false; log.info("visitList.get(" + i + ") incorrect: should be: " + expectedList.get(i) + ", is: " + visitList.get(i)); break; } } } if (!status) { log.info("\rexpectedList: "); for (int i = 0; i < expectedList.size(); i++) { log.info(i + ": " + expectedList.get(i).toString()); } log.info("\rvisitList:"); for (int i = 0; i < visitList.size(); i++) { log.info(i + ": " + visitList.get(i).toString()); } } log.info("leaving TestResource.test()"); return status ? Response.ok().build() : Response.serverError().build(); } } TestResourceIntf.java000066400000000000000000000017121225215345600411160ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/decoratorspackage org.jboss.resteasy.cdi.decorators; import javax.ws.rs.Consumes; import javax.ws.rs.GET; import javax.ws.rs.POST; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.Produces; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import org.jboss.resteasy.cdi.util.Constants; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright Nov 13, 2012 */ public interface TestResourceIntf { @POST @Path("create") @Consumes(Constants.MEDIA_TYPE_TEST_XML) @Produces(MediaType.TEXT_PLAIN) @FilterBinding @ResourceBinding public abstract Response createBook(Book book); @GET @Path("book/{id:[0-9][0-9]*}") @Produces(Constants.MEDIA_TYPE_TEST_XML) @FilterBinding @ResourceBinding public abstract Book lookupBookById(@PathParam("id") int id); @POST @Path("test") @Produces(MediaType.TEXT_PLAIN) public abstract Response test(); }TestResponseFilter.java000066400000000000000000000014241225215345600414520ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/decoratorspackage org.jboss.resteasy.cdi.decorators; import java.io.IOException; import java.util.logging.Logger; import javax.inject.Inject; import javax.ws.rs.container.ContainerRequestContext; import javax.ws.rs.container.ContainerResponseContext; import javax.ws.rs.container.ContainerResponseFilter; import javax.ws.rs.ext.Provider; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright Nov 14, 2012 */ @Provider @FilterBinding public class TestResponseFilter implements ContainerResponseFilter { @Inject private Logger log; @Override public void filter(ContainerRequestContext requestContext, ContainerResponseContext responseContext) throws IOException { log.info("executing TestResponseFilter.filter()"); } } VisitList.java000066400000000000000000000045341225215345600376050ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/decoratorspackage org.jboss.resteasy.cdi.decorators; import java.util.ArrayList; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright Nov 14, 2012 */ public class VisitList { static final public String REQUEST_FILTER_DECORATOR_ENTER = "requestFilterDecoratorEnter"; static final public String REQUEST_FILTER_DECORATOR_LEAVE = "requestFilterDecoratorLeave"; static final public String RESPONSE_FILTER_DECORATOR_ENTER = "responseFilterDecoratorEnter"; static final public String RESPONSE_FILTER_DECORATOR_LEAVE = "responseFilterDecoratorLeave"; static final public String READER_INTERCEPTOR_DECORATOR_ENTER = "readerInterceptorDecoratorEnter"; static final public String READER_INTERCEPTOR_DECORATOR_LEAVE = "readerInterceptorDecoratorLeave"; static final public String READER_INTERCEPTOR_ENTER = "readerInterceptorEnter"; static final public String READER_INTERCEPTOR_LEAVE = "readerInterceptorLeave"; static final public String READER_DECORATOR_ENTER = "readerDecoratorEnter"; static final public String READER_DECORATOR_LEAVE = "readerDecoratorLeave"; static final public String WRITER_INTERCEPTOR_DECORATOR_ENTER = "writerInterceptorDecoratorEnter"; static final public String WRITER_INTERCEPTOR_DECORATOR_LEAVE = "writerInterceptorDecoratorLeave"; static final public String WRITER_INTERCEPTOR_ENTER = "writerInterceptorEnter"; static final public String WRITER_INTERCEPTOR_LEAVE = "writerInterceptorLeave"; static final public String WRITER_DECORATOR_ENTER = "writerDecoratorEnter"; static final public String WRITER_DECORATOR_LEAVE = "writerDecoratorLeave"; static final public String RESOURCE_INTERCEPTOR_ENTER = "resourceInterceptorEnter"; static final public String RESOURCE_INTERCEPTOR_LEAVE = "resourceInterceptorLeave"; static final public String RESOURCE_DECORATOR_ENTER = "resourceDecoratorEnter"; static final public String RESOURCE_DECORATOR_LEAVE = "resourceDecoratorLeave"; static final public String RESOURCE_ENTER = "resourceEnter"; static final public String RESOURCE_LEAVE = "resourceLeave"; static private ArrayList visitList = new ArrayList(); static public void add(String o) { visitList.add(o); } static public ArrayList getList() { return new ArrayList(visitList); } } package-info.java000066400000000000000000000006131225215345600401710ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/decorators/** * This package (along with @see org.jboss.resteasy.test.cdi.decorators) tests the application * of CDI decorators to: * * *) ContainerRequestFilter * *) ContainerResponseFilter * *) ReaderInterceptor * *) MessageBodyReader * *) WriterInterceptor * *) MessageBodyWriter * *) Resources * * @see org.jboss.resteasy.package-info.java */ package org.jboss.resteasy.cdi.decorators; 000077500000000000000000000000001225215345600333755ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/ejbBook.java000066400000000000000000000032771225215345600351430ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/ejbpackage org.jboss.resteasy.cdi.ejb; import java.io.Serializable; import javax.persistence.Entity; import javax.persistence.Id; import javax.validation.constraints.NotNull; import javax.validation.constraints.Size; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; /** * Book is * * 1) a JAXB class, suitable for transport over the network, and * 2) an @Entity class, suitable for JPA storage * * It implements Serializable so that it can be returned from a JAX-RS resource * in its role as EJB. * * @author Ron Sigal * @version $Revision: 1 $ */ @Entity @XmlRootElement(name = "book") @XmlAccessorType(XmlAccessType.FIELD) public class Book implements Serializable { private static final long serialVersionUID = 1L; @XmlElement private int id; @XmlElement @NotNull @Size(min = 1, max = 25) private String name; public Book() { } public Book(String name) { this.name = name; } public Book(int id, String name) { this.id = id; this.name = name; } @Id public int getId() { return id; } public void setId(int id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String toString() { return "Book[" + id + "," + name + "]"; } public boolean equals(Object o) { if (o == null || ! (o instanceof Book)) { return false; } return name.equals(((Book) o).name); } } EJBApplication.java000066400000000000000000000012511225215345600370230ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/ejbpackage org.jboss.resteasy.cdi.ejb; import java.util.HashSet; import java.util.Set; import javax.ejb.Singleton; import javax.enterprise.context.ApplicationScoped; import javax.ws.rs.core.Application; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright Jul 3, 2012 */ @Singleton @ApplicationScoped public class EJBApplication extends Application { @Override public Set> getClasses() { HashSet> classes = new HashSet>(); classes.add(EJBBookReaderImpl.class); classes.add(EJBBookWriterImpl.class); classes.add(EJBBookResource.class); return classes; } } EJBBookReader.java000066400000000000000000000007741225215345600366060ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/ejbpackage org.jboss.resteasy.cdi.ejb; import javax.ejb.Local; import javax.ws.rs.Consumes; import javax.ws.rs.ext.MessageBodyReader; import javax.ws.rs.ext.Provider; import org.jboss.resteasy.cdi.util.Constants; /** * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright Jun 29, 2012 */ @Local @Provider @Consumes(Constants.MEDIA_TYPE_TEST_XML) public interface EJBBookReader extends MessageBodyReader { public int getUses(); public void reset(); } EJBBookReaderImpl.java000066400000000000000000000045161225215345600374260ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/ejbpackage org.jboss.resteasy.cdi.ejb; import java.io.IOException; import java.io.InputStream; import java.lang.annotation.Annotation; import java.lang.reflect.Type; import java.util.logging.Logger; import javax.ejb.Stateful; import javax.inject.Inject; import javax.persistence.Entity; import javax.ws.rs.Consumes; import javax.ws.rs.WebApplicationException; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.MultivaluedMap; import javax.ws.rs.ext.MessageBodyReader; import javax.ws.rs.ext.Provider; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlRootElement; import org.jboss.resteasy.cdi.util.Constants; import org.jboss.resteasy.spi.ResteasyProviderFactory; /** * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright May 8, 2012 */ @Stateful @Provider @Consumes(Constants.MEDIA_TYPE_TEST_XML) public class EJBBookReaderImpl implements EJBBookReader, MessageBodyReader { @SuppressWarnings("rawtypes") static private MessageBodyReader delegate; @Inject private Logger log; static private int uses; @Entity @XmlRootElement(name = "nonbook") @XmlAccessorType(XmlAccessType.FIELD) public class NonBook { } static { ResteasyProviderFactory factory = ResteasyProviderFactory.getInstance(); delegate = factory.getMessageBodyReader(NonBook.class, null, null, MediaType.APPLICATION_XML_TYPE); System.out.println("reader delegate: " + delegate); // Should be JAXBXmlRootElementProvider. } public boolean isReadable(Class type, Type genericType, Annotation[] annotations, MediaType mediaType) { return Book.class.equals(type); } @SuppressWarnings("unchecked") public Book readFrom(Class type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap httpHeaders, InputStream entityStream) throws IOException, WebApplicationException { log.info("entering EJBBookReader.readFrom()"); uses++; return Book.class.cast(delegate.readFrom(Book.class, genericType, annotations, mediaType, httpHeaders, entityStream)); } @Override public int getUses() { return uses; } @Override public void reset() { uses = 0; } } EJBBookResource.java000066400000000000000000000105511225215345600371650ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/ejbpackage org.jboss.resteasy.cdi.ejb; import java.util.HashMap; import java.util.logging.Logger; import javax.ejb.EJB; import javax.ejb.Stateless; import javax.enterprise.context.Dependent; import javax.inject.Inject; import javax.ws.rs.Consumes; import javax.ws.rs.GET; import javax.ws.rs.POST; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.Produces; import javax.ws.rs.WebApplicationException; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import org.jboss.resteasy.cdi.util.Constants; import org.jboss.resteasy.cdi.util.Counter; import org.jboss.resteasy.cdi.util.CounterBinding; import org.jboss.resteasy.cdi.util.Utilities; /** * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright Jun 29, 2012 */ @Stateless @Dependent @Path("/") public class EJBBookResource implements EJBLocalResource, EJBRemoteResource { private static HashMap books = new HashMap(); @Inject private Logger log; @Inject private Utilities utilities; @Inject @CounterBinding private Counter counter; @Inject private EJBBookReader readerCDI; // EJBBookReaderImpl implements @Local interface EJBBookReader @EJB private EJBBookReader readerEJB; @Inject private EJBBookWriterImpl writerCDI; // EJBBookWriterImpl has a no-interface view @EJB private EJBBookWriterImpl writerEJB; @GET @Override @Path("verifyScopes") @Produces(MediaType.TEXT_PLAIN) public int verifyScopes() { log.info("entering verifyScopes()"); log.info("EJBBookReader scope: " + utilities.getScope(EJBBookReader.class)); log.info("EJBBookReaderImpl scope: " + utilities.getScope(EJBBookReaderImpl.class)); log.info("EJBBookWriterImpl scope: " + utilities.getScope(EJBBookWriterImpl.class)); log.info("EJBLocalResource scope: " + utilities.getScope(EJBLocalResource.class)); log.info("EJBRemoteResource scope: " + utilities.getScope(EJBRemoteResource.class)); log.info("EJBBookResource scope: " + utilities.getScope(EJBBookResource.class)); boolean result = true; result &= utilities.isApplicationScoped(EJBBookReader.class); result &= utilities.isApplicationScoped(EJBBookWriterImpl.class); result &= utilities.isDependentScoped(EJBLocalResource.class); return result ? 200 : 500; } @GET @Override @Path("verifyInjection") @Produces(MediaType.TEXT_PLAIN) public int verifyInjection() { log.info("entering verifyInjection()"); log.info("readerCDI: " + readerCDI); log.info("readerEJB: " + readerEJB); log.info("writerCDI: " + writerCDI); log.info("writerEJB: " + writerEJB); boolean result = true; result &= readerCDI != null; result &= readerEJB != null; result &= writerCDI != null; result &= writerEJB != null; return result ? 200 : 500; } @POST @Path("create") @Consumes(Constants.MEDIA_TYPE_TEST_XML) @Produces(MediaType.TEXT_PLAIN) public int createBook(Book book) { log.info("entering createBook()"); int id = counter.getNext(); book.setId(id); books.put(id, book); log.info("stored: " + id + "->" + book); return id; } @GET @Path("book/{id:[0-9][0-9]*}") @Produces(Constants.MEDIA_TYPE_TEST_XML) public Book lookupBookById(@PathParam("id") int id) { log.info("entering lookupBookById(" + id + ")"); log.info("books: " + books); Book book = books.get(id); if (book == null) { throw new WebApplicationException(Response.Status.NOT_FOUND); } return book; } @GET @Path("uses/{count}") @Produces(MediaType.TEXT_PLAIN) public int testUse(@PathParam("count") int count) { log.info("entering testUse()"); log.info("readerEJB uses: " + readerEJB.getUses()); log.info("writerEJB uses: " + writerEJB.getUses()); log.info("readerCDI uses: " + readerCDI.getUses()); log.info("writerCDI uses: " + writerCDI.getUses()); int readerUses = readerCDI.getUses(); int writerUses = writerCDI.getUses(); readerCDI.reset(); writerCDI.reset(); return (readerUses == count && writerUses == count) ? 200 : 500; } @GET @Path("reset") public void reset() { log.info("entering reset()"); counter.reset(); } } EJBBookWriterImpl.java000066400000000000000000000053431225215345600374770ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/ejbpackage org.jboss.resteasy.cdi.ejb; import java.io.IOException; import java.io.OutputStream; import java.lang.annotation.Annotation; import java.lang.reflect.Type; import javax.ejb.LocalBean; import javax.ejb.Stateful; import javax.persistence.Entity; import javax.ws.rs.Produces; import javax.ws.rs.WebApplicationException; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.MultivaluedMap; import javax.ws.rs.ext.MessageBodyWriter; import javax.ws.rs.ext.Provider; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlRootElement; import org.jboss.resteasy.cdi.util.Constants; import org.jboss.resteasy.spi.ResteasyProviderFactory; /** * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright May 8, 2012 */ @Stateful @LocalBean @Provider @Produces(Constants.MEDIA_TYPE_TEST_XML) public class EJBBookWriterImpl implements MessageBodyWriter//EJBBookWriter { @SuppressWarnings("rawtypes") static private MessageBodyWriter delegate; static private int uses; @Entity @XmlRootElement(name = "nonbook") @XmlAccessorType(XmlAccessType.FIELD) public class NonBook { } /* * It seems that EJBBookWriterImpl is treated somewhat differently than EJBBookReaderImpl, perhaps * because EJBBookWriterImpl has a no-interface view. In any case, EJBBookReaderImpl is able to * get an instance of ResteasyProviderFactory in a static block, but EJBBookWriterImpl isn't. */ static void getDelegate() { ResteasyProviderFactory factory = ResteasyProviderFactory.getInstance(); delegate = factory.getMessageBodyWriter(NonBook.class, null, null, MediaType.APPLICATION_XML_TYPE); System.out.println("writer delegate: " + delegate); // Should be JAXBXmlRootElementProvider. } public boolean isWriteable(Class type, Type genericType, Annotation[] annotations, MediaType mediaType) { return Book.class.equals(type); } public long getSize(Book t, Class type, Type genericType, Annotation[] annotations, MediaType mediaType) { return -1; } @SuppressWarnings("unchecked") @Override public void writeTo(Book t, Class type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap httpHeaders, OutputStream entityStream) throws IOException, WebApplicationException { if (delegate == null) { getDelegate(); } delegate.writeTo(t, type, genericType, annotations, mediaType, httpHeaders, entityStream); uses++; } public int getUses() { return uses; } public void reset() { uses = 0; } } EJBLocalResource.java000066400000000000000000000004431225215345600373240ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/ejbpackage org.jboss.resteasy.cdi.ejb; import javax.ejb.Local; import javax.ws.rs.Path; /** * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright Jun 29, 2012 */ @Local @Path("/") public interface EJBLocalResource extends EJBResourceParent { } EJBRemoteResource.java000066400000000000000000000004021225215345600375200ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/ejbpackage org.jboss.resteasy.cdi.ejb; import javax.ejb.Remote; /** * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright Jun 29, 2012 */ @Remote public interface EJBRemoteResource extends EJBResourceParent { } EJBResourceParent.java000066400000000000000000000016771225215345600375350ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/ejbpackage org.jboss.resteasy.cdi.ejb; import javax.ws.rs.Consumes; import javax.ws.rs.GET; import javax.ws.rs.POST; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.Produces; import org.jboss.resteasy.cdi.util.Constants; /** * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright Jun 29, 2012 */ @Path("/") public interface EJBResourceParent { @GET @Path("verifyScopes") public int verifyScopes(); @GET @Path("verifyInjection") public int verifyInjection(); @POST @Path("create") @Consumes(Constants.MEDIA_TYPE_TEST_XML) public int createBook(Book book); @GET @Path("book/{id:[0-9][0-9]*}") @Produces(Constants.MEDIA_TYPE_TEST_XML) public Book lookupBookById(@PathParam("id") int id); @GET @Path("uses/{count}") public int testUse(@PathParam("count") int count); @GET @Path("reset") public void reset(); } package-info.java000066400000000000000000000003071225215345600365640ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/ejb/** * This package (along with @see org.jboss.resteasy.test.cdi.ejb) tests EJBs used as * JAX-RS components. * * @see org.jboss.resteasy.package-info.java */ package org.jboss.resteasy.cdi.ejb; 000077500000000000000000000000001225215345600341415ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/eventsBook.java000066400000000000000000000027541225215345600357060ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/eventspackage org.jboss.resteasy.cdi.events; import javax.persistence.Entity; import javax.persistence.Id; import javax.validation.constraints.NotNull; import javax.validation.constraints.Size; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; /** * Book is * * 1) a JAXB class, suitable for transport over the network, and * 2) an @Entity class, suitable for JPA storage * * @author Ron Sigal * @version $Revision: 1 $ */ @Entity @XmlRootElement(name = "book") @XmlAccessorType(XmlAccessType.FIELD) public class Book { @XmlElement private int id; @XmlElement @NotNull @Size(min = 1, max = 25) private String name; public Book() { } public Book(String name) { this.name = name; } public Book(int id, String name) { this.id = id; this.name = name; } @Id public int getId() { return id; } public void setId(int id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String toString() { return "Book[" + id + "," + name + "]"; } public boolean equals(Object o) { if (o == null || ! (o instanceof Book)) { return false; } return name.equals(((Book) o).name); } } BookReader.java000066400000000000000000000075241225215345600370310ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/eventspackage org.jboss.resteasy.cdi.events; import java.io.IOException; import java.io.InputStream; import java.lang.annotation.Annotation; import java.lang.reflect.Type; import java.util.ArrayList; import java.util.logging.Logger; import javax.enterprise.event.Event; import javax.enterprise.event.Observes; import javax.inject.Inject; import javax.ws.rs.Consumes; import javax.ws.rs.WebApplicationException; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.MultivaluedMap; import javax.ws.rs.ext.MessageBodyReader; import javax.ws.rs.ext.Provider; import org.jboss.resteasy.cdi.util.Constants; import org.jboss.resteasy.spi.ResteasyProviderFactory; /** * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright May 8, 2012 */ @Provider @Consumes(Constants.MEDIA_TYPE_TEST_XML) public class BookReader implements MessageBodyReader { static private MessageBodyReader delegate; @Inject @Read(context="reader") Event readEvent; @Inject private Logger log; private ArrayList eventList = new ArrayList(); static { System.out.println("In BookReader static {}"); ResteasyProviderFactory factory = ResteasyProviderFactory.getInstance(); delegate = factory.getMessageBodyReader(Book.class, null, null, Constants.MEDIA_TYPE_TEST_XML_TYPE); System.out.println("In BookReader static {}"); } public boolean isReadable(Class type, Type genericType, Annotation[] annotations, MediaType mediaType) { System.out.println("entering BookReader.isReadable()"); boolean b = Book.class.equals(type); System.out.println("leaving BookReader.isReadable()"); return b; } public Book readFrom(Class type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap httpHeaders, InputStream entityStream) throws IOException, WebApplicationException { log.info("entering BookReader.readFrom()"); Book book = Book.class.cast(delegate.readFrom(Book.class, genericType, annotations, mediaType, httpHeaders, entityStream)); log.info("BookReader firing readEvent"); readEvent.fire("readEvent"); log.info("BookReader.readFrom() read " + book); log.info("leaving BookReader.readFrom()"); return book; } public void readIntercept(@Observes @ReadIntercept String event) { eventList.add(event); log.info("BookReader.readIntercept() got " + event); } public void read(@Observes @Read(context="reader") String event) { eventList.add(event); log.info("BookReader.read() got " + event); } public void writeIntercept(@Observes @WriteIntercept String event) { eventList.add(event); log.info("BookReader.writeIntercept() got " + event); } public void write(@Observes @Write(context="writer") String event) { eventList.add(event); log.info("BookReader.write() got " + event); } public void process(@Observes @Process String event) { eventList.add(event); log.info("BookReader.process() got " + event); } public void processRead(@Observes @Process @Read(context="resource") String event) { eventList.add(event); log.info("BookReader.processRead() got " + event); } public void processWrite(@Observes @Process @Write(context="resource") String event) { eventList.add(event); log.info("BookReader.processWrite() got " + event); } public void unused(@Observes @Read(context="unused") @Write(context="unused") Unused event) { eventList.add(event); log.info("BookReader.unused() got " + event); throw new RuntimeException("BookReader.unused() got " + event); } public ArrayList getEventList() { return new ArrayList(eventList); } } BookReaderInterceptor.java000066400000000000000000000022521225215345600412410ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/eventspackage org.jboss.resteasy.cdi.events; import java.io.IOException; import java.util.logging.Logger; import javax.enterprise.event.Event; import javax.inject.Inject; import javax.ws.rs.WebApplicationException; import javax.ws.rs.ext.Provider; import javax.ws.rs.ext.ReaderInterceptor; import javax.ws.rs.ext.ReaderInterceptorContext; import org.jboss.resteasy.annotations.interception.ServerInterceptor; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright Jul 23, 2012 */ @Provider @ServerInterceptor public class BookReaderInterceptor implements ReaderInterceptor { @Inject @ReadIntercept Event readInterceptEvent; @Inject private Logger log; @Override public Object aroundReadFrom(ReaderInterceptorContext context) throws IOException, WebApplicationException { log.info("*** Intercepting call in BookReaderInterceptor.read()"); log.info("BookReaderInterceptor firing readInterceptEvent"); readInterceptEvent.fire("readInterceptEvent"); Object result = context.proceed(); log.info("*** Back from intercepting call in BookReaderInterceptor.read()"); return result; } } BookWriter.java000066400000000000000000000045051225215345600370770ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/eventspackage org.jboss.resteasy.cdi.events; import java.io.IOException; import java.io.OutputStream; import java.lang.annotation.Annotation; import java.lang.reflect.Type; import java.util.logging.Logger; import javax.enterprise.event.Event; import javax.inject.Inject; import javax.ws.rs.Produces; import javax.ws.rs.WebApplicationException; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.MultivaluedMap; import javax.ws.rs.ext.MessageBodyWriter; import javax.ws.rs.ext.Provider; import org.jboss.resteasy.cdi.util.Constants; import org.jboss.resteasy.spi.ResteasyProviderFactory; /** * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright May 8, 2012 */ @Provider @Produces(Constants.MEDIA_TYPE_TEST_XML) public class BookWriter implements MessageBodyWriter { static private MessageBodyWriter delegate; @Inject @Write(context="writer") Event writeEvent; @Inject private Logger log; static { System.out.println("In BookWriter static {}"); ResteasyProviderFactory factory = ResteasyProviderFactory.getInstance(); delegate = factory.getMessageBodyWriter(Book.class, null, null, Constants.MEDIA_TYPE_TEST_XML_TYPE); } public boolean isWriteable(Class type, Type genericType, Annotation[] annotations, MediaType mediaType) { log.info("entering BookWriter.isWriteable()"); boolean b = Book.class.equals(type); log.info("leaving BookWriter.isWriteable()"); return b; } public long getSize(Book t, Class type, Type genericType, Annotation[] annotations, MediaType mediaType) { log.info("entering BookWriter.getSize()"); log.info("leaving BookWriter.getSize()"); return -1; } @Override public void writeTo(Book t, Class type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap httpHeaders, OutputStream entityStream) throws IOException, WebApplicationException { log.info("entering BookWriter.writeTo()"); log.info("BookWriter.writeTo() writing " + t); delegate.writeTo(t, type, genericType, annotations, mediaType, httpHeaders, entityStream); log.info("BookWriter firing writeEvent"); writeEvent.fire("writeEvent"); log.info("leaving BookWriter.writeTo()"); } } BookWriterInterceptor.java000066400000000000000000000022141225215345600413110ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/eventspackage org.jboss.resteasy.cdi.events; import java.io.IOException; import java.util.logging.Logger; import javax.enterprise.event.Event; import javax.inject.Inject; import javax.ws.rs.WebApplicationException; import javax.ws.rs.ext.Provider; import javax.ws.rs.ext.WriterInterceptor; import javax.ws.rs.ext.WriterInterceptorContext; import org.jboss.resteasy.annotations.interception.ServerInterceptor; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright Jul 23, 2012 */ @Provider @ServerInterceptor public class BookWriterInterceptor implements WriterInterceptor { @Inject @WriteIntercept Event writeInterceptEvent; @Inject private Logger log; @Override public void aroundWriteTo(WriterInterceptorContext context) throws IOException, WebApplicationException { log.info("*** Intercepting call in BookWriterInterceptor.write()"); log.info("BookWriterInterceptor firing writeInterceptEvent"); writeInterceptEvent.fire("writeInterceptEvent"); context.proceed(); log.info("*** Back from intercepting call in BookWriterInterceptor.write()"); } } EventResource.java000066400000000000000000000157641225215345600376120ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/eventspackage org.jboss.resteasy.cdi.events; import java.util.ArrayList; import java.util.HashMap; import java.util.Map; import java.util.concurrent.atomic.AtomicInteger; import java.util.logging.Logger; import javax.enterprise.context.RequestScoped; import javax.enterprise.event.Event; import javax.inject.Inject; import javax.ws.rs.Consumes; import javax.ws.rs.GET; import javax.ws.rs.POST; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.Produces; import javax.ws.rs.WebApplicationException; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import org.jboss.resteasy.cdi.util.Constants; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright May 7, 2012 */ @Path("/") @RequestScoped public class EventResource { static private Map collection = new HashMap(); static private AtomicInteger counter = new AtomicInteger(); @Inject @Process Event processEvent; @Inject @Read(context="resource") @Process Event readProcessEvent; @Inject @Write(context="resource") @Process Event writeProcessEvent; @Inject BookReader bookReader; @Inject private Logger log; @POST @Path("test") @Produces(MediaType.TEXT_PLAIN) public Response test() { log.info("entering EventResource.test()"); log.info("event list:"); ArrayList eventList = bookReader.getEventList(); for (int i = 0; i < eventList.size(); i++) { log.info(eventList.get(i).toString()); } boolean status = true; if (!(eventList.size() == 20)) { status = false; log.info("should have 20 events, not " + eventList.size()); } if (!"readInterceptEvent".equals(eventList.get(0))) // BookReader.process() or BookReader.readIntercept() { status = false; log.info("missing readInterceptEvent"); } if (!"readInterceptEvent".equals(eventList.get(1))) // BookReader.process() or BookReader.readIntercept() { status = false; log.info("missing readInterceptEvent"); } if (!"readEvent".equals(eventList.get(2))) // BookReader.process() or BookReader.read() { status = false; log.info("missing readEvent"); } if (!"readEvent".equals(eventList.get(3))) // BookReader.process() or BookReader.read() { status = false; log.info("missing readEvent"); } if (!"processEvent".equals(eventList.get(4))) // BookReader.process() { status = false; log.info("missing processEvent"); } if (!"readProcessEvent".equals(eventList.get(5))) // BookReader.process() or BookReader.readProcess() { status = false; log.info("missing readProcessEvent"); } if (!"readProcessEvent".equals(eventList.get(6))) // BookReader.process() or BookReader.readProcess() { status = false; log.info("missing readProcessEvent"); } if (!"writeInterceptEvent".equals(eventList.get(7))) // BookReader.process() or BookReader.writeIntercept() { status = false; log.info("missing writeInterceptEvent"); } if (!"writeInterceptEvent".equals(eventList.get(8))) // BookReader.process() or BookReader.writeIntercept() { status = false; log.info("missing writeInterceptEvent"); } if (!"processEvent".equals(eventList.get(9))) // BookReader.process() { status = false; log.info("missing processEvent"); } if (!"writeProcessEvent".equals(eventList.get(10))) // BookReader.process() or BookReader.writeProcess() { status = false; log.info("missing writeProcessEvent"); } if (!"writeProcessEvent".equals(eventList.get(11))) // BookReader.process() or BookReader.writeProcess() { status = false; log.info("missing writeProcessEvent"); } if (!"writeInterceptEvent".equals(eventList.get(12))) // BookReader.process() or BookReader.writeIntercept() { status = false; log.info("missing writeInterceptEvent"); } if (!"writeInterceptEvent".equals(eventList.get(13))) // BookReader.process() or BookReader.writeIntercept() { status = false; log.info("missing writeInterceptEvent"); } if (!"writeEvent".equals(eventList.get(14))) // BookReader.process() or BookReader.write() { status = false; log.info("missing writeEvent"); } if (!"writeEvent".equals(eventList.get(15))) // BookReader.process() or BookReader.write() { status = false; log.info("missing writeEvent"); } if (!"readInterceptEvent".equals(eventList.get(16))) // BookReader.process() or BookReader.readIntercept() { status = false; log.info("missing readInterceptEvent"); } if (!"readInterceptEvent".equals(eventList.get(17))) // BookReader.process() or BookReader.readIntercept() { status = false; log.info("missing readInterceptEvent"); } if (!"readEvent".equals(eventList.get(18))) // BookReader.process() or BookReader.read() { status = false; log.info("missing readEvent"); } if (!"readEvent".equals(eventList.get(19))) // BookReader.process() or BookReader.read() { status = false; log.info("missing readEvent"); } log.info("leaving EventResource.test()"); return status ? Response.ok().build() : Response.serverError().build(); } @POST @Path("create") @Consumes(Constants.MEDIA_TYPE_TEST_XML) @Produces(MediaType.TEXT_PLAIN) public Response createBook(Book book) { log.info("entering EventResource.createBook()"); log.info("EventResource firing processEvent"); processEvent.fire("processEvent"); int id = counter.getAndIncrement(); book.setId(id); collection.put(id, book); log.info("stored: " + id + "->" + book); log.info("EventResource firing readProcessEvent"); readProcessEvent.fire("readProcessEvent"); log.info("leaving EventResource.createBook()"); return Response.ok(id).build(); } @GET @Path("book/{id:[0-9][0-9]*}") @Produces(Constants.MEDIA_TYPE_TEST_XML) public Book lookupBookById(@PathParam("id") int id) { log.info("entering EventResource.lookupBookById(" + id + ")"); log.info("books: " + collection); log.info("EventResource firing processEvent"); processEvent.fire("processEvent"); Book book = collection.get(id); log.info("EventResource firing writeProcessEvent"); writeProcessEvent.fire("writeProcessEvent"); if (book == null) { throw new WebApplicationException(Response.Status.NOT_FOUND); } log.info("leaving EventResource.lookupBookById(" + id + ")"); return book; } } JaxRsActivator.java000066400000000000000000000007761225215345600377220ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/eventspackage org.jboss.resteasy.cdi.events; import javax.ws.rs.ApplicationPath; import javax.ws.rs.core.Application; /** * A class extending {@link Application} and annotated with @ApplicationPath is the Java EE 6 * "no XML" approach to activating JAX-RS. * *

* Resources are served relative to the servlet path specified in the {@link ApplicationPath} * annotation. *

*/ @ApplicationPath("/rest") public class JaxRsActivator extends Application { /* class body intentionally left blank */ } Process.java000066400000000000000000000011761225215345600364270ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/eventspackage org.jboss.resteasy.cdi.events; import static java.lang.annotation.ElementType.FIELD; import static java.lang.annotation.ElementType.PARAMETER; import static java.lang.annotation.RetentionPolicy.RUNTIME; import java.lang.annotation.Documented; import java.lang.annotation.Inherited; import java.lang.annotation.Retention; import java.lang.annotation.Target; import javax.inject.Qualifier; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright Jul 25, 2012 */ @Qualifier @Target({FIELD, PARAMETER}) @Retention(RUNTIME) @Documented @Inherited public @interface Process { } ProcessRead.java000066400000000000000000000012021225215345600372110ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/eventspackage org.jboss.resteasy.cdi.events; import static java.lang.annotation.ElementType.FIELD; import static java.lang.annotation.ElementType.PARAMETER; import static java.lang.annotation.RetentionPolicy.RUNTIME; import java.lang.annotation.Documented; import java.lang.annotation.Inherited; import java.lang.annotation.Retention; import java.lang.annotation.Target; import javax.inject.Qualifier; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright Jul 25, 2012 */ @Qualifier @Target({FIELD, PARAMETER}) @Retention(RUNTIME) @Documented @Inherited public @interface ProcessRead { } ProcessReadWrite.java000066400000000000000000000012071225215345600402310ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/eventspackage org.jboss.resteasy.cdi.events; import static java.lang.annotation.ElementType.FIELD; import static java.lang.annotation.ElementType.PARAMETER; import static java.lang.annotation.RetentionPolicy.RUNTIME; import java.lang.annotation.Documented; import java.lang.annotation.Inherited; import java.lang.annotation.Retention; import java.lang.annotation.Target; import javax.inject.Qualifier; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright Jul 25, 2012 */ @Qualifier @Target({FIELD, PARAMETER}) @Retention(RUNTIME) @Documented @Inherited public @interface ProcessReadWrite { } Read.java000066400000000000000000000012201225215345600356520ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/eventspackage org.jboss.resteasy.cdi.events; import static java.lang.annotation.ElementType.FIELD; import static java.lang.annotation.ElementType.PARAMETER; import static java.lang.annotation.RetentionPolicy.RUNTIME; import java.lang.annotation.Documented; import java.lang.annotation.Inherited; import java.lang.annotation.Retention; import java.lang.annotation.Target; import javax.inject.Qualifier; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright Jul 25, 2012 */ @Qualifier @Target({FIELD, PARAMETER}) @Retention(RUNTIME) @Documented @Inherited public @interface Read { String context(); } ReadIntercept.java000066400000000000000000000012041225215345600375320ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/eventspackage org.jboss.resteasy.cdi.events; import static java.lang.annotation.ElementType.FIELD; import static java.lang.annotation.ElementType.PARAMETER; import static java.lang.annotation.RetentionPolicy.RUNTIME; import java.lang.annotation.Documented; import java.lang.annotation.Inherited; import java.lang.annotation.Retention; import java.lang.annotation.Target; import javax.inject.Qualifier; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright Jul 25, 2012 */ @Qualifier @Target({FIELD, PARAMETER}) @Retention(RUNTIME) @Documented @Inherited public @interface ReadIntercept { } Unused.java000066400000000000000000000011751225215345600362530ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/eventspackage org.jboss.resteasy.cdi.events; import static java.lang.annotation.ElementType.FIELD; import static java.lang.annotation.ElementType.PARAMETER; import static java.lang.annotation.RetentionPolicy.RUNTIME; import java.lang.annotation.Documented; import java.lang.annotation.Inherited; import java.lang.annotation.Retention; import java.lang.annotation.Target; import javax.inject.Qualifier; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright Jul 25, 2012 */ @Qualifier @Target({FIELD, PARAMETER}) @Retention(RUNTIME) @Documented @Inherited public @interface Unused { } Write.java000066400000000000000000000012211225215345600360720ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/eventspackage org.jboss.resteasy.cdi.events; import static java.lang.annotation.ElementType.FIELD; import static java.lang.annotation.ElementType.PARAMETER; import static java.lang.annotation.RetentionPolicy.RUNTIME; import java.lang.annotation.Documented; import java.lang.annotation.Inherited; import java.lang.annotation.Retention; import java.lang.annotation.Target; import javax.inject.Qualifier; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright Jul 25, 2012 */ @Qualifier @Target({FIELD, PARAMETER}) @Retention(RUNTIME) @Documented @Inherited public @interface Write { String context(); } WriteIntercept.java000066400000000000000000000012051225215345600377520ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/eventspackage org.jboss.resteasy.cdi.events; import static java.lang.annotation.ElementType.FIELD; import static java.lang.annotation.ElementType.PARAMETER; import static java.lang.annotation.RetentionPolicy.RUNTIME; import java.lang.annotation.Documented; import java.lang.annotation.Inherited; import java.lang.annotation.Retention; import java.lang.annotation.Target; import javax.inject.Qualifier; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright Jul 25, 2012 */ @Qualifier @Target({FIELD, PARAMETER}) @Retention(RUNTIME) @Documented @Inherited public @interface WriteIntercept { } 000077500000000000000000000000001225215345600347015ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/events/ejbBook.java000066400000000000000000000027601225215345600364430ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/events/ejbpackage org.jboss.resteasy.cdi.events.ejb; import javax.persistence.Entity; import javax.persistence.Id; import javax.validation.constraints.NotNull; import javax.validation.constraints.Size; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; /** * Book is * * 1) a JAXB class, suitable for transport over the network, and * 2) an @Entity class, suitable for JPA storage * * @author Ron Sigal * @version $Revision: 1 $ */ @Entity @XmlRootElement(name = "book") @XmlAccessorType(XmlAccessType.FIELD) public class Book { @XmlElement private int id; @XmlElement @NotNull @Size(min = 1, max = 25) private String name; public Book() { } public Book(String name) { this.name = name; } public Book(int id, String name) { this.id = id; this.name = name; } @Id public int getId() { return id; } public void setId(int id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String toString() { return "Book[" + id + "," + name + "]"; } public boolean equals(Object o) { if (o == null || ! (o instanceof Book)) { return false; } return name.equals(((Book) o).name); } } EventObserver.java000066400000000000000000000011021225215345600403270ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/events/ejbpackage org.jboss.resteasy.cdi.events.ejb; import java.util.ArrayList; import javax.ejb.Local; import javax.enterprise.event.Observes; /** * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright Jun 29, 2012 */ @Local public interface EventObserver { public void process(@Observes @Process String event); public void processRead(@Observes @Process @Read(context="resource") String event); public void processWrite(@Observes @Process @Write(context="resource") String event); public ArrayList getEventList(); } EventObserverImpl.java000066400000000000000000000023301225215345600411550ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/events/ejbpackage org.jboss.resteasy.cdi.events.ejb; import java.util.ArrayList; import java.util.logging.Logger; import javax.ejb.Stateful; import javax.enterprise.event.Event; import javax.enterprise.event.Observes; import javax.inject.Inject; /** * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright May 8, 2012 */ @Stateful public class EventObserverImpl implements EventObserver { @Inject @Read(context="reader") Event readEvent; @Inject private Logger log; private ArrayList eventList = new ArrayList(); public void process(@Observes @Process String event) { eventList.add(event); log.info("EventObserverImpl.process() got " + event); } public void processRead(@Observes @Process @Read(context="resource") String event) { eventList.add(event); log.info("EventObserverImpl.processRead() got " + event); } public void processWrite(@Observes @Process @Write(context="resource") String event) { eventList.add(event); log.info("EventObserverImpl.processWrite() got " + event); } public ArrayList getEventList() { return new ArrayList(eventList); } } EventSource.java000066400000000000000000000005741225215345600400140ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/events/ejbpackage org.jboss.resteasy.cdi.events.ejb; import javax.ejb.Local; import javax.ws.rs.PathParam; /** * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright Jun 29, 2012 */ @Local public interface EventSource { public int createBook(Book book); public Book lookupBookById(@PathParam("id") int id); public boolean test(); } EventSourceImpl.java000066400000000000000000000047141225215345600406360ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/events/ejbpackage org.jboss.resteasy.cdi.events.ejb; import java.util.ArrayList; import java.util.HashMap; import java.util.Map; import java.util.concurrent.atomic.AtomicInteger; import java.util.logging.Logger; import javax.ejb.Stateless; import javax.enterprise.event.Event; import javax.inject.Inject; import javax.ws.rs.PathParam; import javax.ws.rs.WebApplicationException; import javax.ws.rs.core.Response; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright May 7, 2012 */ @Stateless public class EventSourceImpl implements EventSource { static private Map collection = new HashMap(); static private AtomicInteger counter = new AtomicInteger(); @Inject @Process Event processEvent; @Inject @Read(context="resource") @Process Event readProcessEvent; @Inject @Write(context="resource") @Process Event writeProcessEvent; @Inject EventObserver eventObserver; @Inject private Logger log; public boolean test() { log.info("entering EventSourceImpl.test()"); ArrayList eventList = eventObserver.getEventList(); for (int i = 0; i < eventList.size(); i++) { log.info(eventList.get(i).toString()); } log.info("leaving EventSourceImpl.test()"); return true; } public int createBook(Book book) { log.info("entering EventSourceImpl.createBook()"); log.info("EventSourceImpl firing processEvent"); processEvent.fire("processEvent"); int id = counter.getAndIncrement(); book.setId(id); collection.put(id, book); log.info("stored: " + id + "->" + book); log.info("EventSourceImpl firing readProcessEvent"); readProcessEvent.fire("readProcessEvent"); log.info("leaving EventSourceImpl.createBook()"); return id; } public Book lookupBookById(@PathParam("id") int id) { log.info("entering EventSourceImpl.lookupBookById(" + id + ")"); log.info("books: " + collection); log.info("EventSourceImpl firing processEvent"); processEvent.fire("processEvent"); Book book = collection.get(id); log.info("EventSourceImpl firing writeProcessEvent"); writeProcessEvent.fire("writeProcessEvent"); if (book == null) { throw new WebApplicationException(Response.Status.NOT_FOUND); } log.info("leaving EventSourceImpl.lookupBookById(" + id + ")"); return book; } } Process.java000066400000000000000000000012021225215345600371550ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/events/ejbpackage org.jboss.resteasy.cdi.events.ejb; import static java.lang.annotation.ElementType.FIELD; import static java.lang.annotation.ElementType.PARAMETER; import static java.lang.annotation.RetentionPolicy.RUNTIME; import java.lang.annotation.Documented; import java.lang.annotation.Inherited; import java.lang.annotation.Retention; import java.lang.annotation.Target; import javax.inject.Qualifier; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright Jul 25, 2012 */ @Qualifier @Target({FIELD, PARAMETER}) @Retention(RUNTIME) @Documented @Inherited public @interface Process { } ProcessRead.java000066400000000000000000000012061225215345600377550ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/events/ejbpackage org.jboss.resteasy.cdi.events.ejb; import static java.lang.annotation.ElementType.FIELD; import static java.lang.annotation.ElementType.PARAMETER; import static java.lang.annotation.RetentionPolicy.RUNTIME; import java.lang.annotation.Documented; import java.lang.annotation.Inherited; import java.lang.annotation.Retention; import java.lang.annotation.Target; import javax.inject.Qualifier; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright Jul 25, 2012 */ @Qualifier @Target({FIELD, PARAMETER}) @Retention(RUNTIME) @Documented @Inherited public @interface ProcessRead { } ProcessReadWrite.java000066400000000000000000000012131225215345600407660ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/events/ejbpackage org.jboss.resteasy.cdi.events.ejb; import static java.lang.annotation.ElementType.FIELD; import static java.lang.annotation.ElementType.PARAMETER; import static java.lang.annotation.RetentionPolicy.RUNTIME; import java.lang.annotation.Documented; import java.lang.annotation.Inherited; import java.lang.annotation.Retention; import java.lang.annotation.Target; import javax.inject.Qualifier; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright Jul 25, 2012 */ @Qualifier @Target({FIELD, PARAMETER}) @Retention(RUNTIME) @Documented @Inherited public @interface ProcessReadWrite { } Read.java000066400000000000000000000012241225215345600364160ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/events/ejbpackage org.jboss.resteasy.cdi.events.ejb; import static java.lang.annotation.ElementType.FIELD; import static java.lang.annotation.ElementType.PARAMETER; import static java.lang.annotation.RetentionPolicy.RUNTIME; import java.lang.annotation.Documented; import java.lang.annotation.Inherited; import java.lang.annotation.Retention; import java.lang.annotation.Target; import javax.inject.Qualifier; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright Jul 25, 2012 */ @Qualifier @Target({FIELD, PARAMETER}) @Retention(RUNTIME) @Documented @Inherited public @interface Read { String context(); } Write.java000066400000000000000000000012251225215345600366360ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/events/ejbpackage org.jboss.resteasy.cdi.events.ejb; import static java.lang.annotation.ElementType.FIELD; import static java.lang.annotation.ElementType.PARAMETER; import static java.lang.annotation.RetentionPolicy.RUNTIME; import java.lang.annotation.Documented; import java.lang.annotation.Inherited; import java.lang.annotation.Retention; import java.lang.annotation.Target; import javax.inject.Qualifier; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright Jul 25, 2012 */ @Qualifier @Target({FIELD, PARAMETER}) @Retention(RUNTIME) @Documented @Inherited public @interface Write { String context(); } package-info.java000066400000000000000000000003131225215345600400650ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/events/ejb/** * This package (along with @see org.jboss.resteasy.test.cdi.events.ejb) tests CDI events * with EJBs. * * @see org.jboss.resteasy.package-info.java */ package org.jboss.resteasy.cdi.events.ejb; package-info.java000066400000000000000000000003321225215345600373260ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/events/** * This package (along with @see org.jboss.resteasy.test.cdi.events) tests CDI event processing * with JAX-RS components. * * @see org.jboss.resteasy.package-info.java */ package org.jboss.resteasy.cdi.events; 000077500000000000000000000000001225215345600346515ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/extension000077500000000000000000000000001225215345600355565ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/extension/beanBoston.java000066400000000000000000000013771225215345600376750ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/extension/beanpackage org.jboss.resteasy.cdi.extension.bean; import static java.lang.annotation.ElementType.FIELD; import static java.lang.annotation.ElementType.METHOD; import static java.lang.annotation.ElementType.TYPE; import static java.lang.annotation.RetentionPolicy.RUNTIME; import java.lang.annotation.Documented; import java.lang.annotation.Inherited; import java.lang.annotation.Retention; import java.lang.annotation.Target; import javax.inject.Qualifier; import static java.lang.annotation.ElementType.PARAMETER; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright Jun 11, 2012 */ @Qualifier @Target({TYPE, METHOD, FIELD, PARAMETER}) @Retention(RUNTIME) @Documented @Inherited public @interface Boston { } BostonBean.java000066400000000000000000000133201225215345600404520ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/extension/beanpackage org.jboss.resteasy.cdi.extension.bean; import java.lang.annotation.Annotation; import java.lang.reflect.Type; import java.util.HashSet; import java.util.Iterator; import java.util.Set; import java.util.logging.Logger; import javax.enterprise.context.ApplicationScoped; import javax.enterprise.context.RequestScoped; import javax.enterprise.context.spi.CreationalContext; import javax.enterprise.inject.spi.Bean; import javax.enterprise.inject.spi.InjectionPoint; import javax.enterprise.inject.spi.InjectionTarget; import javax.inject.Inject; import javax.ws.rs.Path; import javax.ws.rs.ext.Provider; import org.jboss.resteasy.cdi.util.Utilities; /** * * A BostonBean is just like other beans, only much, much better. * * [Credit to Laurie Anderson: * * Paradise is exactly like where you are right now, * Only much, much better. * ] * * BostonBeans are handled by the CDI extension BostonBeanExtension, and are implemented by classes * annotated with @Boston. * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright Jun 13, 2012 */ public class BostonBean implements Bean { @Inject Logger log; private Class clazz; private String className; private InjectionTarget injectionTarget; private Set types; private Set qualifiers; private Class scope; private Set injectionPoints; public BostonBean(Class clazz, InjectionTarget injectionTarget) { this.clazz = clazz; this.className = clazz.getSimpleName(); this.injectionTarget = injectionTarget; types = Utilities.getTypeClosure(clazz); qualifiers = Utilities.getQualifiers(clazz); injectionPoints = injectionTarget.getInjectionPoints(); scope = Utilities.getScopeAnnotation(clazz); if (scope == null) { if (Utilities.isAnnotationPresent(clazz, Path.class)) { scope = RequestScoped.class; } else if (Utilities.isAnnotationPresent(clazz, Provider.class)) { scope = ApplicationScoped.class; } else { scope = RequestScoped.class; } } } @Override public T create(CreationalContext creationalContext) { System.out.println("BostonBean[" + className + "].create()"); T instance = injectionTarget.produce(creationalContext); System.out.println("BostonBean[" + className + "].create() raw instance: " + instance); injectionTarget.inject(instance, creationalContext); injectionTarget.postConstruct(instance); System.out.println("BostonBean[" + className + "].create(): cooked instance: " + instance); return instance; } @Override public void destroy(T instance, CreationalContext creationalContext) { System.out.println("BostonBean[" + className + "].destroy()"); creationalContext.release(); } @Override public Set getTypes() { System.out.println("BostonBean[" + className + "].getTypes()"); return types; } @Override public Set getQualifiers() { System.out.println("BostonBean[" + className + "].getQualifiers()"); return qualifiers; } @Override public Class getScope() { System.out.println("BostonBean[" + className + "].getScope()"); return scope; } @Override public String getName() { System.out.println("BostonBean[" + className + "].getName()"); return null; } @Override public Set> getStereotypes() { System.out.println("BostonBean[" + className + "].getStereotypes()"); return new HashSet>(); } @Override public Class getBeanClass() { System.out.println("BostonBean[" + className + "].getBeanClass()"); return clazz; } @Override public boolean isAlternative() { System.out.println("BostonBean[" + className + "].isAlternative()"); return false; } @Override public boolean isNullable() { System.out.println("BostonBean[" + className + "].isNullable()"); return false; } @Override public Set getInjectionPoints() { System.out.println("BostonBean[" + className + "].getInjectionPoints()"); return injectionPoints; } @Override public String toString() { StringBuilder sb = new StringBuilder("BostonBean[").append(clazz).append('\r'). append(" scope: ").append(scope).append('\r'). append(" types: "); Iterator it1 = types.iterator(); while (it1.hasNext()) { sb.append(it1.next()).append('\r'). append(" "); } sb.append('\r'). append(" qualifiers: "); Iterator it2 = qualifiers.iterator(); while (it2.hasNext()) { sb.append(it2.next()).append('\r'). append(" "); } sb.append('\r'). append(" injection points: "); Iterator it3 = getInjectionPoints().iterator(); while (it3.hasNext()) { sb.append(it3.next()).append('\r'). append(" "); } sb.append('\r'). append("]"); return sb.toString(); } } BostonBeanExtension.java000066400000000000000000000023541225215345600423540ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/extension/beanpackage org.jboss.resteasy.cdi.extension.bean; import javax.enterprise.event.Observes; import javax.enterprise.inject.spi.AfterBeanDiscovery; import javax.enterprise.inject.spi.BeanManager; import javax.enterprise.inject.spi.Extension; /** * BostonBeanExtension implements a CDI extension. * * In particular, it creates a BostonBean for each of the two classes, * BostonHolder and BostonLeaf, that are annotated with @Boston, and it * registers them with the CDI runtime. * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright Jun 11, 2012 */ public class BostonBeanExtension implements Extension { @SuppressWarnings({ "rawtypes", "unchecked" }) void afterBeanDiscovery(@Observes AfterBeanDiscovery abd, BeanManager bm) { System.out.println("AfterBeanDiscovery"); BostonBean rb = new BostonBean(BostonHolder.class, bm.createInjectionTarget(bm.createAnnotatedType(BostonHolder.class))); abd.addBean(rb); System.out.println("registered " + rb.toString()); rb = new BostonBean(BostonlLeaf.class, bm.createInjectionTarget(bm.createAnnotatedType(BostonlLeaf.class))); abd.addBean(rb); System.out.println("registered " + rb.toString()); } } BostonHolder.java000066400000000000000000000007411225215345600410250ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/extension/beanpackage org.jboss.resteasy.cdi.extension.bean; import javax.inject.Inject; @Boston public class BostonHolder { public @Inject TestReader reader; public @Inject @Boston BostonlLeaf leaf; public TestReader getReader() { return reader; } public BostonlLeaf getLeaf() { return leaf; } public String toString() { return "\rthis: " + System.identityHashCode(this) + "\r" + "reader: " + reader + "\r" + "leaf: " + leaf; } } BostonlLeaf.java000066400000000000000000000003241225215345600406300ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/extension/beanpackage org.jboss.resteasy.cdi.extension.bean; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright Jun 23, 2012 */ @Boston public class BostonlLeaf { } TestReader.java000066400000000000000000000020371225215345600404650ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/extension/beanpackage org.jboss.resteasy.cdi.extension.bean; import java.io.IOException; import java.io.InputStream; import java.lang.annotation.Annotation; import java.lang.reflect.Type; import javax.ws.rs.Consumes; import javax.ws.rs.WebApplicationException; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.MultivaluedMap; import javax.ws.rs.ext.MessageBodyReader; import javax.ws.rs.ext.Provider; /** * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright June 13, 2012 */ @Provider @Consumes("application/test+xml") public class TestReader implements MessageBodyReader { public boolean isReadable(Class type, Type genericType, Annotation[] annotations, MediaType mediaType) { return false; } public Object readFrom(Class type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap httpHeaders, InputStream entityStream) throws IOException, WebApplicationException { return null; } } TestResource.java000066400000000000000000000015401225215345600410500ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/extension/beanpackage org.jboss.resteasy.cdi.extension.bean; import javax.enterprise.context.RequestScoped; import javax.inject.Inject; import javax.ws.rs.POST; import javax.ws.rs.Path; import javax.ws.rs.core.Response; import org.jboss.resteasy.cdi.util.Utilities; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright May 7, 2012 */ @Path("/extension") @RequestScoped public class TestResource { @Inject @Boston BostonHolder holder; @POST @Path("boston") public Response setup() { System.out.println("holder: " + holder); boolean response = true; response &= Utilities.isBoston(holder.getClass()); response &= holder.getLeaf() != null; response &= holder.getReader() != null; return response ? Response.ok().build() : Response.serverError().build(); } } package-info.java000066400000000000000000000004151225215345600407450ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/extension/bean/** * This package (along with @see org.jboss.resteasy.test.cdi.extension.bean) introduces an * application defined implementation of javax.enterprise.inject.spi.Bean. * * @see org.jboss.resteasy.package-info.java */ package org.jboss.resteasy.cdi.extension.bean; 000077500000000000000000000000001225215345600357625ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/extension/scopeExtensionResource.java000066400000000000000000000056501225215345600423170ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/extension/scopepackage org.jboss.resteasy.cdi.extension.scope; import java.util.logging.Logger; import javax.enterprise.context.RequestScoped; import javax.inject.Inject; import javax.ws.rs.POST; import javax.ws.rs.Path; import javax.ws.rs.core.Response; import org.jboss.resteasy.cdi.util.Utilities; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright May 7, 2012 */ @Path("/extension") @RequestScoped public class ExtensionResource { private static int lastSecret2; private static int lastSecret3; @Inject private Logger log; @Inject private Utilities utilities; @Inject private ObsolescentAfterTwoUses oo2; @Inject private ObsolescentAfterThreeUses oo3; @POST @Path("setup") public Response setup() { log.info("ObsolescentObject scope: " + utilities.testScope(ObsolescentAfterTwoUses.class, PlannedObsolescenceScope.class)); if (utilities.testScope(ObsolescentAfterTwoUses.class, PlannedObsolescenceScope.class)) { lastSecret2 = oo2.getSecret(); lastSecret3 = oo3.getSecret(); log.info("current secret2: " + lastSecret2); log.info("current secret3: " + lastSecret3); return Response.ok().build(); } else { return Response.serverError().build(); } } @POST @Path("test1") public Response test1() { int currentSecret2 = oo2.getSecret(); int currentSecret3 = oo3.getSecret(); log.info("last secret2: " + lastSecret2); log.info("last secret3: " + lastSecret3); log.info("current secret2: " + currentSecret2); log.info("current secret3: " + currentSecret3); if (currentSecret2 == lastSecret2 && currentSecret3 == lastSecret3) { lastSecret2 = currentSecret2; lastSecret3 = currentSecret3; return Response.ok().build(); } else { return Response.serverError().build(); } } @POST @Path("test2") public Response test2() { int currentSecret2 = oo2.getSecret(); int currentSecret3 = oo3.getSecret(); log.info("last secret2: " + lastSecret2); log.info("last secret3: " + lastSecret3); log.info("current secret2: " + currentSecret2); log.info("current secret3: " + currentSecret3); if (currentSecret2 != lastSecret2 && currentSecret3 == lastSecret3) { lastSecret3 = currentSecret3; return Response.ok().build(); } else { return Response.serverError().build(); } } @POST @Path("test3") public Response test3() { int currentSecret3 = oo3.getSecret(); log.info("last secret3: " + lastSecret3); log.info("current secret3: " + currentSecret3); if (currentSecret3 != lastSecret3) { return Response.ok().build(); } else { return Response.serverError().build(); } } } Obsolescent.java000066400000000000000000000003201225215345600411000ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/extension/scopepackage org.jboss.resteasy.cdi.extension.scope; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright Jun 12, 2012 */ public interface Obsolescent { } ObsolescentAfterThreeUses.java000066400000000000000000000010031225215345600437110ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/extension/scopepackage org.jboss.resteasy.cdi.extension.scope; import javax.inject.Inject; /** * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright Jun 11, 2012 */ @PlannedObsolescenceScope(3) public class ObsolescentAfterThreeUses implements Obsolescent { @Inject private int secret; public int getSecret() { return secret; } public String toString() { return "ObsolescenceObject[" + System.identityHashCode(this) + "," + secret + "]"; } } ObsolescentAfterTwoUses.java000066400000000000000000000010011225215345600434110ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/extension/scopepackage org.jboss.resteasy.cdi.extension.scope; import javax.inject.Inject; /** * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright Jun 11, 2012 */ @PlannedObsolescenceScope(2) public class ObsolescentAfterTwoUses implements Obsolescent { @Inject private int secret; public int getSecret() { return secret; } public String toString() { return "ObsolescenceObject[" + System.identityHashCode(this) + "," + secret + "]"; } } PlannedObsolescenceContext.java000066400000000000000000000060401225215345600441000ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/extension/scopepackage org.jboss.resteasy.cdi.extension.scope; import java.lang.annotation.Annotation; import java.util.HashMap; import javax.enterprise.context.spi.Context; import javax.enterprise.context.spi.Contextual; import javax.enterprise.context.spi.CreationalContext; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright Jun 11, 2012 */ public class PlannedObsolescenceContext implements Context { private HashMap, Wrapper> map = new HashMap, Wrapper>(); @Override public Class getScope() { return PlannedObsolescenceScope.class; } @Override public T get(Contextual contextual, CreationalContext creationalContext) { @SuppressWarnings("unchecked") Wrapper w = (Wrapper) map.get(contextual); if (w != null) { T o = w.object; Class c = o.getClass(); PlannedObsolescenceScope scope = c.getAnnotation(PlannedObsolescenceScope.class); if (scope == null) { throw new RuntimeException("Error"); } if (++w.counter > scope.value()) { contextual.destroy(o, creationalContext); creationalContext.release(); o = contextual.create(creationalContext); map.put(contextual, new Wrapper(creationalContext, o)); } return o; } else { T o = contextual.create(creationalContext); map.put(contextual, new Wrapper(creationalContext, o)); return o; } } /** * Technically, this version of get() should not create a new object, but, * for purposes of the test, we destroy and recreate an object when it is * obsolete. */ @Override public T get(Contextual contextual) { @SuppressWarnings("unchecked") Wrapper w = (Wrapper) map.get(contextual); if (w == null) { return null; } T o = w.object; Class c = o.getClass(); PlannedObsolescenceScope scope = c.getAnnotation(PlannedObsolescenceScope.class); if (scope == null) { throw new RuntimeException("Error"); } CreationalContext creationalContext = w.creationalContext; if (++w.counter > scope.value()) { contextual.destroy(o, creationalContext); creationalContext.release(); map.remove(contextual); // o = contextual.create(creationalContext); // map.put(contextual, new Wrapper(creationalContext, o)); o = null; } return o; } @Override public boolean isActive() { // TODO How should this be determined? return true; } static class Wrapper { int counter; CreationalContext creationalContext; T object; Wrapper(CreationalContext creationalContext, T object) { this.creationalContext = creationalContext; this.object = object; counter = 1; } } } PlannedObsolescenceExtension.java000066400000000000000000000013121225215345600444250ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/extension/scopepackage org.jboss.resteasy.cdi.extension.scope; import javax.enterprise.event.Observes; import javax.enterprise.inject.spi.AfterBeanDiscovery; import javax.enterprise.inject.spi.BeforeBeanDiscovery; import javax.enterprise.inject.spi.Extension; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright Jun 11, 2012 */ public class PlannedObsolescenceExtension implements Extension { void beforeBeanDiscovery(@Observes BeforeBeanDiscovery event) { event.addScope(PlannedObsolescenceScope.class, true, false); } void afterBeanDiscovery(@Observes AfterBeanDiscovery event) { event.addContext(new PlannedObsolescenceContext()); } } PlannedObsolescenceScope.java000066400000000000000000000013721225215345600435300ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/extension/scopepackage org.jboss.resteasy.cdi.extension.scope; import static java.lang.annotation.ElementType.FIELD; import static java.lang.annotation.ElementType.METHOD; import static java.lang.annotation.ElementType.TYPE; import static java.lang.annotation.RetentionPolicy.RUNTIME; import java.lang.annotation.Documented; import java.lang.annotation.Inherited; import java.lang.annotation.Retention; import java.lang.annotation.Target; import javax.enterprise.context.NormalScope; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright Jun 11, 2012 */ @Target( { TYPE, METHOD, FIELD }) @Retention(RUNTIME) @Documented @NormalScope @Inherited public @interface PlannedObsolescenceScope { int value() default 1; } package-info.java000066400000000000000000000003421225215345600411500ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/extension/scope/** * This package (along with @see org.jboss.resteasy.test.cdi.extension.scope) introduces an * application defined scope. * * @see org.jboss.resteasy.package-info.java */ package org.jboss.resteasy.cdi.extension.scope; 000077500000000000000000000000001225215345600342515ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/genericAnimal.java000066400000000000000000000002761225215345600363220ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/genericpackage org.jboss.resteasy.cdi.generic; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright Dec 14, 2012 */ public class Animal { } Australopithecus.java000066400000000000000000000003311225215345600404500ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/genericpackage org.jboss.resteasy.cdi.generic; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright Dec 14, 2012 */ public class Australopithecus extends Primate { } ConcreteDecorator.java000066400000000000000000000021241225215345600405200ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/genericpackage org.jboss.resteasy.cdi.generic; import java.util.logging.Logger; import javax.decorator.Decorator; import javax.decorator.Delegate; import javax.inject.Inject; import javax.ws.rs.core.Response; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright Dec 15, 2012 */ @Decorator public abstract class ConcreteDecorator implements ConcreteResourceIntf { @Inject private Logger log; private ConcreteResourceIntf resource; @Inject public ConcreteDecorator(@Delegate ConcreteResourceIntf resource) { this.resource = resource; System.out.println("ConcreteDecorator got delegate: " + resource); } @Override public Response execute() { log.info("entering ConcreteDecorator.execute()"); VisitList.add(VisitList.CONCRETE_DECORATOR_ENTER); Response response = resource.testGenerics(); VisitList.add(VisitList.CONCRETE_DECORATOR_LEAVE); log.info("leaving ConcreteDecorator.execute()"); return response; } @Override abstract public Response testDecorators(); } ConcreteResource.java000066400000000000000000000270031225215345600403700ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/genericpackage org.jboss.resteasy.cdi.generic; import java.util.ArrayList; import java.util.logging.Logger; import javax.enterprise.context.Dependent; import javax.inject.Inject; import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.core.Response; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright Dec 14, 2012 */ @Path("concrete") @Dependent public class ConcreteResource implements ConcreteResourceIntf { @Inject private Logger log; @SuppressWarnings("rawtypes") @Inject @HolderBinding ObjectHolder rawObject; @Inject @HolderBinding ObjectHolder wildcardObject; @Inject @HolderBinding ObjectHolder objectObject; @SuppressWarnings("rawtypes") @Inject @HolderBinding HierarchyHolder rawHierarchy; @Inject @HolderBinding HierarchyHolder wildcardHierarchy; @Inject @HolderBinding HierarchyHolder primateHierarchy; @Inject @HolderBinding HierarchyHolder lowerBoundHierarchy; @Inject @HolderBinding HierarchyHolder upperBoundHierarchy; @SuppressWarnings("rawtypes") @Inject @HolderBinding NestedHierarchyHolder rawNested; @Inject @HolderBinding NestedHierarchyHolder wildcardNested; @Inject @HolderBinding NestedHierarchyHolder> primateNested; @Inject @HolderBinding NestedHierarchyHolder> lowerBoundNested; @Inject @HolderBinding NestedHierarchyHolder> upperBoundNested; @SuppressWarnings("rawtypes") @Inject @HolderBinding UpperBoundHierarchyHolder rawUpperBound; @Inject @HolderBinding UpperBoundHierarchyHolder wildcardUpperBound; @Inject @HolderBinding UpperBoundHierarchyHolder> primateUpperBound; @Inject @HolderBinding UpperBoundHierarchyHolder> upperBoundUpperBound; @Inject @HolderBinding UpperBoundHierarchyHolder> lowerBoundUpperBound; @SuppressWarnings("rawtypes") @Inject @HolderBinding LowerBoundHierarchyHolder rawLowerBound; @Inject @HolderBinding LowerBoundHierarchyHolder wildcardLowerBound; @Inject @HolderBinding LowerBoundHierarchyHolder> primateLowerBound; @Inject @HolderBinding LowerBoundHierarchyHolder> upperBoundLowerBound; @Inject @HolderBinding LowerBoundHierarchyHolder> lowerBoundLowerBound; @Override @GET @Path("injection") public Response testGenerics() { log.info("entering ConcreteResource.testGenerics()"); log.info(rawObject.getTypeArgument().toString()); log.info(wildcardObject.getTypeArgument().toString()); log.info(objectObject.getTypeArgument().toString()); log.info(rawHierarchy.getTypeArgument().toString()); log.info(wildcardHierarchy.getTypeArgument().toString()); log.info(primateHierarchy.getTypeArgument().toString()); log.info(lowerBoundHierarchy.getTypeArgument().toString()); log.info(upperBoundHierarchy.getTypeArgument().toString()); log.info(rawNested.getTypeArgument().toString()); log.info(wildcardNested.getTypeArgument().toString()); log.info(primateNested.getTypeArgument().toString()); log.info(lowerBoundNested.getTypeArgument().toString()); log.info(upperBoundNested.getTypeArgument().toString()); log.info(rawUpperBound.getTypeArgument().toString()); log.info(wildcardUpperBound.getTypeArgument().toString()); log.info(primateUpperBound.getTypeArgument().toString()); log.info(lowerBoundUpperBound.getTypeArgument().toString()); log.info(upperBoundUpperBound.getTypeArgument().toString()); log.info(rawLowerBound.getTypeArgument().toString()); log.info(wildcardLowerBound.getTypeArgument().toString()); log.info(primateLowerBound.getTypeArgument().toString()); log.info(lowerBoundLowerBound.getTypeArgument().toString()); log.info(upperBoundLowerBound.getTypeArgument().toString()); boolean result = true; if (!rawObject.getTypeArgument().equals(Object.class)) { log.info("rawObject type argument class should be Object instead of " + rawObject.getTypeArgument()); result = false; } if (!wildcardObject.getTypeArgument().equals(Object.class)) { log.info("wildcardObject type argument class should be Object instead of " + wildcardObject.getTypeArgument()); result = false; } if (!objectObject.getTypeArgument().equals(Object.class)) { log.info("objectObject type argument class should be Object instead of " + objectObject.getTypeArgument()); result = false; } if (!rawHierarchy.getTypeArgument().equals(Primate.class)) { log.info("rawHierarchy type argument class should be Primate instead of " + rawHierarchy.getTypeArgument()); result = false; } if (!wildcardHierarchy.getTypeArgument().equals(Primate.class)) { log.info("wildcardHierarchy type argument class should be Primate instead of " + wildcardHierarchy.getTypeArgument()); result = false; } if (!primateHierarchy.getTypeArgument().equals(Primate.class)) { log.info("primateHierarchy type argument class should be Primate instead of " + primateHierarchy.getTypeArgument()); result = false; } if (!lowerBoundHierarchy.getTypeArgument().equals(Primate.class)) { log.info("lowerBoundHierarchy type argument class should be Primate instead of " + lowerBoundHierarchy.getTypeArgument()); result = false; } if (!upperBoundHierarchy.getTypeArgument().equals(Primate.class)) { log.info("upperBoundHierarchy type argument class should be Primate instead of " + upperBoundHierarchy.getTypeArgument()); result = false; } if (!rawNested.getTypeArgument().equals(Primate.class)) { log.info("rawNested type argument class should be Primate instead of " + rawNested.getTypeArgument()); result = false; } if (!wildcardNested.getTypeArgument().equals(Primate.class)) { log.info("wildcardNested type argument class should be Primate instead of " + wildcardNested.getTypeArgument()); result = false; } if (!primateNested.getTypeArgument().equals(Primate.class)) { log.info("primateNested type argument class should be Primate instead of " + primateNested.getTypeArgument()); result = false; } if (!lowerBoundNested.getTypeArgument().equals(Primate.class)) { log.info("lowerBoundNested type argument class should be Primate instead of " + lowerBoundNested.getTypeArgument()); result = false; } if (!upperBoundNested.getTypeArgument().equals(Primate.class)) { log.info("upperBoundNested type argument class should be Primate instead of " + upperBoundNested.getTypeArgument()); result = false; } if (!rawUpperBound.getTypeArgument().equals(Primate.class)) { log.info("rawUpperBound type argument class should be Primate instead of " + rawUpperBound.getTypeArgument()); result = false; } if (!wildcardUpperBound.getTypeArgument().equals(Primate.class)) { log.info("wildcardUpperBound type argument class should be Primate instead of " + wildcardUpperBound.getTypeArgument()); result = false; } if (!primateUpperBound.getTypeArgument().equals(Primate.class)) { log.info("primateUpperBound type argument class should be Primate instead of " + primateUpperBound.getTypeArgument()); result = false; } if (!lowerBoundUpperBound.getTypeArgument().equals(Primate.class)) { log.info("lowerBoundUpperBound type argument class should be Primate instead of " + lowerBoundUpperBound.getTypeArgument()); result = false; } if (!upperBoundUpperBound.getTypeArgument().equals(Primate.class)) { log.info("upperBoundUpperBound type argument class should be Primate instead of " + upperBoundUpperBound.getTypeArgument()); result = false; } if (!rawLowerBound.getTypeArgument().equals(Primate.class)) { log.info("rawLowerBound type argument class should be Primate instead of " + rawLowerBound.getTypeArgument()); result = false; } if (!wildcardLowerBound.getTypeArgument().equals(Primate.class)) { log.info("wildcardLowerBound type argument class should be Primate instead of " + wildcardLowerBound.getTypeArgument()); result = false; } if (!primateLowerBound.getTypeArgument().equals(Primate.class)) { log.info("primateLowerBound type argument class should be Primate instead of " + primateLowerBound.getTypeArgument()); result = false; } if (!lowerBoundLowerBound.getTypeArgument().equals(Primate.class)) { log.info("lowerBoundLowerBound type argument class should be Primate instead of " + lowerBoundLowerBound.getTypeArgument()); result = false; } if (!upperBoundLowerBound.getTypeArgument().equals(Primate.class)) { log.info("upperBoundLowerBound type argument class should be Primate instead of " + upperBoundLowerBound.getTypeArgument()); result = false; } return result ? Response.ok().build() : Response.serverError().build(); } @GET @Path("decorators/clear") public Response clear() { log.info("entering ConcreteResource.clear()"); VisitList.clear(); return Response.ok().build(); } @GET @Path("decorators/execute") public Response execute() { log.info("entering ConcreteResource.execute()"); return Response.ok().build(); } @Override @GET @Path("decorators/test") public Response testDecorators() { log.info("entering ConcreteResource.testDecorators()"); ArrayList expectedList = new ArrayList(); expectedList.add(VisitList.CONCRETE_DECORATOR_ENTER); expectedList.add(VisitList.CONCRETE_DECORATOR_LEAVE); ArrayList visitList = VisitList.getList(); boolean status = expectedList.size() == visitList.size(); if (!status) { log.info("expectedList.size() [" + expectedList.size() + "] != visitList.size() [" + visitList.size() + "]"); } else { for (int i = 0; i < expectedList.size(); i++) { if (!expectedList.get(i).equals(visitList.get(i))) { status = false; log.info("visitList.get(" + i + ") incorrect: should be: " + expectedList.get(i) + ", is: " + visitList.get(i)); break; } } } if (!status) { log.info("\rexpectedList: "); for (int i = 0; i < expectedList.size(); i++) { log.info(i + ": " + expectedList.get(i).toString()); } log.info("\rvisitList:"); for (int i = 0; i < visitList.size(); i++) { log.info(i + ": " + visitList.get(i).toString()); } } return status == true ? Response.ok().build() : Response.serverError().build(); } } ConcreteResourceIntf.java000066400000000000000000000011351225215345600412070ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/genericpackage org.jboss.resteasy.cdi.generic; import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.core.Response; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright Dec 16, 2012 */ public interface ConcreteResourceIntf { @GET @Path("injection") public abstract Response testGenerics(); @GET @Path("decorators/clear") public abstract Response clear(); @GET @Path("decorators/execute") public abstract Response execute(); @GET @Path("decorators/test") public abstract Response testDecorators(); }GenericsProducer.java000066400000000000000000000046501225215345600403640ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/genericpackage org.jboss.resteasy.cdi.generic; import java.util.logging.Logger; import javax.enterprise.context.ApplicationScoped; import javax.enterprise.context.RequestScoped; import javax.enterprise.inject.Default; import javax.enterprise.inject.Produces; import javax.inject.Inject; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright Dec 14, 2012 * * @see https://community.jboss.org/message/784561#784561 */ @ApplicationScoped @SuppressWarnings("unused") public class GenericsProducer { @Inject private Logger log; @Produces @HolderBinding private ObjectHolder oh = new ObjectHolder(Object.class); @Produces @HolderBinding private HierarchyHolder hh = new HierarchyHolder(Primate.class); @Produces @HolderBinding private NestedHierarchyHolder> nhh = new NestedHierarchyHolder>(Primate.class); @Produces @HolderBinding private UpperBoundHierarchyHolder> ubhh = new UpperBoundHierarchyHolder>(Primate.class); @Produces @HolderBinding private LowerBoundHierarchyHolder> lbhh = new LowerBoundHierarchyHolder>(Primate.class); @Produces @ResourceBinding private UpperBoundTypedResource> ubhhr = new UpperBoundTypedResource>(Primate.class); @Produces @ResourceBinding private LowerBoundTypedResource> lbhhr = new LowerBoundTypedResource>(Primate.class); // @Produces // @RequestScoped //// @ResourceBinding // private UpperBoundTypedResource> upperBoundProducer() // { // UpperBoundTypedResource> ubhhr = new UpperBoundTypedResource>(Primate.class); // System.out.println("GenericsProducer.upperBoundProducer() created: " + ubhhr); // return ubhhr; // } // // @Produces //// @ResourceBinding // private LowerBoundTypedResource> lowerBoundProducer() // { // LowerBoundTypedResource> lbhhr = new LowerBoundTypedResource>(Primate.class); // System.out.println("GenericsProducer.lowerBoundProducer() created: " + lbhhr); // return lbhhr; // } } HierarchyHolder.java000066400000000000000000000007041225215345600401710ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/genericpackage org.jboss.resteasy.cdi.generic; import java.lang.reflect.Type; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright Dec 14, 2012 */ public class HierarchyHolder { private Class clazz; public HierarchyHolder() { } public HierarchyHolder(Class clazz) { this.clazz = clazz; } public Type getTypeArgument() { return clazz; } } HierarchyTypedResource.java000066400000000000000000000050761225215345600415600ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/genericpackage org.jboss.resteasy.cdi.generic; import java.util.ArrayList; import java.util.logging.Logger; import javax.enterprise.context.Dependent; import javax.inject.Inject; import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.core.Response; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright Dec 14, 2012 */ @Path("hierarchy") @Dependent public class HierarchyTypedResource implements HierarchyTypedResourceIntf { @Inject private Logger log; @Inject @HolderBinding HierarchyHolder typeParameterHierarchy; @Override @GET @Path("injection") public Response testGenerics() { log.info("entering HierarchyTypedResource.testGenerics()"); log.info(typeParameterHierarchy.getTypeArgument().toString()); boolean result = true; if (!typeParameterHierarchy.getTypeArgument().equals(Primate.class)) { log.info("typeParameterHierarchy type argument class should be Primate instead of " + typeParameterHierarchy.getTypeArgument()); result = false; } return result ? Response.ok().build() : Response.serverError().build(); } @Override @GET @Path("decorators") public Response testDecorators() { ArrayList expectedList = new ArrayList(); expectedList.add(VisitList.CONCRETE_DECORATOR_ENTER); expectedList.add(VisitList.CONCRETE_DECORATOR_LEAVE); ArrayList visitList = VisitList.getList(); boolean status = expectedList.size() == visitList.size(); if (!status) { log.info("expectedList.size() [" + expectedList.size() + "] != visitList.size() [" + visitList.size() + "]"); } else { for (int i = 0; i < expectedList.size(); i++) { if (!expectedList.get(i).equals(visitList.get(i))) { status = false; log.info("visitList.get(" + i + ") incorrect: should be: " + expectedList.get(i) + ", is: " + visitList.get(i)); break; } } } if (!status) { log.info("\rexpectedList: "); for (int i = 0; i < expectedList.size(); i++) { log.info(i + ": " + expectedList.get(i).toString()); } log.info("\rvisitList:"); for (int i = 0; i < visitList.size(); i++) { log.info(i + ": " + visitList.get(i).toString()); } } return status == true ? Response.ok().build() : Response.serverError().build(); } } HierarchyTypedResourceIntf.java000066400000000000000000000007231225215345600423730ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/genericpackage org.jboss.resteasy.cdi.generic; import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.core.Response; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright Dec 16, 2012 */ public interface HierarchyTypedResourceIntf { @GET @Path("injection") public abstract Response testGenerics(); @GET @Path("decorators") public abstract Response testDecorators(); }HolderBinding.java000066400000000000000000000012351225215345600376250ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/genericpackage org.jboss.resteasy.cdi.generic; import static java.lang.annotation.ElementType.FIELD; import static java.lang.annotation.ElementType.METHOD; import static java.lang.annotation.ElementType.PARAMETER; import static java.lang.annotation.ElementType.TYPE; import static java.lang.annotation.RetentionPolicy.RUNTIME; import java.lang.annotation.Retention; import java.lang.annotation.Target; import javax.inject.Qualifier; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright Dec 18, 2012 */ @Qualifier @Retention(RUNTIME) @Target({METHOD, FIELD, PARAMETER, TYPE}) public @interface HolderBinding { } JaxRsActivator.java000066400000000000000000000007771225215345600400330ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/genericpackage org.jboss.resteasy.cdi.generic; import javax.ws.rs.ApplicationPath; import javax.ws.rs.core.Application; /** * A class extending {@link Application} and annotated with @ApplicationPath is the Java EE 6 * "no XML" approach to activating JAX-RS. * *

* Resources are served relative to the servlet path specified in the {@link ApplicationPath} * annotation. *

*/ @ApplicationPath("/rest") public class JaxRsActivator extends Application { /* class body intentionally left blank */ } LowerBoundDecorator.java000066400000000000000000000025511225215345600410420ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/genericpackage org.jboss.resteasy.cdi.generic; import java.util.logging.Logger; import javax.decorator.Decorator; import javax.decorator.Delegate; import javax.inject.Inject; import javax.ws.rs.core.Response; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright Dec 15, 2012 * * @see https://community.jboss.org/message/784561#784561 */ @Decorator public abstract class LowerBoundDecorator> implements LowerBoundTypedResourceIntf { @Inject private Logger log; private LowerBoundTypedResource resource; @Inject public LowerBoundDecorator(@Delegate LowerBoundTypedResource resource) // public LowerBoundDecorator(@Delegate @ResourceBinding LowerBoundTypedResource resource) { this.resource = resource; System.out.println("LowerBoundDecorator got delegate: " + resource); } @Override public Response execute() { log.info("entering LowerBoundDecorator.execute()"); log.info("delegate: " + resource); log.info("type argument: " + resource.getTypeArgument()); VisitList.add(VisitList.LOWER_BOUND_DECORATOR_ENTER); Response response = resource.execute(); VisitList.add(VisitList.LOWER_BOUND_DECORATOR_LEAVE); log.info("leaving LowerBoundDecorator.execute()"); return response; } } LowerBoundHierarchyHolder.java000066400000000000000000000007151225215345600421740ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/genericpackage org.jboss.resteasy.cdi.generic; import java.lang.reflect.Type; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright Dec 14, 2012 */ public class LowerBoundHierarchyHolder> { private Class clazz; public LowerBoundHierarchyHolder(Class clazz) { this.clazz = clazz; } Type getTypeArgument() { return clazz; } } LowerBoundTypedResource.java000066400000000000000000000066361225215345600417250ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/genericpackage org.jboss.resteasy.cdi.generic; import java.lang.reflect.Type; import java.util.ArrayList; import java.util.logging.Logger; import javax.enterprise.context.Dependent; import javax.inject.Inject; import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.core.Response; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright Dec 14, 2012 */ @Path("lowerbound") @Dependent public class LowerBoundTypedResource> implements LowerBoundTypedResourceIntf { @Inject private Logger log; @Inject @HolderBinding LowerBoundHierarchyHolder typeParameterLowerBound; private Class clazz; public LowerBoundTypedResource() { System.out.println("LowerBoundTypedResource(): " + this); } public LowerBoundTypedResource(Class clazz) { this.clazz = clazz; System.out.println("LowerBoundTypedResource(" + clazz + "): " + this); } public Type getTypeArgument() { return clazz; } @Override @GET @Path("injection") public Response testGenerics() { log.info("entering LowerBoundTypedResource.testGenerics()"); log.info(typeParameterLowerBound.getTypeArgument().toString()); boolean result = true; if (!typeParameterLowerBound.getTypeArgument().equals(Primate.class)) { log.info("typeParameterLowerBound type argument class should be Primate instead of " + typeParameterLowerBound.getTypeArgument()); result = false; } return result ? Response.ok().build() : Response.serverError().build(); } @GET @Path("decorators/clear") public Response clear() { System.out.println("entering UpperBoundTypedResource.clear()"); VisitList.clear(); return Response.ok().build(); } @GET @Path("decorators/execute") public Response execute() { System.out.println("entering UpperBoundTypedResource.execute()"); return Response.ok().build(); } @Override @GET @Path("decorators/test") public Response testDecorators() { ArrayList expectedList = new ArrayList(); expectedList.add(VisitList.LOWER_BOUND_DECORATOR_ENTER); expectedList.add(VisitList.LOWER_BOUND_DECORATOR_LEAVE); ArrayList visitList = VisitList.getList(); boolean status = expectedList.size() == visitList.size(); if (!status) { log.info("expectedList.size() [" + expectedList.size() + "] != visitList.size() [" + visitList.size() + "]"); } else { for (int i = 0; i < expectedList.size(); i++) { if (!expectedList.get(i).equals(visitList.get(i))) { status = false; log.info("visitList.get(" + i + ") incorrect: should be: " + expectedList.get(i) + ", is: " + visitList.get(i)); break; } } } if (!status) { log.info("\rexpectedList: "); for (int i = 0; i < expectedList.size(); i++) { log.info(i + ": " + expectedList.get(i).toString()); } log.info("\rvisitList:"); for (int i = 0; i < visitList.size(); i++) { log.info(i + ": " + visitList.get(i).toString()); } } return status == true ? Response.ok().build() : Response.serverError().build(); } } LowerBoundTypedResourceIntf.java000066400000000000000000000012201225215345600425260ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/genericpackage org.jboss.resteasy.cdi.generic; import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.core.Response; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright Dec 16, 2012 */ public interface LowerBoundTypedResourceIntf> { @GET @Path("injection") public abstract Response testGenerics(); @GET @Path("decorators/clear") public abstract Response clear(); @GET @Path("decorators/execute") public abstract Response execute(); @GET @Path("decorators/test") public abstract Response testDecorators(); }NestedHierarchyHolder.java000066400000000000000000000006341225215345600413360ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/genericpackage org.jboss.resteasy.cdi.generic; import java.lang.reflect.Type; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright Dec 14, 2012 */ public class NestedHierarchyHolder { private Class clazz; public NestedHierarchyHolder(Class clazz) { this.clazz = clazz; } Type getTypeArgument() { return clazz; } } NestedTypedResource.java000066400000000000000000000051041225215345600410540ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/genericpackage org.jboss.resteasy.cdi.generic; import java.util.ArrayList; import java.util.logging.Logger; import javax.enterprise.context.Dependent; import javax.inject.Inject; import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.core.Response; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright Dec 14, 2012 */ @Path("nested") @Dependent public class NestedTypedResource> implements NestedTypedResourceIntf { @Inject private Logger log; @Inject @HolderBinding NestedHierarchyHolder typeParameterNested; @Override @GET @Path("injection") public Response testGenerics() { log.info("entering NestedTypedResource.testGenerics()"); log.info(typeParameterNested.getTypeArgument().toString()); boolean result = true; if (!typeParameterNested.getTypeArgument().equals(Primate.class)) { log.info("typeParameterNested type argument class should be Primate instead of " + typeParameterNested.getTypeArgument()); result = false; } return result ? Response.ok().build() : Response.serverError().build(); } @Override @GET @Path("decorators") public Response testDecorators() { ArrayList expectedList = new ArrayList(); expectedList.add(VisitList.CONCRETE_DECORATOR_ENTER); expectedList.add(VisitList.CONCRETE_DECORATOR_LEAVE); ArrayList visitList = VisitList.getList(); boolean status = expectedList.size() == visitList.size(); if (!status) { log.info("expectedList.size() [" + expectedList.size() + "] != visitList.size() [" + visitList.size() + "]"); } else { for (int i = 0; i < expectedList.size(); i++) { if (!expectedList.get(i).equals(visitList.get(i))) { status = false; log.info("visitList.get(" + i + ") incorrect: should be: " + expectedList.get(i) + ", is: " + visitList.get(i)); break; } } } if (!status) { log.info("\rexpectedList: "); for (int i = 0; i < expectedList.size(); i++) { log.info(i + ": " + expectedList.get(i).toString()); } log.info("\rvisitList:"); for (int i = 0; i < visitList.size(); i++) { log.info(i + ": " + visitList.get(i).toString()); } } return status == true ? Response.ok().build() : Response.serverError().build(); } } NestedTypedResourceIntf.java000066400000000000000000000007541225215345600417030ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/genericpackage org.jboss.resteasy.cdi.generic; import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.core.Response; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright Dec 16, 2012 */ public interface NestedTypedResourceIntf> { @GET @Path("injection") public abstract Response testGenerics(); @GET @Path("decorators") public abstract Response testDecorators(); }ObjectHolder.java000066400000000000000000000006151225215345600374620ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/genericpackage org.jboss.resteasy.cdi.generic; import java.lang.reflect.Type; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright Dec 14, 2012 */ public class ObjectHolder { private Class clazz; public ObjectHolder(Class clazz) { this.clazz = clazz; } Type getTypeArgument() { return clazz; } } ObjectTypedResource.java000066400000000000000000000050351225215345600410430ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/genericpackage org.jboss.resteasy.cdi.generic; import java.util.ArrayList; import java.util.logging.Logger; import javax.enterprise.context.Dependent; import javax.inject.Inject; import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.core.Response; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright Dec 14, 2012 */ @Path("object") @Dependent public class ObjectTypedResource implements ObjectTypedResourceIntf { @Inject private Logger log; @Inject @HolderBinding ObjectHolder typeParameterObject; @Override @GET @Path("injection") public Response testGenerics() { log.info("entering ObjectTypedResource.testGenerics()"); log.info(typeParameterObject.getTypeArgument().toString()); boolean result = true; if (!typeParameterObject.getTypeArgument().equals(Object.class)) { log.info("typeParameterObject type argument class should be Object instead of " + typeParameterObject.getTypeArgument()); result = false; } return result ? Response.ok().build() : Response.serverError().build(); } @Override @GET @Path("decorators") public Response testDecorators() { ArrayList expectedList = new ArrayList(); expectedList.add(VisitList.CONCRETE_DECORATOR_ENTER); expectedList.add(VisitList.CONCRETE_DECORATOR_LEAVE); ArrayList visitList = VisitList.getList(); boolean status = expectedList.size() == visitList.size(); if (!status) { log.info("expectedList.size() [" + expectedList.size() + "] != visitList.size() [" + visitList.size() + "]"); } else { for (int i = 0; i < expectedList.size(); i++) { if (!expectedList.get(i).equals(visitList.get(i))) { status = false; log.info("visitList.get(" + i + ") incorrect: should be: " + expectedList.get(i) + ", is: " + visitList.get(i)); break; } } } if (!status) { log.info("\rexpectedList: "); for (int i = 0; i < expectedList.size(); i++) { log.info(i + ": " + expectedList.get(i).toString()); } log.info("\rvisitList:"); for (int i = 0; i < visitList.size(); i++) { log.info(i + ": " + visitList.get(i).toString()); } } return status == true ? Response.ok().build() : Response.serverError().build(); } } ObjectTypedResourceIntf.java000066400000000000000000000007201225215345600416600ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/genericpackage org.jboss.resteasy.cdi.generic; import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.core.Response; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright Dec 16, 2012 */ public interface ObjectTypedResourceIntf { @GET @Path("injection") public abstract Response testGenerics(); @GET @Path("decorators") public abstract Response testDecorators(); }Primate.java000066400000000000000000000003171225215345600365160ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/genericpackage org.jboss.resteasy.cdi.generic; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright Dec 14, 2012 */ public class Primate extends Animal { } ResourceBinding.java000066400000000000000000000012371225215345600402010ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/genericpackage org.jboss.resteasy.cdi.generic; import static java.lang.annotation.ElementType.FIELD; import static java.lang.annotation.ElementType.METHOD; import static java.lang.annotation.ElementType.PARAMETER; import static java.lang.annotation.ElementType.TYPE; import static java.lang.annotation.RetentionPolicy.RUNTIME; import java.lang.annotation.Retention; import java.lang.annotation.Target; import javax.inject.Qualifier; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright Dec 14, 2012 */ @Qualifier @Retention(RUNTIME) @Target({METHOD, FIELD, PARAMETER, TYPE}) public @interface ResourceBinding { } UpperBoundDecorator.java000066400000000000000000000025531225215345600410470ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/genericpackage org.jboss.resteasy.cdi.generic; import java.util.logging.Logger; import javax.decorator.Decorator; import javax.decorator.Delegate; import javax.inject.Inject; import javax.ws.rs.core.Response; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright Dec 15, 2012 * * @see https://community.jboss.org/message/784561#784561 */ @Decorator public abstract class UpperBoundDecorator> implements UpperBoundTypedResourceIntf { @Inject private Logger log; private UpperBoundTypedResource resource; @Inject public UpperBoundDecorator(@Delegate UpperBoundTypedResource resource) // public UpperBoundDecorator(@Delegate @ResourceBinding UpperBoundTypedResource resource) { this.resource = resource; System.out.println("UpperBoundDecorator got delegate: " + resource); } @Override public Response execute() { log.info("entering UpperBoundDecorator.execute()"); log.info("delegate: " + resource); log.info("type argument: " + resource.getTypeArgument()); VisitList.add(VisitList.UPPER_BOUND_DECORATOR_ENTER); Response response = resource.execute(); VisitList.add(VisitList.UPPER_BOUND_DECORATOR_LEAVE); log.info("leaving UpperBoundDecorator.execute()"); return response; } } UpperBoundHierarchyHolder.java000066400000000000000000000007171225215345600422010ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/genericpackage org.jboss.resteasy.cdi.generic; import java.lang.reflect.Type; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright Dec 14, 2012 */ public class UpperBoundHierarchyHolder> { private Class clazz; public UpperBoundHierarchyHolder(Class clazz) { this.clazz = clazz; } Type getTypeArgument() { return clazz; } } UpperBoundTypedResource.java000066400000000000000000000067571225215345600417340ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/genericpackage org.jboss.resteasy.cdi.generic; import java.lang.reflect.Type; import java.util.ArrayList; import java.util.logging.Logger; import javax.enterprise.context.Dependent; import javax.inject.Inject; import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.core.Response; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright Dec 14, 2012 */ @Path("upperbound") @Dependent //@ResourceBinding public class UpperBoundTypedResource> implements UpperBoundTypedResourceIntf { @Inject private Logger log; @Inject @HolderBinding private UpperBoundHierarchyHolder typeParameterUpperBound; private Class clazz; public UpperBoundTypedResource() { System.out.println("UpperBoundTypedResource(): " + this); } public UpperBoundTypedResource(Class clazz) { this.clazz = clazz; System.out.println("UpperBoundTypedResource(" + clazz + "): " + this); } public Type getTypeArgument() { return clazz; } @Override @GET @Path("injection") public Response testGenerics() { log.info("entering UpperBoundTypedResource.testGenerics()"); log.info(typeParameterUpperBound.getTypeArgument().toString()); boolean result = true; if (!typeParameterUpperBound.getTypeArgument().equals(Primate.class)) { log.info("typeParameterUpperBound type argument class should be Primate instead of " + typeParameterUpperBound.getTypeArgument()); result = false; } return result ? Response.ok().build() : Response.serverError().build(); } @GET @Path("decorators/clear") public Response clear() { log.info("entering UpperBoundTypedResource.clear()"); VisitList.clear(); return Response.ok().build(); } @GET @Path("decorators/execute") public Response execute() { log.info("entering UpperBoundTypedResource.execute()"); return Response.ok().build(); } @Override @GET @Path("decorators/test") public Response testDecorators() { log.info("entering UpperBoundTypedResource.testDecorators()"); ArrayList expectedList = new ArrayList(); expectedList.add(VisitList.UPPER_BOUND_DECORATOR_ENTER); expectedList.add(VisitList.UPPER_BOUND_DECORATOR_LEAVE); ArrayList visitList = VisitList.getList(); boolean status = expectedList.size() == visitList.size(); if (!status) { log.info("expectedList.size() [" + expectedList.size() + "] != visitList.size() [" + visitList.size() + "]"); } else { for (int i = 0; i < expectedList.size(); i++) { if (!expectedList.get(i).equals(visitList.get(i))) { status = false; log.info("visitList.get(" + i + ") incorrect: should be: " + expectedList.get(i) + ", is: " + visitList.get(i)); break; } } } if (!status) { log.info("\rexpectedList: "); for (int i = 0; i < expectedList.size(); i++) { log.info(i + ": " + expectedList.get(i).toString()); } log.info("\rvisitList:"); for (int i = 0; i < visitList.size(); i++) { log.info(i + ": " + visitList.get(i).toString()); } } return status == true ? Response.ok().build() : Response.serverError().build(); } } UpperBoundTypedResourceIntf.java000066400000000000000000000012221225215345600425330ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/genericpackage org.jboss.resteasy.cdi.generic; import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.core.Response; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright Dec 16, 2012 */ public interface UpperBoundTypedResourceIntf> { @GET @Path("injection") public abstract Response testGenerics(); @GET @Path("decorators/clear") public abstract Response clear(); @GET @Path("decorators/execute") public abstract Response execute(); @GET @Path("decorators/test") public abstract Response testDecorators(); }VisitList.java000066400000000000000000000020531225215345600370460ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/genericpackage org.jboss.resteasy.cdi.generic; import java.util.ArrayList; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright Nov 14, 2012 */ public class VisitList { static final public String CONCRETE_DECORATOR_ENTER = "concreteDecoratorEnter"; static final public String CONCRETE_DECORATOR_LEAVE = "concreteDecoratorLeave"; static final public String UPPER_BOUND_DECORATOR_ENTER = "upperBoundDecoratorEnter"; static final public String UPPER_BOUND_DECORATOR_LEAVE = "upperBoundDecoratorLeave"; static final public String LOWER_BOUND_DECORATOR_ENTER = "lowerBoundDecoratorEnter"; static final public String LOWER_BOUND_DECORATOR_LEAVE = "lowerBoundDecoratorLeave"; static private ArrayList visitList = new ArrayList(); static public void add(String o) { visitList.add(o); } static public ArrayList getList() { return new ArrayList(visitList); } static public void clear() { visitList.clear(); } } package-info.java000066400000000000000000000003751225215345600374450ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/generic/** * This package (along with @see org.jboss.resteasy.test.cdi.generic) tests injection * with parameterized required types and/or parameterized bean types. * * @see org.jboss.resteasy.package-info.java */ package org.jboss.resteasy.cdi.generic; 000077500000000000000000000000001225215345600351325ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/inheritenceBook.java000066400000000000000000000006261225215345600366730ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/inheritencepackage org.jboss.resteasy.cdi.inheritence; /** * An instance of this class will be injected into the Book injection point in InheritenceResource * if no alternatives are enabled. * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright Dec 5, 2012 */ @SelectBook public class Book { public Class getType() { return this.getClass(); } } BookSelectedAlternative.java000066400000000000000000000005511225215345600425400ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/inheritencepackage org.jboss.resteasy.cdi.inheritence; /** * If this class is enabled, it will be injected into the Book injection point in InheritanceResource. * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright Dec 5, 2012 */ @StereotypeAlternative @SelectBook public class BookSelectedAlternative extends Book { } BookSpecialized.java000066400000000000000000000006171225215345600410500ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/inheritencepackage org.jboss.resteasy.cdi.inheritence; import javax.enterprise.inject.Specializes; /** * If this class is enabled, it will be injected into the Book injection point in InheritanceResource. * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright Dec 5, 2012 */ @Specializes @StereotypeAlternative public class BookSpecialized extends Book { } BookVanillaAlternative.java000066400000000000000000000006541225215345600424020ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/inheritencepackage org.jboss.resteasy.cdi.inheritence; /** * This class is never used, because the Book injection point in InheritanceResource uses the * @SelectBook qualifier. Even if this alternative is enabled, a Book will be injected. * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright Dec 5, 2012 */ @StereotypeAlternative public class BookVanillaAlternative extends Book { } InheritanceResource.java000066400000000000000000000037731225215345600417500ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/inheritencepackage org.jboss.resteasy.cdi.inheritence; import java.util.logging.Logger; import javax.enterprise.context.RequestScoped; import javax.inject.Inject; import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.Produces; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright Dec 5, 2012 */ @Path("/") @RequestScoped public class InheritanceResource { @Inject private Logger log; @Inject @SelectBook private Book book; @GET @Path("vanilla") @Produces(MediaType.TEXT_PLAIN) public Response vanilla() { log.info("vanilla(): book is " + book.getClass()); if (book.getClass().equals(Book.class)) { return Response.ok().build(); } else { return Response.serverError().build(); } } @GET @Path("alternative/vanilla") @Produces(MediaType.TEXT_PLAIN) public Response alternativeVanilla() { log.info("alternativeVanilla(): book is " + book.getClass()); if (book.getClass().equals(Book.class)) { return Response.ok().build(); } else { return Response.serverError().build(); } } @GET @Path("alternative/selected") @Produces(MediaType.TEXT_PLAIN) public Response alternativeSelected() { log.info("alternativeSelected(): book is " + book.getClass()); if (book.getClass().equals(BookSelectedAlternative.class)) { return Response.ok().build(); } else { return Response.serverError().build(); } } @GET @Path("specialized") @Produces(MediaType.TEXT_PLAIN) public Response specialized() { log.info("specialized(): book is " + book.getClass()); if (book.getClass().equals(BookSpecialized.class)) { return Response.ok().build(); } else { return Response.serverError().build(); } } } JaxRsActivator.java000066400000000000000000000010031225215345600406730ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/inheritencepackage org.jboss.resteasy.cdi.inheritence; import javax.ws.rs.ApplicationPath; import javax.ws.rs.core.Application; /** * A class extending {@link Application} and annotated with @ApplicationPath is the Java EE 6 * "no XML" approach to activating JAX-RS. * *

* Resources are served relative to the servlet path specified in the {@link ApplicationPath} * annotation. *

*/ @ApplicationPath("/rest") public class JaxRsActivator extends Application { /* class body intentionally left blank */ } SelectBook.java000066400000000000000000000012351225215345600400300ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/inheritencepackage org.jboss.resteasy.cdi.inheritence; import static java.lang.annotation.ElementType.FIELD; import static java.lang.annotation.ElementType.METHOD; import static java.lang.annotation.ElementType.PARAMETER; import static java.lang.annotation.ElementType.TYPE; import static java.lang.annotation.RetentionPolicy.RUNTIME; import java.lang.annotation.Retention; import java.lang.annotation.Target; import javax.inject.Qualifier; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright Dec 5, 2012 */ @Qualifier @Retention(RUNTIME) @Target({METHOD, FIELD, PARAMETER, TYPE}) public @interface SelectBook { } StereotypeAlternative.java000066400000000000000000000010471225215345600423410ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/inheritencepackage org.jboss.resteasy.cdi.inheritence; import static java.lang.annotation.ElementType.TYPE; import static java.lang.annotation.RetentionPolicy.RUNTIME; import java.lang.annotation.Retention; import java.lang.annotation.Target; import javax.enterprise.inject.Alternative; import javax.enterprise.inject.Stereotype; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright Dec 5, 2012 */ @Alternative @Stereotype @Target(TYPE) @Retention(RUNTIME) public @interface StereotypeAlternative { } package-info.java000066400000000000000000000003621225215345600403220ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/inheritence/** * This package (along with @see org.jboss.resteasy.test.cdi.inheritence) tests alternatives, * alternative stereotypes, and specialization. * * @see org.jboss.resteasy.package-info.java */ package org.jboss.resteasy.cdi.inheritence; 000077500000000000000000000000001225215345600346175ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/injectionBook.java000066400000000000000000000027571225215345600363670ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/injectionpackage org.jboss.resteasy.cdi.injection; import javax.persistence.Entity; import javax.persistence.Id; import javax.validation.constraints.NotNull; import javax.validation.constraints.Size; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; /** * Book is * * 1) a JAXB class, suitable for transport over the network, and * 2) an @Entity class, suitable for JPA storage * * @author Ron Sigal * @version $Revision: 1 $ */ @Entity @XmlRootElement(name = "book") @XmlAccessorType(XmlAccessType.FIELD) public class Book { @XmlElement private int id; @XmlElement @NotNull @Size(min = 1, max = 25) private String name; public Book() { } public Book(String name) { this.name = name; } public Book(int id, String name) { this.id = id; this.name = name; } @Id public int getId() { return id; } public void setId(int id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String toString() { return "Book[" + id + "," + name + "]"; } public boolean equals(Object o) { if (o == null || ! (o instanceof Book)) { return false; } return name.equals(((Book) o).name); } } BookBag.java000066400000000000000000000011171225215345600367660ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/injectionpackage org.jboss.resteasy.cdi.injection; import java.util.Collection; import java.util.HashSet; import javax.ejb.Stateful; import javax.enterprise.context.SessionScoped; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright May 26, 2012 */ @Stateful @SessionScoped public class BookBag implements BookBagLocal { private HashSet books = new HashSet(); public void addBook(Book book) { books.add(book); } public Collection getContents() { return new HashSet(books); } } BookBagLocal.java000066400000000000000000000005261225215345600377440ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/injectionpackage org.jboss.resteasy.cdi.injection; import java.util.Collection; import javax.ejb.Local; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright May 26, 2012 */ @Local public interface BookBagLocal { public void addBook(Book book); public Collection getContents(); } BookCollection.java000066400000000000000000000017741225215345600404010ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/injectionpackage org.jboss.resteasy.cdi.injection; import java.util.Collection; import java.util.logging.Logger; import javax.ejb.Singleton; import javax.enterprise.context.ApplicationScoped; import javax.inject.Inject; import javax.persistence.EntityManager; import javax.persistence.PersistenceContext; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright May 8, 2012 */ @Singleton @ApplicationScoped public class BookCollection { @ResourceBinding @PersistenceContext(unitName="test") EntityManager em; @Inject Logger log; public void addBook(Book book) { em.persist(book); log.info("persisted: " + book); } public Book getBook(int id) { return em.find(Book.class, id); } public Collection getBooks() { return em.createQuery("SELECT b FROM Book AS b", Book.class).getResultList(); } public void empty() { em.createQuery("delete from Book").executeUpdate(); } } BookMDB.java000066400000000000000000000032311225215345600366760ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/injectionpackage org.jboss.resteasy.cdi.injection; import java.util.concurrent.CountDownLatch; import java.util.logging.Logger; import javax.ejb.ActivationConfigProperty; import javax.ejb.MessageDriven; import javax.inject.Inject; import javax.jms.JMSException; import javax.jms.Message; import javax.jms.MessageListener; import javax.jms.TextMessage; import org.jboss.resteasy.cdi.util.Counter; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright May 28, 2012 */ @MessageDriven(name = "BookMDB", activationConfig = {@ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue"), @ActivationConfigProperty(propertyName = "destination", propertyValue = "queue/test")} ) public class BookMDB implements MessageListener { @Inject private Logger log; @Inject private BookResource resource; public void onMessage(Message arg0) { TextMessage tm = TextMessage.class.cast(arg0); try { log.info(this + ": msg: " + tm.getText()); BookCollection collection = resource.getBookCollection(); log.info(this + ": collection.size() before: " + collection.getBooks().size()); Counter counter = resource.getCounter(); collection.addBook(new Book(counter.getNext(), tm.getText())); log.info(this + ": collection.size() after: " + collection.getBooks().size()); CountDownLatch latch = resource.getCountDownLatch(); latch.countDown(); // Tell BookResource book has been stored. } catch (JMSException e) { e.printStackTrace(); } } } BookReader.java000066400000000000000000000040671225215345600375060ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/injectionpackage org.jboss.resteasy.cdi.injection; import java.io.IOException; import java.io.InputStream; import java.lang.annotation.Annotation; import java.lang.reflect.Type; import java.util.logging.Logger; import javax.inject.Inject; import javax.ws.rs.Consumes; import javax.ws.rs.WebApplicationException; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.MultivaluedMap; import javax.ws.rs.ext.MessageBodyReader; import javax.ws.rs.ext.Provider; import org.jboss.resteasy.cdi.util.Constants; import org.jboss.resteasy.spi.ResteasyProviderFactory; /** * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright May 8, 2012 */ @Provider @Consumes(Constants.MEDIA_TYPE_TEST_XML) public class BookReader implements MessageBodyReader { static private MessageBodyReader delegate; @Inject private Logger log; @Inject private DependentScoped dependent; @Inject private StatefulEJB stateful; static { System.out.println("In BookReader static {}"); ResteasyProviderFactory factory = ResteasyProviderFactory.getInstance(); delegate = factory.getMessageBodyReader(Book.class, null, null, Constants.MEDIA_TYPE_TEST_XML_TYPE); System.out.println("In BookReader static {}"); } public BookReader() { System.out.println("entered BookReader()"); } public boolean isReadable(Class type, Type genericType, Annotation[] annotations, MediaType mediaType) { return Book.class.equals(type); } public Book readFrom(Class type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap httpHeaders, InputStream entityStream) throws IOException, WebApplicationException { log.info("entering BookReader.readFrom()"); return Book.class.cast(delegate.readFrom(Book.class, genericType, annotations, mediaType, httpHeaders, entityStream)); } public DependentScoped getDependent() { return dependent; } public StatefulEJB getStateful() { return stateful; } } BookResource.java000066400000000000000000000460111225215345600400660ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/injectionpackage org.jboss.resteasy.cdi.injection; import java.lang.annotation.Annotation; import java.util.Collection; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; import java.util.Set; import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicInteger; import java.util.logging.Logger; import javax.annotation.PostConstruct; import javax.annotation.PreDestroy; import javax.ejb.EJB; import javax.enterprise.context.ApplicationScoped; import javax.enterprise.context.Dependent; import javax.enterprise.context.RequestScoped; import javax.enterprise.context.SessionScoped; import javax.enterprise.inject.Instance; import javax.enterprise.inject.New; import javax.enterprise.inject.spi.Bean; import javax.enterprise.inject.spi.BeanManager; import javax.inject.Inject; import javax.jms.DeliveryMode; import javax.jms.JMSException; import javax.jms.MessageConsumer; import javax.jms.MessageProducer; import javax.jms.Queue; import javax.jms.Session; import javax.jms.TextMessage; import javax.persistence.EntityManager; import javax.persistence.PersistenceContext; import javax.servlet.http.HttpServletRequest; import javax.ws.rs.Consumes; import javax.ws.rs.GET; import javax.ws.rs.POST; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.Produces; import javax.ws.rs.WebApplicationException; import javax.ws.rs.core.Context; import javax.ws.rs.core.GenericEntity; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import org.jboss.resteasy.cdi.util.Constants; import org.jboss.resteasy.cdi.util.Counter; import org.jboss.resteasy.cdi.util.CounterBinding; import org.jboss.resteasy.spi.ResteasyProviderFactory; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright May 7, 2012 */ @Path("/") @RequestScoped public class BookResource { public static final String BOOK_READER = "BookReader"; public static final String BOOK_WRITER = "BookWriter"; public static final String BOOK_RESOURCE = "BookResource"; public static final String BOOK_READER_DEPENDENT = "BookReaderDependent"; public static final String BOOK_WRITER_DEPENDENT = "BookWriterDependent"; public static final String BOOK_RESOURCE_DEPENDENT = "BookResourceDependent"; public static final String BOOK_READER_STATEFUL = "BookReaderStateless"; public static final String BOOK_WRITER_STATEFUL = "BookWriterStateless"; public static final String BOOK_RESOURCE_STATEFUL = "BookResourceStateless"; public static final String BOOK_RESOURCE_STATEFUL2 = "BookResourceStateless2"; public static final String COUNTER = "counter"; public static final String COLLECTION = "collection"; public static final String BOOK_BAG = "bookBag"; public static final String NEW_BEAN_APPLICATION_SCOPED = "newBeanApplicationScoped"; public static final String NEW_BEAN_DEPENDENT_SCOPED = "newBeanDependentScoped"; public static final String STEREOTYPED_APPLICATION_SCOPED = "stereotypedApplicationScoped"; public static final String STEREOTYPED_DEPENDENT_SCOPED = "stereotypedDependentScoped"; private static HashMap store; public static HashMap getStore() { return store; } public static void setStore(HashMap store) { BookResource.store = store; } private HashSet set = new HashSet(); public HashSet getSet() { return set; } public void setSet(HashSet set) { this.set = set; } private static AtomicInteger constructCounter = new AtomicInteger(); private static AtomicInteger destroyCounter = new AtomicInteger(); @PreDestroy public void preDestroy() { destroyCounter.incrementAndGet(); log.info("preDestroy(): destroyCounter: " + destroyCounter.get()); } @PostConstruct public void postConstruct() { constructCounter.incrementAndGet(); log.info("postConstruct(): constructCounter: " + constructCounter.get()); } private static CountDownLatch latch = new CountDownLatch(2); public CountDownLatch getCountDownLatch() { log.info("latch.getCount(): " + latch.getCount()); return latch; } @Inject private BeanManager beanManager; @Inject private int secret; // used to determine identity @Inject private DependentScoped dependent; // dependent scoped managed bean @Inject @CounterBinding private Counter counter; // application scoped singleton: injected as Weld proxy @EJB private BookCollection collection; // application scoped singleton: injected as EJB proxy // @Note: stateful and stateful2 are two very different objects. // stateful is an EJB proxy and stateful2 is a Weld proxy. @EJB private StatefulEJB stateful; // dependent scoped SLSB @Inject private StatefulEJB stateful2; // dependent scoped SLSB @Inject private BookBagLocal bookBag; // session scoped SFSB @Inject @ResourceBinding @PersistenceContext(unitName="test") EntityManager em; @Inject @ResourceBinding private Session session; @Inject @ResourceBinding private Queue bookQueue; @Inject private NewBean newBean1; @Inject @New private NewBean newBean2; @Inject private StereotypedApplicationScope stereotypeApplicationScoped; @Inject private StereotypedDependentScope stereotypedRequestScoped; // @Inject // @ResourceBinding // private ConnectionFactory connectionFactory; // private Context applicationContext; // private Context requestContext; // private Context sessionContext; private Logger log; @Inject public void init(Instance logInstance) { this.log = logInstance.get(); } @GET @Path("verifyScopes") @Produces(MediaType.TEXT_PLAIN) public Response verifyScopes() { log.info("entering verifyScopes()"); ResteasyProviderFactory factory = ResteasyProviderFactory.getInstance(); BookReader reader = BookReader.class.cast(factory.getMessageBodyReader(Book.class, null, null, Constants.MEDIA_TYPE_TEST_XML_TYPE)); BookWriter writer = BookWriter.class.cast(factory.getMessageBodyWriter(Book.class, null, null, Constants.MEDIA_TYPE_TEST_XML_TYPE)); if (store == null) { log.info("Counter scope: " + getScope(Counter.class)); log.info("BookCollection scope: " + getScope(BookCollection.class)); log.info("BookResource scope: " + getScope(BookResource.class)); log.info("BookReader scope: " + getScope(BookReader.class)); log.info("BookWriter scope: " + getScope(BookWriter.class)); log.info("UnscopedResource scope: " + getScope(UnscopedResource.class)); log.info("DependentScoped scope: " + getScope(DependentScoped.class)); log.info("StatelessEJB scope: " + getScope(StatefulEJB.class)); log.info("BookBagLocal scope: " + getScope(BookBagLocal.class)); // log.info("BookMDB scope: " + getScope(BookMDB.class)); log.info("NewBean scope: " + getScope(NewBean.class)); log.info("stereotypeApplicationScoped: " + getScope(StereotypedApplicationScope.class)); log.info("stereotypeRequestScoped: " + getScope(StereotypedDependentScope.class)); store = new HashMap(); store.put(BOOK_READER, reader); store.put(BOOK_WRITER, writer); store.put(BOOK_RESOURCE, this); store.put(BOOK_READER_DEPENDENT, reader.getDependent()); store.put(BOOK_WRITER_DEPENDENT, writer.getDependent()); store.put(BOOK_RESOURCE_DEPENDENT, dependent); store.put(BOOK_READER_STATEFUL, reader.getStateful()); store.put(BOOK_WRITER_STATEFUL, writer.getStateful()); store.put(BOOK_RESOURCE_STATEFUL, stateful); store.put(BOOK_RESOURCE_STATEFUL2, stateful2); store.put(COUNTER, counter); store.put(COLLECTION, collection); store.put(BOOK_BAG, bookBag); store.put(NEW_BEAN_APPLICATION_SCOPED, newBean1); store.put(NEW_BEAN_DEPENDENT_SCOPED, newBean2); store.put(STEREOTYPED_APPLICATION_SCOPED, stereotypeApplicationScoped); store.put(STEREOTYPED_DEPENDENT_SCOPED, stereotypedRequestScoped); return Response.ok().build(); } if (isApplicationScoped(Counter.class) && isApplicationScoped(BookCollection.class) && isApplicationScoped(BookReader.class) && isApplicationScoped(BookWriter.class) && isRequestScoped(BookResource.class) && isDependentScoped(DependentScoped.class) && isDependentScoped(StatefulEJB.class) && isRequestScoped(UnscopedResource.class) && isApplicationScoped(JaxRsActivator.class) && isSessionScoped(BookBagLocal.class) && isApplicationScoped(NewBean.class) && isApplicationScoped(StereotypedApplicationScope.class) && isDependentScoped(StereotypedDependentScope.class) && // getScope(BookMDB.class) == null && store.get(BOOK_READER) == reader && store.get(BOOK_WRITER) == writer && store.get(BOOK_RESOURCE) != this && store.get(BOOK_READER_DEPENDENT) == reader.getDependent() && store.get(BOOK_WRITER_DEPENDENT) == writer.getDependent() && store.get(BOOK_RESOURCE_DEPENDENT) != dependent && store.get(BOOK_READER_STATEFUL).equals(reader.getStateful()) && store.get(BOOK_WRITER_STATEFUL).equals(writer.getStateful()) && !store.get(BOOK_RESOURCE_STATEFUL).equals(stateful) && !store.get(BOOK_RESOURCE_STATEFUL2).equals(stateful2) && store.get(COUNTER).equals(counter) && store.get(COLLECTION).equals(collection) && store.get(BOOK_BAG).equals(bookBag) && store.get(NEW_BEAN_APPLICATION_SCOPED).equals(newBean1) && !store.get(NEW_BEAN_DEPENDENT_SCOPED).equals(newBean2) && !newBean1.equals(newBean2) && store.get(STEREOTYPED_APPLICATION_SCOPED).equals(stereotypeApplicationScoped) && !store.get(STEREOTYPED_DEPENDENT_SCOPED).equals(stereotypedRequestScoped) ) { return Response.ok().build(); } else { return Response.serverError().build(); } } @POST @Path("empty") public void empty() { collection.empty(); } @POST @Path("create") @Consumes("application/test+xml") @Produces(MediaType.TEXT_PLAIN) public Response createBook(Book book) { log.info("entering createBook()"); int id = counter.getNext(); book.setId(id); collection.addBook(book); log.info("stored: " + id + "->" + book); return Response.ok(id).build(); } @GET @Produces(MediaType.APPLICATION_XML) @Path("books") public Collection listAllMembers() { log.info("entering listAllMembers()"); log.info("this.theSecret(): " + this.theSecret()); Collection books = collection.getBooks(); log.info("listAllMembers(): " + books); return books; } @GET @Path("book/{id:[0-9][0-9]*}") @Produces("application/test+xml") public Book lookupBookById(@PathParam("id") int id) { log.info("entering lookupBookById(" + id + ")"); log.info("books: " + collection.getBooks()); Book book = collection.getBook(id); if (book == null) { throw new WebApplicationException(Response.Status.NOT_FOUND); } return book; } @POST @Path("entityManager") public Response testEntityManager() { log.info("entering testEntityManager()"); Book book1 = collection.getBook(Counter.INITIAL_VALUE); Book book2 = em.find(Book.class, Counter.INITIAL_VALUE); return book1.equals(book2) ? Response.ok().build() : Response.serverError().build(); } @POST @Path("session/add") public Response sessionAdd(@Context HttpServletRequest request, Book book) { log.info("entering sessionAdd()"); log.info("new session: " + request.getSession().isNew()); bookBag.addBook(book); return Response.ok().build(); } @GET @Path("session/get") @Produces(MediaType.APPLICATION_XML) public Collection sessionGetBag(@Context HttpServletRequest request) { log.info("entering sessionGetBag()"); log.info("new session: " + request.getSession().isNew()); Collection books = bookBag.getContents(); log.info("sessionGetBag(): " + books); request.getSession().invalidate(); return books; } @POST @Path("session/test") public Response sessionTest(@Context HttpServletRequest request) { log.info("entering sessionTest()"); log.info("new session: " + request.getSession().isNew()); Collection contents = bookBag.getContents(); log.info("bookBag: " + contents); if (request.getSession().isNew() && contents.isEmpty()) { return Response.ok().build(); } else { return Response.serverError().build(); } } @GET @Path("mdb/get") @Produces(MediaType.APPLICATION_XML) public GenericEntity> mdbGetBag() { log.info("entering mdbGetBag()"); Collection books = bookBag.getContents(); log.info("sessionGetBag(): " + books); return new GenericEntity>(books){}; } @GET @Path("getCounters") public String getCounters() { return Integer.toString(constructCounter.get()) + ":" + Integer.toString(destroyCounter.get()) + ":"; } @GET @Path("disposer") public Response testDisposer() { log.info("entering testDisposer()"); return ResourceProducer.isDisposed() ? Response.ok().build() : Response.serverError().build(); } @POST @Path("produceMessage") @Consumes("application/test+xml") @Produces(MediaType.TEXT_PLAIN) public Response produceBookMessage(Book book) { log.info("entering produceBookMessage()"); try { log.info("queue: " + bookQueue); log.info("ResourceProducer scope: " + getScope(ResourceProducer.class)); log.info("queue scope: " + getScope(Queue.class)); MessageProducer producer = session.createProducer(bookQueue); TextMessage message = session.createTextMessage(book.getName()); producer.setDeliveryMode(DeliveryMode.NON_PERSISTENT); producer.send(message); log.info("sent: " + message.getText()); return Response.ok().build(); } catch (JMSException e) { e.printStackTrace(); return Response.serverError().entity("JMS error: " + e.getMessage()).build(); } } @GET @Path("queue/consumeMessage") @Produces(MediaType.TEXT_PLAIN) public Response consumeBookMessageFromQueue() { log.info("entering consumeBookMessageFromQueue() xxx"); log.info("getting consumer"); try { MessageConsumer consumer = session.createConsumer(bookQueue); log.info("got consumer"); TextMessage message = (TextMessage) consumer.receiveNoWait(); log.info("message: " + message); if (message == null) { return Response.serverError().build(); } log.info("message text: " + message.getText()); return Response.ok(message.getText()).build(); } catch (JMSException e) { return Response.serverError().entity("JMS error: " + e.getMessage()).build(); } } @GET @Path("mdb/consumeMessage") @Produces(MediaType.TEXT_PLAIN) public Response consumeBookMessageFromMDB() throws InterruptedException { log.info("entering consumeBookMessageFromMDB()"); getCountDownLatch().await(5000, TimeUnit.MILLISECONDS); // Wait until BookMDB has stored book in BookCollection. BookCollection collection = getBookCollection(); log.info("consumeBookMessageFromMDB(): collection.size(): " + collection.getBooks().size()); if (collection.getBooks().size() == 1) { String name = collection.getBooks().iterator().next().getName(); log.info("got book name: " + name); return Response.ok(name).build(); } else { return Response.serverError().entity("Collection size: " + collection.getBooks().size()).build(); } } @GET @Produces(MediaType.APPLICATION_XML) @Path("mdb/books") public Collection getBooksMDB() throws InterruptedException { log.info("entering getBooksMDB()"); log.info("getBooksMDB(): waiting on latch"); latch.await(); log.info("this.theSecret(): " + this.theSecret()); Collection books = collection.getBooks(); log.info("getBooksMDB(): " + books); return books; } BookCollection getBookCollection() { log.info("entering getBookCollection()"); return collection; } Counter getCounter() { log.info("returning: " + counter); return counter; } boolean isApplicationScoped(Class c) { return testScope(c, ApplicationScoped.class); } boolean isDependentScoped(Class c) { return testScope(c, Dependent.class); } boolean isRequestScoped(Class c) { return testScope(c, RequestScoped.class); } boolean isSessionScoped(Class c) { return testScope(c, SessionScoped.class); } boolean testScope(Class c, Class scopeClass) { Class annotation = getScope(c); if (annotation == null) { return false; } return annotation.isAssignableFrom(scopeClass); } Class getScope(Class c) { Set> beans = beanManager.getBeans(c); Iterator> it = beans.iterator(); if (it.hasNext()) { Bean bean = beans.iterator().next(); return bean.getScope(); } // Annotation[] annotations = c.getAnnotations(); // for (int i = 0; i < annotations.length; i++) // { // log.info(annotations[i].annotationType().toString()); // if (beanManager.isScope(annotations[i].annotationType())) // { // return annotations[i].getClass(); // } // if (beanManager.isStereotype(annotations[i].annotationType())) // { // return getScope(annotations[i].annotationType()); // } // } return null; } public boolean theSame(BookResource that) { return this.secret == that.secret; } public int theSecret() { return secret; } } BookWriter.java000066400000000000000000000037311225215345600375550ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/injectionpackage org.jboss.resteasy.cdi.injection; import java.io.IOException; import java.io.OutputStream; import java.lang.annotation.Annotation; import java.lang.reflect.Type; import javax.enterprise.context.ApplicationScoped; import javax.inject.Inject; import javax.ws.rs.Produces; import javax.ws.rs.WebApplicationException; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.MultivaluedMap; import javax.ws.rs.ext.MessageBodyWriter; import javax.ws.rs.ext.Provider; import org.jboss.resteasy.cdi.util.Constants; import org.jboss.resteasy.spi.ResteasyProviderFactory; /** * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright May 8, 2012 */ @Provider @Produces(Constants.MEDIA_TYPE_TEST_XML) @ApplicationScoped public class BookWriter implements MessageBodyWriter { static private MessageBodyWriter delegate; @Inject private DependentScoped dependent; @Inject private StatefulEJB stateful; static { ResteasyProviderFactory factory = ResteasyProviderFactory.getInstance(); delegate = factory.getMessageBodyWriter(Book.class, null, null, Constants.MEDIA_TYPE_TEST_XML_TYPE); } public boolean isWriteable(Class type, Type genericType, Annotation[] annotations, MediaType mediaType) { return Book.class.equals(type); } public long getSize(Book t, Class type, Type genericType, Annotation[] annotations, MediaType mediaType) { return -1; } @Override public void writeTo(Book t, Class type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap httpHeaders, OutputStream entityStream) throws IOException, WebApplicationException { delegate.writeTo(t, type, genericType, annotations, mediaType, httpHeaders, entityStream); } public DependentScoped getDependent() { return dependent; } public StatefulEJB getStateful() { return stateful; } } DependentScoped.java000066400000000000000000000004021225215345600405220ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/injectionpackage org.jboss.resteasy.cdi.injection; import javax.enterprise.context.Dependent; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright May 24, 2012 */ @Dependent public class DependentScoped { } JaxRsActivator.java000066400000000000000000000010011225215345600403560ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/injectionpackage org.jboss.resteasy.cdi.injection; import javax.ws.rs.ApplicationPath; import javax.ws.rs.core.Application; /** * A class extending {@link Application} and annotated with @ApplicationPath is the Java EE 6 * "no XML" approach to activating JAX-RS. * *

* Resources are served relative to the servlet path specified in the {@link ApplicationPath} * annotation. *

*/ @ApplicationPath("/rest") public class JaxRsActivator extends Application { /* class body intentionally left blank */ } NewBean.java000066400000000000000000000004071225215345600370020ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/injectionpackage org.jboss.resteasy.cdi.injection; import javax.enterprise.context.ApplicationScoped; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright Dec 4, 2012 */ @ApplicationScoped public class NewBean { } ResourceBinding.java000066400000000000000000000012411225215345600405420ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/injectionpackage org.jboss.resteasy.cdi.injection; import static java.lang.annotation.ElementType.FIELD; import static java.lang.annotation.ElementType.METHOD; import static java.lang.annotation.ElementType.PARAMETER; import static java.lang.annotation.ElementType.TYPE; import static java.lang.annotation.RetentionPolicy.RUNTIME; import java.lang.annotation.Retention; import java.lang.annotation.Target; import javax.inject.Qualifier; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright Nov 16, 2012 */ @Qualifier @Retention(RUNTIME) @Target({METHOD, FIELD, PARAMETER, TYPE}) public @interface ResourceBinding { } ResourceProducer.java000066400000000000000000000037351225215345600407650ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/injectionpackage org.jboss.resteasy.cdi.injection; import java.util.logging.Logger; import javax.annotation.PreDestroy; import javax.annotation.Resource; import javax.enterprise.context.ApplicationScoped; import javax.enterprise.inject.Disposes; import javax.enterprise.inject.Produces; import javax.inject.Inject; import javax.jms.Connection; import javax.jms.ConnectionFactory; import javax.jms.JMSException; import javax.jms.Queue; import javax.jms.Session; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright Nov 16, 2012 */ @ApplicationScoped @Resource(name="queue/test") public class ResourceProducer { private static Connection connection; private static Session session; private static boolean disposed; @Inject private Logger log; @Resource(mappedName="java:jboss/exported/jms/queue/test") Queue bookQueue; @Resource(mappedName="java:jboss/exported/jms/RemoteConnectionFactory") ConnectionFactory connectionFactory; @ResourceBinding @Produces public Queue toDestination() { log.info("Queue: " + bookQueue); return bookQueue; } public static void dispose(@Disposes @ResourceBinding Queue queue) { System.out.println("ResourceProducer.dispose() called"); disposed = true; } public static boolean isDisposed() { return disposed; } @Produces @ResourceBinding public Session getSession() throws JMSException { if (connection == null) { connection = connectionFactory.createConnection("guest", "pass"); connection.start(); } if (session == null) { session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); } return session; } @PreDestroy public void preDestroy() throws JMSException { if (connection != null) { connection.close(); log.info("ResourceProducer.preDestory(): closed connection"); } } } ScopeInheritingStereotype.java000066400000000000000000000010001225215345600426270ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/injectionpackage org.jboss.resteasy.cdi.injection; import static java.lang.annotation.ElementType.TYPE; import static java.lang.annotation.RetentionPolicy.RUNTIME; import java.lang.annotation.Retention; import java.lang.annotation.Target; import javax.enterprise.inject.Stereotype; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright Dec 4, 2012 */ @ScopeStereotype @Stereotype @Target(TYPE) @Retention(RUNTIME) public @interface ScopeInheritingStereotype { } ScopeStereotype.java000066400000000000000000000010531225215345600406160ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/injectionpackage org.jboss.resteasy.cdi.injection; import static java.lang.annotation.ElementType.TYPE; import static java.lang.annotation.RetentionPolicy.RUNTIME; import java.lang.annotation.Retention; import java.lang.annotation.Target; import javax.enterprise.context.ApplicationScoped; import javax.enterprise.inject.Stereotype; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright Dec 4, 2012 */ @ApplicationScoped @Stereotype @Target(TYPE) @Retention(RUNTIME) public @interface ScopeStereotype { } StatefulEJB.java000066400000000000000000000003551225215345600375750ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/injection package org.jboss.resteasy.cdi.injection; import javax.ejb.Stateful; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright May 24, 2012 */ @Stateful public class StatefulEJB { } StereotypedApplicationScope.java000066400000000000000000000004171225215345600431510ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/injectionpackage org.jboss.resteasy.cdi.injection; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright Dec 4, 2012 */ @ScopeInheritingStereotype public class StereotypedApplicationScope { public void test() { } } StereotypedDependentScope.java000066400000000000000000000004451225215345600426150ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/injectionpackage org.jboss.resteasy.cdi.injection; import javax.enterprise.context.Dependent; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright Dec 4, 2012 */ @Dependent @ScopeInheritingStereotype public class StereotypedDependentScope { } UnscopedResource.java000066400000000000000000000003651225215345600407560ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/injectionpackage org.jboss.resteasy.cdi.injection; import javax.ws.rs.Path; /** * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright May 22, 2012 */ @Path("/unscoped") public class UnscopedResource { } package-info.java000066400000000000000000000003261225215345600400070ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/injection/** * This package (along with @see org.jboss.resteasy.test.cdi.injection) tests injection * into JAX-RS components. * * @see org.jboss.resteasy.package-info.java */ package org.jboss.resteasy.cdi.injection; 000077500000000000000000000000001225215345600362725ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/injection/reverseEJBHolder.java000066400000000000000000000263611225215345600407030ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/injection/reversepackage org.jboss.resteasy.cdi.injection.reverse; import java.util.HashMap; import java.util.logging.Logger; import javax.annotation.PostConstruct; import javax.ejb.EJB; import javax.ejb.Stateful; import javax.enterprise.context.RequestScoped; import javax.inject.Inject; import org.jboss.resteasy.cdi.injection.Book; import org.jboss.resteasy.cdi.injection.BookResource; import org.jboss.resteasy.cdi.util.Utilities; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright May 30, 2012 */ @Stateful @RequestScoped public class EJBHolder implements EJBHolderRemote, EJBHolderLocal { public static final String SLE = "sle"; public static final String SFDE = "sfde"; public static final String SFRE = "sfre"; public static final String SFAE = "sfae"; public static final String SLI = "sli"; public static final String SFDI = "sfdi"; public static final String SFRI = "sfri"; public static final String SFAI = "sfai"; public static final String SLI_SECRET = "sliSecret"; public static final String SFDI_SECRET = "sfdiSecret"; public static final String SFRI_SECRET = "sfriSecret"; public static final String SFAI_SECRET = "sfaiSecret"; private static HashMap store = new HashMap(); @Inject private Logger log; @Inject private Utilities utilities; @Inject int secret; @EJB private StatelessEJBwithJaxRsComponentsInterface sle; @EJB private StatefulDependentScopedEJBwithJaxRsComponentsInterface sfde; @EJB private StatefulRequestScopedEJBwithJaxRsComponentsInterface sfre; @EJB private StatefulApplicationScopedEJBwithJaxRsComponentsInterface sfae; @Inject private StatelessEJBwithJaxRsComponentsInterface sli; @Inject private StatefulDependentScopedEJBwithJaxRsComponentsInterface sfdi; @Inject private StatefulRequestScopedEJBwithJaxRsComponentsInterface sfri; @Inject private StatefulApplicationScopedEJBwithJaxRsComponentsInterface sfai; @Inject private BookResource resource; @PostConstruct public void postConstruct() { log.info(this + " secret: " + secret); } @Override public boolean testScopes() { log.info(""); log.info("entering EJBHolder.testScopes()"); log.info("resource scope: " + utilities.getScope(BookResource.class)); log.info("EJBHolder scope: " + utilities.getScope(EJBHolder.class)); log.info("EJBHolderLocal scope: " + utilities.getScope(EJBHolderLocal.class)); log.info("EJBHolderRemote scope: " + utilities.getScope(EJBHolderRemote.class)); log.info("StatelessEJBwithJaxRsComponents scope: " + utilities.getScope(StatelessEJBwithJaxRsComponents.class)); log.info("StatelessEJBwithJaxRsComponentsInterface scope: " + utilities.getScope(StatelessEJBwithJaxRsComponentsInterface.class)); log.info("StatefulDependentScopedEJBwithJaxRsComponents scope: " + utilities.getScope(StatefulDependentScopedEJBwithJaxRsComponents.class)); log.info("StatefulDependentScopedEJBwithJaxRsComponentsInterface scope: " + utilities.getScope(StatefulDependentScopedEJBwithJaxRsComponentsInterface.class)); log.info("StatefulRequestScopedEJBwithJaxRsComponents scope: " + utilities.getScope(StatefulRequestScopedEJBwithJaxRsComponents.class)); log.info("StatefulRequestScopedEJBwithJaxRsComponentsInterface scope: " + utilities.getScope(StatefulRequestScopedEJBwithJaxRsComponentsInterface.class)); log.info("StatefulApplicationScopedEJBwithJaxRsComponents scope: " + utilities.getScope(StatefulApplicationScopedEJBwithJaxRsComponents.class)); log.info("StatefulApplicationScopedEJBwithJaxRsComponentsInterface scope: " + utilities.getScope(StatefulApplicationScopedEJBwithJaxRsComponentsInterface.class)); return utilities.isDependentScoped(StatelessEJBwithJaxRsComponentsInterface.class) && utilities.isDependentScoped(StatefulDependentScopedEJBwithJaxRsComponentsInterface.class) && utilities.isRequestScoped(StatefulRequestScopedEJBwithJaxRsComponentsInterface.class) && utilities.isApplicationScoped(StatefulApplicationScopedEJBwithJaxRsComponentsInterface.class); } @Override public void setup() { log.info(""); log.info("entering EJBHolder.setup()"); resource.getSet().add(new Book("Disappearing Book")); store.put("sle", sle); store.put("sfde", sfde); store.put("sfre", sfre); store.put("sfae", sfae); store.put("sli", sli); store.put("sfdi", sfdi); store.put("sfri", sfri); store.put("sfai", sfai); store.put("sli.secret", sli.theSecret()); store.put("sfdi.secret", sfdi.theSecret()); store.put("sfri.secret", sfri.theSecret()); store.put("sfai.secret", sfai.theSecret()); sleSetup(); sfdeSetup(); sfreSetup(); sfaeSetup(); sliSetup(); sfdiSetup(); sfriSetup(); sfaiSetup(); } @Override public boolean test() { log.info(""); log.info("entering EJBHolder.test()"); boolean result = true; result &= resource.getSet().isEmpty(); // @TODO inject singleton // @TODO inject by setter method result &= store.get("sle").equals(sle); // EJB spec 3.4.7.1 result &= !store.get("sfde").equals(sfde); // EJB spec 3.4.7.2, 16.2.1 result &= !store.get("sfre").equals(sfre); // EJB spec 3.4.7.2, 16.2.1 result &= !store.get("sfae").equals(sfae); // EJB spec 3.4.7.2, 16.2.1 // result &= !(store.get("sle") == sle); // EJB spec 16.2.1 result &= !(store.get("sfde") == sfde); // EJB spec 16.2.1 result &= !(store.get("sfre") == sfre); // EJB spec 16.2.1 result &= !(store.get("sfae") == sfae); // EJB spec 16.2.1 // Unlike the EJB spec, the CDI spec does not explicitly specify the semantics of the equality or inequality // of injected objects. In fact, it explicitly forbids calling the java.lang.Object.equals() function on injected // objects [CDI spec, section 5.4.2]. It does specify that the first reference to an injectible object in a given // context should result in a new contextual reference or a new contextual instance [CDI spec, section 6.5.3], // but it doesn't seem to specify the precise semantics of "new". In the weld reference implementation, // there seem to be three variations, at least with respect to injected EJBs: // // 1. It could be a new proxy for an existing object, or // 2. a new proxy for a new object, or // 3. a reused proxy for a new object. // // In this test, we find that // // 1. An SLSB (which necessarily has dependent pseudo-scope) is treated according to case 1. // 2. An SFSB with dependent scope is treated according to case 2. // 3. An SFSB with request scope is treated according to case 3. // // This behavior seems to be consistent with the semantics of EJBs: // // 1. All instances of a given SLSB class are considered equal, and SLSB target objects are reused (case 1). // 2. All instances of a given SFSB class are considered unequal, and SFSBs are always recreated (cases 2 and 3). // // For this test, we consider inequality, in cases where we expect a new object in a new scope, to mean // // 1. a new proxy for SLSBs, and // 2. a new target object for SFSBs. // // N.B. If an SLSB is reused, and it is a contextual object (i.e., created by CDI), then, though some fields might // remain the same, all fields annotated with @Inject should be processed accordingly. // log.info("sli: == stored sli: " + (sli == store.get("sli"))); log.info("sfdi: == stored sfdi: " + (sfdi == store.get("sfdi"))); log.info("sfri: == stored sfri: " + (sfri == store.get("sfri"))); log.info("sfai: == stored sfai: " + (sfai == store.get("sfai"))); log.info("sli.secret: == stored sli.secret: " + (sli.theSecret() == Integer.class.cast(store.get("sli.secret")))); log.info("sfdi.secret: == stored sfdi.secret: " + (sfdi.theSecret() == Integer.class.cast(store.get("sfdi.secret")))); log.info("sfri.secret: == stored sfri.secret: " + (sfri.theSecret() == Integer.class.cast(store.get("sfri.secret")))); log.info("sfai.secret: == stored sfai.secret: " + (sfai.theSecret() == Integer.class.cast(store.get("sfai.secret")))); result &= (sli != store.get("sli")); result &= (sfdi.theSecret() != Integer.class.cast(store.get("sfdi.secret"))); result &= (sfri.theSecret() != Integer.class.cast(store.get("sfri.secret"))); // The CDI spec requires that a single application scoped object of a given class should exist for the // lifetime of the application. It seems reasonable to expect // // 1. that a proxy for that object obtained by @Inject should be reused throughout the lifetime of the application, and // 2. that the target of that proxy should remain the same throughout the lifetime of the application. result &= (sfai == store.get("sfai") && sfai.theSecret() == Integer.class.cast(store.get("sfai.secret"))); result &= sleTest(); result &= sfdeTest(); result &= sfreTest(); result &= sfaeTest(); result &= sliTest(); result &= sfdiTest(); result &= sfriTest(); result &= sfaiTest(); return result; } @Override public void sleSetup() { sle.setUp(SLE); } @Override public boolean sleTest() { return sle.test(SLE); } @Override public void sfdeSetup() { sfde.setUp(SFDE); } @Override public boolean sfdeTest() { return sfde.test(SFDE); } @Override public void sfreSetup() { sfre.setUp(SFRE); } @Override public boolean sfreTest() { return sfre.test(SFRE); } @Override public void sfaeSetup() { sfae.setUp(SFAE); } @Override public boolean sfaeTest() { return sfae.test(SFAE); } @Override public void sliSetup() { sli.setUp(SLI); } @Override public boolean sliTest() { return sli.test(SLI); } @Override public void sfdiSetup() { sfdi.setUp(SFDI); } @Override public boolean sfdiTest() { return sfdi.test(SFDI); } @Override public void sfriSetup() { sfri.setUp(SFRI); } @Override public boolean sfriTest() { return sfri.test(SFRI); } @Override public void sfaiSetup() { sfai.setUp(SFAI); } @Override public boolean sfaiTest() { return sfai.test(SFAI); } @Override public boolean theSame(EJBHolderLocal that) { log.info("this secret: " + secret); log.info("that secret: " + that.theSecret()); return this.secret == that.theSecret(); } @Override public int theSecret() { return secret; } } EJBHolderLocal.java000066400000000000000000000015771225215345600416600ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/injection/reversepackage org.jboss.resteasy.cdi.injection.reverse; import javax.ejb.Local; /** * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright May 30, 2012 */ @Local public interface EJBHolderLocal { public boolean testScopes(); public void setup(); public boolean test(); public void sleSetup(); public boolean sleTest(); public void sfdeSetup(); public boolean sfdeTest(); public void sfreSetup(); public boolean sfreTest(); public void sfaeSetup(); public boolean sfaeTest(); public void sliSetup(); public boolean sliTest(); public void sfdiSetup(); public boolean sfdiTest(); public void sfriSetup();; public boolean sfriTest(); public void sfaiSetup(); public boolean sfaiTest(); public boolean theSame(EJBHolderLocal that); public int theSecret(); } EJBHolderRemote.java000066400000000000000000000014641225215345600420540ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/injection/reversepackage org.jboss.resteasy.cdi.injection.reverse; import javax.ejb.Remote; /** * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright May 30, 2012 */ @Remote public interface EJBHolderRemote { public boolean testScopes(); public void setup(); public boolean test(); public void sleSetup(); public boolean sleTest(); public void sfdeSetup(); public boolean sfdeTest(); public void sfreSetup(); public boolean sfreTest(); public void sfaeSetup(); public boolean sfaeTest(); public void sliSetup(); public boolean sliTest(); public void sfdiSetup(); public boolean sfdiTest(); public void sfriSetup(); public boolean sfriTest(); public void sfaiSetup(); public boolean sfaiTest(); } EJBInterface.java000066400000000000000000000006421225215345600413600ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/injection/reversepackage org.jboss.resteasy.cdi.injection.reverse; import javax.ejb.Remote; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright May 29, 2012 */ @Remote public interface EJBInterface { public void setUp(String key); public boolean test(String key); public Class theClass(); public boolean theSame(EJBInterface ejb); public int theSecret(); } ReverseInjectionResource.java000066400000000000000000000056561225215345600441370ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/injection/reversepackage org.jboss.resteasy.cdi.injection.reverse; import java.util.HashMap; import java.util.Iterator; import java.util.logging.Logger; import javax.enterprise.context.RequestScoped; import javax.inject.Inject; import javax.ws.rs.POST; import javax.ws.rs.Path; import javax.ws.rs.core.Response; import org.jboss.resteasy.cdi.injection.Book; import org.jboss.resteasy.cdi.injection.BookResource; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright May 7, 2012 */ @Path("/reverse") @RequestScoped public class ReverseInjectionResource { static public final String NON_CONTEXTUAL = "non-contextual"; static HashMap store = new HashMap(); @Inject int secret; @Inject private EJBHolderLocal holder; @Inject private Logger log; @Inject private BookResource resource; @POST @Path("testScopes") public Response testScopes() { log.info("entered ReverseInjectionResource.testScopes()"); return holder.testScopes() ? Response.ok().build() : Response.serverError().build(); } @POST @Path("setup") public Response setup() { log.info("entered ReverseInjectionResource.setup()"); store.put("this.secret", this.secret); store.put("holder.secret", holder.theSecret()); store.put("resource.secret", resource.theSecret()); store.put("resource", resource); resource.getSet().add(new Book("test")); holder.setup(); return Response.ok().build(); } @POST @Path("test") public Response test() { log.info("entered ReverseInjectionResource.test()"); if (BookResource.class.cast(store.get("resource")).getSet().size() > 0) { Iterator it = BookResource.class.cast(store.get("resource")).getSet().iterator(); log.info("stored resource set:"); while (it.hasNext()) { log.info(" " + it.next()); } return Response.serverError().entity("stored resource set not empty").build(); } if (secret == Integer.class.cast(store.get("this.secret"))) { return Response.serverError().entity("secret == store.get(\"this.secret\") shouldn't be true").build(); } if (holder.theSecret() == (Integer.class.cast(store.get("holder.secret")))) { return Response.serverError().entity("holder.theSecret == store.get(\"holder.secret\") shouldn't be true").build(); } if (resource.theSecret() == Integer.class.cast(store.get("resource.secret"))) { return Response.serverError().entity("resource.theSecret() == store.get(\"resource.secret\") shouldn't be true").build(); } if (holder.test()) { return Response.ok().build(); } else { return Response.serverError().build(); } } public boolean theSame(ReverseInjectionResource that) { return this.secret == that.secret; } } StatefulApplicationScopedEJBwithJaxRsComponents.java000066400000000000000000000101031225215345600504740ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/injection/reversepackage org.jboss.resteasy.cdi.injection.reverse; import static org.jboss.resteasy.cdi.injection.reverse.ReverseInjectionResource.NON_CONTEXTUAL; import java.util.HashMap; import java.util.logging.Logger; import javax.annotation.PostConstruct; import javax.annotation.PreDestroy; import javax.ejb.Stateful; import javax.enterprise.context.ApplicationScoped; import javax.inject.Inject; import org.jboss.resteasy.cdi.injection.BookReader; import org.jboss.resteasy.cdi.injection.BookResource; import org.jboss.resteasy.cdi.injection.BookWriter; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright May 24, 2012 */ @Stateful @ApplicationScoped public class StatefulApplicationScopedEJBwithJaxRsComponents implements StatefulApplicationScopedEJBwithJaxRsComponentsInterface { private static HashMap> store = new HashMap>(); private static int constructions; private static int destructions; @Inject int secret; static public int getConstructions() { return constructions; } static public int getDestructions() { return destructions; } @PostConstruct public void postConstruct() { constructions++; log.info(this + " secret: " + secret); } @PreDestroy public void preDestroy() { destructions++; } @Inject private Logger log; @Inject private BookResource resource; @Inject private BookReader reader; @Inject private BookWriter writer; @Override public void setUp(String key) { log.info("entering StatefulApplicationScopedEJBwithJaxRsComponents.setUp()"); HashMap substore = new HashMap(); substore.put("secret", resource.theSecret()); substore.put(BookResource.BOOK_READER, reader); substore.put(BookResource.BOOK_WRITER, writer); store.put(key, substore); } /** * This is an SFSB. See discussion in EJBHolder.test(). * * If NON_CONTEXTUAL.equals(key), then this bean was obtained from JNDI, and * it is not a CDI contextual object. It follows that it is not dependency * scoped, which means it will not be recreated, with new injections, upon a * second invocation. * * Otherwise, it will be recreated, and CDI will redo the injections. */ @Override public boolean test(String key) { log.info("entering StatefulApplicationScopedEJBwithJaxRsComponents.test(" + key + ")"); HashMap substore = store.get(key); int savedSecret = Integer.class.cast(substore.get("secret")); log.info("stored resource secret = resource secret: " + (savedSecret == resource.theSecret())); log.info("stored reader = reader: " + (substore.get(BookResource.BOOK_READER) == reader)); log.info("stored writer = writer: " + (substore.get(BookResource.BOOK_WRITER) == writer)); boolean result = true; result &= reader == substore.get(BookResource.BOOK_READER); // application scoped result &= writer == substore.get(BookResource.BOOK_WRITER); // application scoped if (NON_CONTEXTUAL.equals(key)) { result &= resource.theSecret() == savedSecret; // request scope not applicable } else { result &= resource.theSecret() != savedSecret; // request scoped } return result; } @Override public Class theClass() { return StatefulApplicationScopedEJBwithJaxRsComponents.class; } @Override public boolean theSame(EJBInterface ejb) { if (ejb == null) return false; Class c = ejb.theClass(); if (!StatefulApplicationScopedEJBwithJaxRsComponents.class.equals(c)) { log.info(ejb + " not instanceof StatefulApplicationScopedEJBwithJaxRsComponents: " + c); return false; } log.info(this.secret + " " + ejb.theSecret()); return this.secret == ejb.theSecret(); } @Override public int theSecret() { return secret; } } StatefulApplicationScopedEJBwithJaxRsComponentsInterface.java000066400000000000000000000004631225215345600523250ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/injection/reversepackage org.jboss.resteasy.cdi.injection.reverse; import javax.ejb.Local; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright May 30, 2012 */ @Local public interface StatefulApplicationScopedEJBwithJaxRsComponentsInterface extends EJBInterface { } StatefulDependentScopedEJBwithJaxRsComponents.java000066400000000000000000000101171225215345600501440ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/injection/reversepackage org.jboss.resteasy.cdi.injection.reverse; import static org.jboss.resteasy.cdi.injection.reverse.ReverseInjectionResource.NON_CONTEXTUAL; import java.util.HashMap; import java.util.logging.Logger; import javax.annotation.PostConstruct; import javax.annotation.PreDestroy; import javax.ejb.Stateful; import javax.enterprise.context.Dependent; import javax.inject.Inject; import org.jboss.resteasy.cdi.injection.BookReader; import org.jboss.resteasy.cdi.injection.BookResource; import org.jboss.resteasy.cdi.injection.BookWriter; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright May 24, 2012 */ @Stateful @Dependent public class StatefulDependentScopedEJBwithJaxRsComponents implements StatefulDependentScopedEJBwithJaxRsComponentsInterface { private static HashMap> store = new HashMap>(); private static int constructions; private static int destructions; @Inject int secret; static public int getConstructions() { return constructions; } static public int getDestructions() { return destructions; } @PostConstruct public void postConstruct() { constructions++; log.info(this + " secret: " + secret); } @PreDestroy public void preDestroy() { destructions++; } @Inject private Logger log; @Inject private BookResource resource; @Inject private BookReader reader; @Inject private BookWriter writer; @Override public void setUp(String key) { log.info("entering StatefulDependentScopedEJBwithJaxRsComponents.setUp()"); HashMap substore = new HashMap(); substore.put("secret", resource.theSecret()); substore.put(BookResource.BOOK_READER, reader); substore.put(BookResource.BOOK_WRITER, writer); substore.put("this", this); store.put(key, substore); } /** * This is a SFSB. See discussion in EJBHolder.test(). * * If NON_CONTEXTUAL.equals(key), then this bean was obtained from JNDI, and * it is not a CDI contextual object. It follows that it is not dependency * scoped, which means it will not be recreated, with new injections, upon a * second invocation. * * Otherwise, it will be recreated, and CDI will redo the injections. */ @Override public boolean test(String key) { log.info("entering StatefulDependentScopedEJBwithJaxRsComponents.test(" + key + ")"); HashMap substore = store.get(key); int savedSecret = Integer.class.cast(substore.get("secret")); log.info("stored resource secret = resource secret: " + (savedSecret == resource.theSecret())); log.info("stored reader = reader: " + (substore.get(BookResource.BOOK_READER) == reader)); log.info("stored writer = writer: " + (substore.get(BookResource.BOOK_WRITER) == writer)); boolean result = true; result &= reader == substore.get(BookResource.BOOK_READER); // application scoped result &= writer == substore.get(BookResource.BOOK_WRITER); // application scoped if (NON_CONTEXTUAL.equals(key)) { result &= resource.theSecret() == savedSecret; // request scope not applicable } else { result &= resource.theSecret() != savedSecret; // request scoped } return result; } @Override public Class theClass() { return StatefulDependentScopedEJBwithJaxRsComponents.class; } @Override public boolean theSame(EJBInterface ejb) { if (ejb == null) return false; Class c = ejb.theClass(); if (!StatefulDependentScopedEJBwithJaxRsComponents.class.equals(c)) { log.info(ejb + " not instanceof StatefulDependentScopedEJBwithJaxRsComponents: " + c); return false; } log.info(this.secret + " " + ejb.theSecret()); return this.secret == ejb.theSecret(); } @Override public int theSecret() { return secret; } } StatefulDependentScopedEJBwithJaxRsComponentsInterface.java000066400000000000000000000004621225215345600517670ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/injection/reversepackage org.jboss.resteasy.cdi.injection.reverse; import javax.ejb.Local; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright May 30, 2012 */ @Local public interface StatefulDependentScopedEJBwithJaxRsComponentsInterface extends EJBInterface { } StatefulRequestScopedEJBwithJaxRsComponents.java000066400000000000000000000100421225215345600476630ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/injection/reversepackage org.jboss.resteasy.cdi.injection.reverse; import static org.jboss.resteasy.cdi.injection.reverse.ReverseInjectionResource.NON_CONTEXTUAL; import java.util.HashMap; import java.util.logging.Logger; import javax.annotation.PostConstruct; import javax.annotation.PreDestroy; import javax.ejb.Stateful; import javax.enterprise.context.RequestScoped; import javax.inject.Inject; import org.jboss.resteasy.cdi.injection.BookReader; import org.jboss.resteasy.cdi.injection.BookResource; import org.jboss.resteasy.cdi.injection.BookWriter; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright May 24, 2012 */ @Stateful @RequestScoped public class StatefulRequestScopedEJBwithJaxRsComponents implements StatefulRequestScopedEJBwithJaxRsComponentsInterface { private static HashMap> store = new HashMap>(); private static int constructions; private static int destructions; @Inject int secret; static public int getConstructions() { return constructions; } static public int getDestructions() { return destructions; } @PostConstruct public void postConstruct() { constructions++; log.info(this + " secret: " + secret); } @PreDestroy public void preDestroy() { destructions++; } @Inject private Logger log; @Inject private BookResource resource; @Inject private BookReader reader; @Inject private BookWriter writer; @Override public void setUp(String key) { log.info("entering StatefulRequestScopedEJBwithJaxRsComponents.setUp()"); HashMap substore = new HashMap(); substore.put("secret", resource.theSecret()); substore.put(BookResource.BOOK_READER, reader); substore.put(BookResource.BOOK_WRITER, writer); store.put(key, substore); } /** * This is a SFSB. See discussion in EJBHolder.test(). * * If NON_CONTEXTUAL.equals(key), then this bean was obtained from JNDI, and * it is not a CDI contextual object. It follows that it is not request * scoped, which means it will not be recreated, with new injections, upon a * second invocation. * * Otherwise, it will be recreated, and CDI will redo the injections. */ @Override public boolean test(String key) { log.info("entering StatefulRequestScopedEJBwithJaxRsComponents.test(" + key + ")"); HashMap substore = store.get(key); int savedSecret = Integer.class.cast(substore.get("secret")); log.info("stored resource secret = resource secret: " + (savedSecret == resource.theSecret())); log.info("stored reader = reader: " + (substore.get(BookResource.BOOK_READER) == reader)); log.info("stored writer = writer: " + (substore.get(BookResource.BOOK_WRITER) == writer)); boolean result = true; result &= reader == substore.get(BookResource.BOOK_READER); // application scoped result &= writer == substore.get(BookResource.BOOK_WRITER); // application scoped if (NON_CONTEXTUAL.equals(key)) { result &= resource.theSecret() == savedSecret; // request scope not applicable } else { result &= resource.theSecret() != savedSecret; // request scoped } return result; } @Override public Class theClass() { return StatefulRequestScopedEJBwithJaxRsComponents.class; } @Override public boolean theSame(EJBInterface ejb) { if (ejb == null) return false; Class c = ejb.theClass(); if (!StatefulRequestScopedEJBwithJaxRsComponents.class.equals(c)) { log.info(ejb + " not instanceof StatefulRequestScopedEJBwithJaxRsComponents: " + c); return false; } log.info(this.secret + " " + ejb.theSecret()); return this.secret == ejb.theSecret(); } @Override public int theSecret() { return secret; } } StatefulRequestScopedEJBwithJaxRsComponentsInterface.java000066400000000000000000000004571225215345600515150ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/injection/reversepackage org.jboss.resteasy.cdi.injection.reverse; import javax.ejb.Local; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright May 30, 2012 */ @Local public interface StatefulRequestScopedEJBwithJaxRsComponentsInterface extends EJBInterface { } StatelessEJBwithJaxRsComponents.java000066400000000000000000000076671225215345600453570ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/injection/reversepackage org.jboss.resteasy.cdi.injection.reverse; import static org.jboss.resteasy.cdi.injection.reverse.ReverseInjectionResource.NON_CONTEXTUAL; import java.util.HashMap; import java.util.logging.Logger; import javax.annotation.PostConstruct; import javax.annotation.PreDestroy; import javax.ejb.Stateless; import javax.inject.Inject; import org.jboss.resteasy.cdi.injection.BookReader; import org.jboss.resteasy.cdi.injection.BookResource; import org.jboss.resteasy.cdi.injection.BookWriter; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright May 24, 2012 */ @Stateless public class StatelessEJBwithJaxRsComponents implements StatelessEJBwithJaxRsComponentsInterface { private static HashMap> store = new HashMap>(); private static int constructions; private static int destructions; @Inject int secret; static public int getConstructions() { return constructions; } static public int getDestructions() { return destructions; } @PostConstruct public void postConstruct() { constructions++; log.info(this + " secret: " + secret); } @PreDestroy public void preDestroy() { destructions++; } @Inject private Logger log; @Inject private BookResource resource; @Inject private BookReader reader; @Inject private BookWriter writer; @Override public void setUp(String key) { log.info("entering StatelessEJBwithJaxRsComponents.setUp()"); HashMap substore = new HashMap(); substore.put("secret", resource.theSecret()); substore.put(BookResource.BOOK_READER, reader); substore.put(BookResource.BOOK_WRITER, writer); substore.put("this", this); store.put(key, substore); } /** * This is an SLSB. See discussion in EJBHolder.test(). * * If NON_CONTEXTUAL.equals(key), then this bean was obtained from JNDI, and * it is not a CDI contextual object. It follows that it is not dependency * scoped, which means it will not be recreated, with new injections, upon a * second invocation. * * Otherwise, it will be recreated, and CDI will redo the injections. */ @Override public boolean test(String key) { log.info("entering StatelessEJBwithJaxRsComponents.test(" + key + ")"); HashMap substore = store.get(key); int savedSecret = Integer.class.cast(substore.get("secret")); log.info("stored resource secret = resource secret: " + (savedSecret == resource.theSecret())); log.info("stored reader = reader: " + (substore.get(BookResource.BOOK_READER) == reader)); log.info("stored writer = writer: " + (substore.get(BookResource.BOOK_WRITER) == writer)); boolean result = true; result &= reader == substore.get(BookResource.BOOK_READER); // application scoped result &= writer == substore.get(BookResource.BOOK_WRITER); // application scoped if (NON_CONTEXTUAL.equals(key)) { result &= resource.theSecret() == savedSecret; // request scope not applicable } else { result &= resource.theSecret() != savedSecret; // request scoped } return result; } @Override public Class theClass() { return StatelessEJBwithJaxRsComponents.class; } @Override public boolean theSame(EJBInterface ejb) { if (ejb == null) return false; Class c = ejb.theClass(); if (!StatelessEJBwithJaxRsComponents.class.equals(c)) { log.info(ejb + " not instanceof StatelessEJBwithJaxRsComponents: " + c); return false; } log.info(this.secret + " " + ejb.theSecret()); return this.secret == ejb.theSecret(); } @Override public int theSecret() { return secret; } } StatelessEJBwithJaxRsComponentsInterface.java000066400000000000000000000004451225215345600471630ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/injection/reversepackage org.jboss.resteasy.cdi.injection.reverse; import javax.ejb.Local; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright May 30, 2012 */ @Local public interface StatelessEJBwithJaxRsComponentsInterface extends EJBInterface { } package-info.java000066400000000000000000000003561225215345600414650ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/injection/reverse/** * This package (along with @see org.jboss.resteasy.test.cdi.injection.reverse) tests injection * of JAX-RS components into EJBs. * * @see org.jboss.resteasy.package-info.java */ package org.jboss.resteasy.cdi.injection.reverse; 000077500000000000000000000000001225215345600353565ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/interceptorsBook.java000066400000000000000000000027621225215345600371220ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/interceptorspackage org.jboss.resteasy.cdi.interceptors; import javax.persistence.Entity; import javax.persistence.Id; import javax.validation.constraints.NotNull; import javax.validation.constraints.Size; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; /** * Book is * * 1) a JAXB class, suitable for transport over the network, and * 2) an @Entity class, suitable for JPA storage * * @author Ron Sigal * @version $Revision: 1 $ */ @Entity @XmlRootElement(name = "book") @XmlAccessorType(XmlAccessType.FIELD) public class Book { @XmlElement private int id; @XmlElement @NotNull @Size(min = 1, max = 25) private String name; public Book() { } public Book(String name) { this.name = name; } public Book(int id, String name) { this.id = id; this.name = name; } @Id public int getId() { return id; } public void setId(int id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String toString() { return "Book[" + id + "," + name + "]"; } public boolean equals(Object o) { if (o == null || ! (o instanceof Book)) { return false; } return name.equals(((Book) o).name); } } BookReader.java000066400000000000000000000042431225215345600402410ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/interceptorspackage org.jboss.resteasy.cdi.interceptors; import java.io.IOException; import java.io.InputStream; import java.lang.annotation.Annotation; import java.lang.reflect.Type; import java.util.logging.Logger; import javax.inject.Inject; import javax.interceptor.Interceptors; import javax.ws.rs.Consumes; import javax.ws.rs.WebApplicationException; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.MultivaluedMap; import javax.ws.rs.ext.MessageBodyReader; import javax.ws.rs.ext.Provider; import org.jboss.resteasy.cdi.util.Constants; import org.jboss.resteasy.spi.ResteasyProviderFactory; /** * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright May 8, 2012 */ @Provider @Consumes(Constants.MEDIA_TYPE_TEST_XML) @Interceptors({Interceptor0.class}) @ClassBinding public class BookReader implements MessageBodyReader { static private MessageBodyReader delegate; @Inject private Logger log; static { System.out.println("In BookReader static {}"); ResteasyProviderFactory factory = ResteasyProviderFactory.getInstance(); delegate = factory.getMessageBodyReader(Book.class, null, null, Constants.MEDIA_TYPE_TEST_XML_TYPE); System.out.println("In BookReader static {}"); } public boolean isReadable(Class type, Type genericType, Annotation[] annotations, MediaType mediaType) { System.out.println("entering BookReader.isReadable()"); boolean b = Book.class.equals(type); System.out.println("leaving BookReader.isReadable()"); return b; } @Interceptors({Interceptor1.class}) @MethodBinding public Book readFrom(Class type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap httpHeaders, InputStream entityStream) throws IOException, WebApplicationException { log.info("entering BookReader.readFrom()"); Book book = Book.class.cast(delegate.readFrom(Book.class, genericType, annotations, mediaType, httpHeaders, entityStream)); log.info("BookReader.readFrom() read " + book); log.info("leaving BookReader.readFrom()"); return book; } } BookReaderInterceptor.java000066400000000000000000000017101225215345600424540ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/interceptorspackage org.jboss.resteasy.cdi.interceptors; import java.io.IOException; import java.util.logging.Logger; import javax.inject.Inject; import javax.ws.rs.WebApplicationException; import javax.ws.rs.ext.Provider; import javax.ws.rs.ext.ReaderInterceptor; import javax.ws.rs.ext.ReaderInterceptorContext; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright Jul 23, 2012 */ @Provider public class BookReaderInterceptor implements ReaderInterceptor { @Inject private Logger log; @Override @ReaderInterceptorBinding public Object aroundReadFrom(ReaderInterceptorContext context) throws IOException, WebApplicationException { log.info("*** Intercepting call in BookReaderInterceptor.aroundReadFrom()"); VisitList.add(this); Object result = context.proceed(); log.info("*** Back from intercepting call in BookReaderInterceptor.aroundReadFrom()"); return result; } } BookReaderInterceptorInterceptor.java000066400000000000000000000015171225215345600447000ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/interceptorspackage org.jboss.resteasy.cdi.interceptors; import java.util.logging.Logger; import javax.inject.Inject; import javax.interceptor.AroundInvoke; import javax.interceptor.Interceptor; import javax.interceptor.InvocationContext; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright Nov 13, 2012 */ @Interceptor @ReaderInterceptorBinding public class BookReaderInterceptorInterceptor { @Inject private Logger log; @AroundInvoke public Object intercept(InvocationContext ctx) throws Exception { log.info("*** Intercepting call in BookReaderInterceptorInterceptor.intercept()"); VisitList.add(this); Object result = ctx.proceed(); log.info("*** Back from intercepting call in BookReaderInterceptorInterceptor.intercept()"); return result; } } BookWriter.java000066400000000000000000000044131225215345600403120ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/interceptorspackage org.jboss.resteasy.cdi.interceptors; import java.io.IOException; import java.io.OutputStream; import java.lang.annotation.Annotation; import java.lang.reflect.Type; import javax.interceptor.Interceptors; import javax.ws.rs.Produces; import javax.ws.rs.WebApplicationException; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.MultivaluedMap; import javax.ws.rs.ext.MessageBodyWriter; import javax.ws.rs.ext.Provider; import org.jboss.resteasy.cdi.util.Constants; import org.jboss.resteasy.spi.ResteasyProviderFactory; /** * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright May 8, 2012 */ @Provider @Produces(Constants.MEDIA_TYPE_TEST_XML) @Interceptors({Interceptor0.class}) @ClassBinding public class BookWriter implements MessageBodyWriter { static private MessageBodyWriter delegate; static { System.out.println("In BookWriter static {}"); ResteasyProviderFactory factory = ResteasyProviderFactory.getInstance(); delegate = factory.getMessageBodyWriter(Book.class, null, null, Constants.MEDIA_TYPE_TEST_XML_TYPE); } public boolean isWriteable(Class type, Type genericType, Annotation[] annotations, MediaType mediaType) { System.out.println("entering BookWriter.isWriteable()"); boolean b = Book.class.equals(type); System.out.println("leaving BookWriter.isWriteable()"); return b; } public long getSize(Book t, Class type, Type genericType, Annotation[] annotations, MediaType mediaType) { System.out.println("entering BookWriter.getSize()"); System.out.println("leaving BookWriter.getSize()"); return -1; } @Override @Interceptors({Interceptor1.class}) @MethodBinding public void writeTo(Book t, Class type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap httpHeaders, OutputStream entityStream) throws IOException, WebApplicationException { System.out.println("entering BookWriter.writeTo()"); System.out.println("BookWriter.writeTo() writing " + t); delegate.writeTo(t, type, genericType, annotations, mediaType, httpHeaders, entityStream); System.out.println("leaving BookWriter.writeTo()"); } } BookWriterInterceptor.java000066400000000000000000000016371225215345600425360ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/interceptorspackage org.jboss.resteasy.cdi.interceptors; import java.io.IOException; import java.util.logging.Logger; import javax.inject.Inject; import javax.ws.rs.WebApplicationException; import javax.ws.rs.ext.Provider; import javax.ws.rs.ext.WriterInterceptor; import javax.ws.rs.ext.WriterInterceptorContext; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright Jul 23, 2012 */ @Provider public class BookWriterInterceptor implements WriterInterceptor { @Inject private Logger log; @Override @WriterInterceptorBinding public void aroundWriteTo(WriterInterceptorContext context) throws IOException, WebApplicationException { log.info("*** Intercepting call in BookWriterInterceptor.aroundWriteTo()"); VisitList.add(this); context.proceed(); log.info("*** Back from intercepting call in BookWriterInterceptor.aroundWriteTo()"); } } BookWriterInterceptorInterceptor.java000066400000000000000000000015171225215345600447520ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/interceptorspackage org.jboss.resteasy.cdi.interceptors; import java.util.logging.Logger; import javax.inject.Inject; import javax.interceptor.AroundInvoke; import javax.interceptor.Interceptor; import javax.interceptor.InvocationContext; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright Nov 13, 2012 */ @Interceptor @WriterInterceptorBinding public class BookWriterInterceptorInterceptor { @Inject private Logger log; @AroundInvoke public Object intercept(InvocationContext ctx) throws Exception { log.info("*** Intercepting call in BookWriterInterceptorInterceptor.intercept()"); VisitList.add(this); Object result = ctx.proceed(); log.info("*** Back from intercepting call in BookWriterInterceptorInterceptor.intercept()"); return result; } } ClassBinding.java000066400000000000000000000010621225215345600405600ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/interceptorspackage org.jboss.resteasy.cdi.interceptors; import static java.lang.annotation.ElementType.METHOD; import static java.lang.annotation.ElementType.TYPE; import static java.lang.annotation.RetentionPolicy.RUNTIME; import java.lang.annotation.Retention; import java.lang.annotation.Target; import javax.interceptor.InterceptorBinding; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright Jul 21, 2012 */ @InterceptorBinding @Target({TYPE, METHOD}) @Retention(RUNTIME) public @interface ClassBinding { } ClassInterceptorStereotype.java000066400000000000000000000010011225215345600435610ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/interceptorspackage org.jboss.resteasy.cdi.interceptors; import static java.lang.annotation.ElementType.TYPE; import static java.lang.annotation.RetentionPolicy.RUNTIME; import java.lang.annotation.Retention; import java.lang.annotation.Target; import javax.enterprise.inject.Stereotype; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright Dec 4, 2012 */ @ClassBinding @Stereotype @Target(TYPE) @Retention(RUNTIME) public @interface ClassInterceptorStereotype { } ClassMethodInterceptorStereotype.java000066400000000000000000000010441225215345600447310ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/interceptorspackage org.jboss.resteasy.cdi.interceptors; import static java.lang.annotation.ElementType.TYPE; import static java.lang.annotation.RetentionPolicy.RUNTIME; import java.lang.annotation.Retention; import java.lang.annotation.Target; import javax.enterprise.inject.Stereotype; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright Dec 4, 2012 */ @MethodBinding @ClassInterceptorStereotype @Stereotype @Target(TYPE) @Retention(RUNTIME) public @interface ClassMethodInterceptorStereotype { } FilterBinding.java000066400000000000000000000010461225215345600407420ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/interceptorspackage org.jboss.resteasy.cdi.interceptors; import static java.lang.annotation.ElementType.METHOD; import static java.lang.annotation.ElementType.TYPE; import static java.lang.annotation.RetentionPolicy.RUNTIME; import java.lang.annotation.Retention; import java.lang.annotation.Target; import javax.ws.rs.NameBinding; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright Nov 14, 2012 */ @NameBinding @Target({TYPE, METHOD}) @Retention(value = RUNTIME) public @interface FilterBinding { } Interceptor0.java000066400000000000000000000013061225215345600405770ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/interceptorspackage org.jboss.resteasy.cdi.interceptors; import java.util.logging.Logger; import javax.inject.Inject; import javax.interceptor.AroundInvoke; import javax.interceptor.InvocationContext; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright Jul 21, 2012 */ public class Interceptor0 { @Inject private Logger log; @AroundInvoke public Object intercept(InvocationContext ctx) throws Exception { log.info("*** Intercepting call in Interceptor0.intercept()"); VisitList.add(this); Object result = ctx.proceed(); log.info("*** Back from intercepting call in Interceptor0.intercept()"); return result; } } Interceptor1.java000066400000000000000000000013061225215345600406000ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/interceptorspackage org.jboss.resteasy.cdi.interceptors; import java.util.logging.Logger; import javax.inject.Inject; import javax.interceptor.AroundInvoke; import javax.interceptor.InvocationContext; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright Jul 21, 2012 */ public class Interceptor1 { @Inject private Logger log; @AroundInvoke public Object intercept(InvocationContext ctx) throws Exception { log.info("*** Intercepting call in Interceptor1.intercept()"); VisitList.add(this); Object result = ctx.proceed(); log.info("*** Back from intercepting call in Interceptor1.intercept()"); return result; } } Interceptor2.java000066400000000000000000000014071225215345600406030ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/interceptorspackage org.jboss.resteasy.cdi.interceptors; import java.util.logging.Logger; import javax.inject.Inject; import javax.interceptor.AroundInvoke; import javax.interceptor.Interceptor; import javax.interceptor.InvocationContext; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright Jul 21, 2012 */ @Interceptor @ClassBinding public class Interceptor2 { @Inject private Logger log; @AroundInvoke public Object intercept(InvocationContext ctx) throws Exception { log.info("*** Intercepting call in Interceptor2.intercept()"); VisitList.add(this); Object result = ctx.proceed(); log.info("*** Back from intercepting call in Interceptor2.intercept()"); return result; } } Interceptor3.java000066400000000000000000000014101225215345600405760ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/interceptorspackage org.jboss.resteasy.cdi.interceptors; import java.util.logging.Logger; import javax.inject.Inject; import javax.interceptor.AroundInvoke; import javax.interceptor.Interceptor; import javax.interceptor.InvocationContext; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright Jul 21, 2012 */ @Interceptor @MethodBinding public class Interceptor3 { @Inject private Logger log; @AroundInvoke public Object intercept(InvocationContext ctx) throws Exception { log.info("*** Intercepting call in Interceptor3.intercept()"); VisitList.add(this); Object result = ctx.proceed(); log.info("*** Back from intercepting call in Interceptor3.intercept()"); return result; } } InterceptorResource.java000066400000000000000000000214551225215345600422360ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/interceptorspackage org.jboss.resteasy.cdi.interceptors; import java.util.ArrayList; import java.util.HashMap; import java.util.Map; import java.util.concurrent.atomic.AtomicInteger; import java.util.logging.Logger; import javax.annotation.PostConstruct; import javax.enterprise.context.RequestScoped; import javax.inject.Inject; import javax.interceptor.Interceptors; import javax.ws.rs.Consumes; import javax.ws.rs.GET; import javax.ws.rs.POST; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.Produces; import javax.ws.rs.WebApplicationException; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import org.jboss.resteasy.cdi.util.Constants; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright May 7, 2012 */ @Path("/") @RequestScoped @Interceptors ({Interceptor0.class}) @ClassBinding @LifecycleBinding public class InterceptorResource { static private Map collection = new HashMap(); static private AtomicInteger counter = new AtomicInteger(); @Inject private Logger log; @Inject private Stereotyped stereotyped; @PostConstruct public void postConstruct() { log.info("executing InterceptorResource.postConstruct()"); } @javax.annotation.PreDestroy public void PreDestroy() { log.info("executing InterceptorResource.PreDestroy()"); } @POST @Path("create") @Consumes(Constants.MEDIA_TYPE_TEST_XML) @Produces(MediaType.TEXT_PLAIN) @Interceptors ({Interceptor1.class}) @MethodBinding @FilterBinding public Response createBook(Book book) { log.info("entering InterceptorResource.createBook()"); int id = counter.getAndIncrement(); book.setId(id); collection.put(id, book); log.info("stored: " + id + "->" + book); log.info("leaving InterceptorResource.createBook()"); return Response.ok(id).build(); } @GET @Path("book/{id:[0-9][0-9]*}") @Produces(Constants.MEDIA_TYPE_TEST_XML) @Interceptors ({Interceptor1.class}) @MethodBinding @FilterBinding public Book lookupBookById(@PathParam("id") int id) { log.info("entering InterceptorResource.lookupBookById(" + id + ")"); log.info("books: " + collection); Book book = collection.get(id); if (book == null) { throw new WebApplicationException(Response.Status.NOT_FOUND); } log.info("leaving InterceptorResource.lookupBookById(" + id + ")"); return book; } @POST @Path("test") @Produces(MediaType.TEXT_PLAIN) @Interceptors ({Interceptor1.class}) @MethodBinding public Response test() { log.info("entering InterceptorResource.test()"); stereotyped.test(); ArrayList> expectedList = new ArrayList>(); expectedList.add(RequestFilterInterceptor.class); // TestRequestFilter.filter() expectedList.add(BookReaderInterceptorInterceptor.class); // BookReaderInterceptor.aroundReadFrom() expectedList.add(BookReaderInterceptor.class); // BookReader.[isReadable() and readFrom()] expectedList.add(Interceptor0.class); // BookReader.isReadable() expectedList.add(Interceptor2.class); // BookReader.isReadable() expectedList.add(Interceptor0.class); // BookReader.readFrom() expectedList.add(Interceptor1.class); // BookReader.readFrom() expectedList.add(Interceptor2.class); // BookReader.readFrom() expectedList.add(Interceptor3.class); // BookReader.readFrom() expectedList.add(PostConstructInterceptor.class); // InterceptorResource.postConstruct() expectedList.add(Interceptor0.class); // InterceptorResource.createBook() expectedList.add(Interceptor1.class); // InterceptorResource.createBook() expectedList.add(Interceptor2.class); // InterceptorResource.createBook() expectedList.add(Interceptor3.class); // InterceptorResource.createBook() expectedList.add(ResponseFilterInterceptor.class); // TestResponseFilter.filter() expectedList.add(BookWriterInterceptorInterceptor.class); // BookWriterInterceptor.aroundWriteTo() expectedList.add(BookWriterInterceptor.class); // BookWriter.writeTo() expectedList.add(PreDestroyInterceptor.class); // InterceptorResource.preDestroy() expectedList.add(RequestFilterInterceptor.class); // TestRequestFilter.filter() expectedList.add(PostConstructInterceptor.class); // InterceptorResource.postConstruct() expectedList.add(Interceptor0.class); // InterceptorResource.lookBookById() expectedList.add(Interceptor1.class); // InterceptorResource.lookBookById() expectedList.add(Interceptor2.class); // InterceptorResource.lookBookById() expectedList.add(Interceptor3.class); // InterceptorResource.lookBookById() expectedList.add(ResponseFilterInterceptor.class); // TestResponseFilter.filter() expectedList.add(Interceptor0.class); // BookWriter.isWriteable() // Called as initial check expectedList.add(Interceptor2.class); // BookWriter.isWriteable() // Called as initial check expectedList.add(BookWriterInterceptorInterceptor.class); // BookWriterInterceptor.aroundWriteTo() expectedList.add(BookWriterInterceptor.class); // BookWriter.[isWriteable() and writeTo()] expectedList.add(Interceptor0.class); // BookWriter.isWriteable() expectedList.add(Interceptor2.class); // BookWriter.isWriteable() expectedList.add(Interceptor0.class); // BookWriter.writeTo() expectedList.add(Interceptor1.class); // BookWriter.writeTo() expectedList.add(Interceptor2.class); // BookWriter.writeTo() expectedList.add(Interceptor3.class); // BookWriter.writeTo() expectedList.add(PreDestroyInterceptor.class); // InterceptorResource.preDestroy() expectedList.add(BookReaderInterceptorInterceptor.class); // BookReaderInterceptor.aroundReadFrom() expectedList.add(BookReaderInterceptor.class); // BookReader.[isReadable() and readFrom()] expectedList.add(Interceptor0.class); // BookReader.isReadable() expectedList.add(Interceptor2.class); // BookReader.isReadable() expectedList.add(Interceptor0.class); // BookReader.readFrom() expectedList.add(Interceptor1.class); // BookReader.readFrom() expectedList.add(Interceptor2.class); // BookReader.readFrom() expectedList.add(Interceptor3.class); // BookReader.readFrom() expectedList.add(PostConstructInterceptor.class); // InterceptorResource.postConstruct() expectedList.add(Interceptor0.class); // InterceptorResource.test() expectedList.add(Interceptor1.class); // InterceptorResource.test() expectedList.add(Interceptor2.class); // InterceptorResource.test() expectedList.add(Interceptor3.class); // InterceptorResource.test() expectedList.add(Interceptor2.class); // Stereotyped.test() expectedList.add(Interceptor3.class); // Stereotyped.test() ArrayList visitList = VisitList.getList(); boolean status = expectedList.size() == visitList.size(); if (!status) { log.info("expectedList.size() [" + expectedList.size() + "] != visitList.size() [" + visitList.size() + "]"); } for (int i = 0; i < expectedList.size(); i++) { if (!expectedList.get(i).isAssignableFrom(visitList.get(i).getClass())) { status = false; log.info("visitList.get(" + i + ") incorrect: should be an instance of: " + expectedList.get(i) + ", is: " + visitList.get(i)); break; } } if (!status) { log.info("\rexpected list:"); for (int i = 0; i < expectedList.size(); i++) { log.info(i + ": " + expectedList.get(i).toString()); } log.info("\rvisited list:"); for (int i = 0; i < visitList.size(); i++) { log.info(i + ": " + visitList.get(i).toString()); } } log.info("leaving InterceptorResource.test()"); return status ? Response.ok().build() : Response.serverError().build(); } } JaxRsActivator.java000066400000000000000000000010041225215345600411200ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/interceptorspackage org.jboss.resteasy.cdi.interceptors; import javax.ws.rs.ApplicationPath; import javax.ws.rs.core.Application; /** * A class extending {@link Application} and annotated with @ApplicationPath is the Java EE 6 * "no XML" approach to activating JAX-RS. * *

* Resources are served relative to the servlet path specified in the {@link ApplicationPath} * annotation. *

*/ @ApplicationPath("/rest") public class JaxRsActivator extends Application { /* class body intentionally left blank */ } LifecycleBinding.java000066400000000000000000000007741225215345600414230ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/interceptorspackage org.jboss.resteasy.cdi.interceptors; import static java.lang.annotation.ElementType.TYPE; import static java.lang.annotation.RetentionPolicy.RUNTIME; import java.lang.annotation.Retention; import java.lang.annotation.Target; import javax.interceptor.InterceptorBinding; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright Nov 14, 2012 */ @InterceptorBinding @Target(TYPE) @Retention(value = RUNTIME) public @interface LifecycleBinding { } MethodBinding.java000066400000000000000000000010631225215345600407340ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/interceptorspackage org.jboss.resteasy.cdi.interceptors; import static java.lang.annotation.ElementType.METHOD; import static java.lang.annotation.ElementType.TYPE; import static java.lang.annotation.RetentionPolicy.RUNTIME; import java.lang.annotation.Retention; import java.lang.annotation.Target; import javax.interceptor.InterceptorBinding; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright Jul 21, 2012 */ @InterceptorBinding @Target({TYPE, METHOD}) @Retention(RUNTIME) public @interface MethodBinding { } PostConstructInterceptor.java000066400000000000000000000014101225215345600432660ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/interceptorspackage org.jboss.resteasy.cdi.interceptors; import java.util.logging.Logger; import javax.annotation.PostConstruct; import javax.inject.Inject; import javax.interceptor.Interceptor; import javax.interceptor.InvocationContext; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright Dec 19, 2012 */ @LifecycleBinding @Interceptor public class PostConstructInterceptor { @Inject private Logger log; @PostConstruct public void intercept(InvocationContext ctx) throws Exception { log.info("*** Intercepting call in PostConstructInterceptor.intercept()"); VisitList.add(this); ctx.proceed(); log.info("*** Back from intercepting call in PostConstructInterceptor.intercept()"); } } PreDestroyInterceptor.java000066400000000000000000000013711225215345600425420ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/interceptorspackage org.jboss.resteasy.cdi.interceptors; import java.util.logging.Logger; import javax.annotation.PreDestroy; import javax.inject.Inject; import javax.interceptor.Interceptor; import javax.interceptor.InvocationContext; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright Dec 19, 2012 */ @LifecycleBinding @Interceptor public class PreDestroyInterceptor { @Inject private Logger log; @PreDestroy public void intercept(InvocationContext ctx) throws Exception { log.info("*** Intercepting call in PreDestroyInterceptor.intercept()"); VisitList.add(this); ctx.proceed(); log.info("*** Back from intercepting call in PreDestroyInterceptor.intercept()"); } } ReaderInterceptorBinding.java000066400000000000000000000010761225215345600431410ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/interceptorspackage org.jboss.resteasy.cdi.interceptors; import static java.lang.annotation.ElementType.METHOD; import static java.lang.annotation.ElementType.TYPE; import static java.lang.annotation.RetentionPolicy.RUNTIME; import java.lang.annotation.Retention; import java.lang.annotation.Target; import javax.interceptor.InterceptorBinding; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright Nov 13, 2012 */ @InterceptorBinding @Target({TYPE, METHOD}) @Retention(RUNTIME) public @interface ReaderInterceptorBinding { } RequestFilterInterceptor.java000066400000000000000000000014751225215345600432450ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/interceptorspackage org.jboss.resteasy.cdi.interceptors; import java.util.logging.Logger; import javax.inject.Inject; import javax.interceptor.AroundInvoke; import javax.interceptor.Interceptor; import javax.interceptor.InvocationContext; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright Nov 15, 2012 */ @Interceptor @RequestFilterInterceptorBinding public class RequestFilterInterceptor { @Inject private Logger log; @AroundInvoke public Object intercept(InvocationContext ctx) throws Exception { log.info("*** Intercepting call in RequestFilterInterceptor.intercept()"); VisitList.add(this); Object result = ctx.proceed(); log.info("*** Back from intercepting call in RequestFilterInterceptor.intercept()"); return result; } } RequestFilterInterceptorBinding.java000066400000000000000000000011141225215345600445260ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/interceptorspackage org.jboss.resteasy.cdi.interceptors; import static java.lang.annotation.ElementType.METHOD; import static java.lang.annotation.ElementType.TYPE; import static java.lang.annotation.RetentionPolicy.RUNTIME; import java.lang.annotation.Retention; import java.lang.annotation.Target; import javax.interceptor.InterceptorBinding; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright Nov 14, 2012 */ @InterceptorBinding @Target({TYPE, METHOD}) @Retention(value = RUNTIME) public @interface RequestFilterInterceptorBinding { } ResponseFilterInterceptor.java000066400000000000000000000015011225215345600434010ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/interceptorspackage org.jboss.resteasy.cdi.interceptors; import java.util.logging.Logger; import javax.inject.Inject; import javax.interceptor.AroundInvoke; import javax.interceptor.Interceptor; import javax.interceptor.InvocationContext; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright Nov 15, 2012 */ @Interceptor @ResponseFilterInterceptorBinding public class ResponseFilterInterceptor { @Inject private Logger log; @AroundInvoke public Object intercept(InvocationContext ctx) throws Exception { log.info("*** Intercepting call in ResponseFilterInterceptor.intercept()"); VisitList.add(this); Object result = ctx.proceed(); log.info("*** Back from intercepting call in ResponseFilterInterceptor.intercept()"); return result; } } ResponseFilterInterceptorBinding.java000066400000000000000000000011151225215345600446750ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/interceptorspackage org.jboss.resteasy.cdi.interceptors; import static java.lang.annotation.ElementType.METHOD; import static java.lang.annotation.ElementType.TYPE; import static java.lang.annotation.RetentionPolicy.RUNTIME; import java.lang.annotation.Retention; import java.lang.annotation.Target; import javax.interceptor.InterceptorBinding; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright Nov 14, 2012 */ @InterceptorBinding @Target({TYPE, METHOD}) @Retention(value = RUNTIME) public @interface ResponseFilterInterceptorBinding { } Stereotyped.java000066400000000000000000000006211225215345600405270ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/interceptorspackage org.jboss.resteasy.cdi.interceptors; import java.util.logging.Logger; import javax.inject.Inject; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright Dec 4, 2012 */ @ClassMethodInterceptorStereotype public class Stereotyped { @Inject private Logger log; public void test() { log.info("Stereotyped.test()"); } } TestRequestFilter.java000066400000000000000000000013241225215345600416570ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/interceptorspackage org.jboss.resteasy.cdi.interceptors; import java.io.IOException; import java.util.logging.Logger; import javax.inject.Inject; import javax.ws.rs.container.ContainerRequestContext; import javax.ws.rs.container.ContainerRequestFilter; import javax.ws.rs.ext.Provider; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright Nov 14, 2012 */ @Provider @FilterBinding @RequestFilterInterceptorBinding public class TestRequestFilter implements ContainerRequestFilter { @Inject private Logger log; @Override public void filter(ContainerRequestContext requestContext) throws IOException { log.info("executing TestRequestFilter.filter()"); } } TestResponseFilter.java000066400000000000000000000014701225215345600420270ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/interceptorspackage org.jboss.resteasy.cdi.interceptors; import java.io.IOException; import java.util.logging.Logger; import javax.inject.Inject; import javax.ws.rs.container.ContainerRequestContext; import javax.ws.rs.container.ContainerResponseContext; import javax.ws.rs.container.ContainerResponseFilter; import javax.ws.rs.ext.Provider; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright Nov 14, 2012 */ @Provider @FilterBinding @ResponseFilterInterceptorBinding public class TestResponseFilter implements ContainerResponseFilter { @Inject private Logger log; @Override public void filter(ContainerRequestContext requestContext, ContainerResponseContext responseContext) throws IOException { log.info("executing TestResponseFilter.filter()"); } } TimerInterceptorResource.java000066400000000000000000000045451225215345600432400ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/interceptorspackage org.jboss.resteasy.cdi.interceptors; import java.util.concurrent.CountDownLatch; import java.util.logging.Logger; import javax.annotation.Resource; import javax.ejb.SessionContext; import javax.ejb.Stateless; import javax.ejb.Timeout; import javax.ejb.Timer; import javax.ejb.TimerService; import javax.inject.Inject; import javax.interceptor.AroundTimeout; import javax.interceptor.InvocationContext; import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.core.Response; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright May 7, 2012 */ @Path("timer") @Stateless public class TimerInterceptorResource implements TimerInterceptorResourceIntf { static private final String TIMER_INFO = "timerInfo"; static private CountDownLatch latch = new CountDownLatch(1); static private boolean timerExpired; static private boolean timerInterceptorInvoked; @Inject private Logger log; @Resource private SessionContext ctx; private TimerService timerService; @Override @GET @Path("schedule") public Response scheduleTimer() { log.info("entering scheduleTimer()"); timerService = ctx.getTimerService(); if (timerService != null) { timerService.createTimer(1000, TIMER_INFO); log.info("timer scheduled"); return Response.ok().build(); } else { return Response.serverError().build(); } } @Override @GET @Path("test") public Response testTimer() throws InterruptedException { log.info("entering testTimer()"); latch.await(); if (!timerInterceptorInvoked) { return Response.serverError().entity("timerInterceptorInvoked == false").build(); } if (!timerExpired) { return Response.serverError().entity("timerExpired == false").build(); } return Response.ok().build(); } @Override @Timeout public void timeout(Timer timer) { log.info("entering timeout()"); if (TIMER_INFO.equals(timer.getInfo())) { timerExpired = true; latch.countDown(); } } @AroundTimeout public Object aroundTimeout(InvocationContext ctx) throws Exception { timerInterceptorInvoked = true; log.info("aroundTimeout() invoked"); return ctx.proceed(); } } TimerInterceptorResourceIntf.java000066400000000000000000000007641225215345600440600ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/interceptorspackage org.jboss.resteasy.cdi.interceptors; import javax.ejb.Local; import javax.ejb.Timeout; import javax.ejb.Timer; import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.core.Response; @Local public interface TimerInterceptorResourceIntf { @GET @Path("timer/schedule") public abstract Response scheduleTimer(); @GET @Path("timer/test") public abstract Response testTimer() throws InterruptedException; @Timeout public abstract void timeout(Timer timer); }VisitList.java000066400000000000000000000007651225215345600401630ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/interceptorspackage org.jboss.resteasy.cdi.interceptors; import java.util.ArrayList; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright Jul 21, 2012 */ public class VisitList { static private ArrayList visitList = new ArrayList(); static public void add(Object interceptor) { visitList.add(interceptor); } static public ArrayList getList() { return new ArrayList(visitList); } } WriterInterceptorBinding.java000066400000000000000000000010761225215345600432130ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/interceptorspackage org.jboss.resteasy.cdi.interceptors; import static java.lang.annotation.ElementType.METHOD; import static java.lang.annotation.ElementType.TYPE; import static java.lang.annotation.RetentionPolicy.RUNTIME; import java.lang.annotation.Retention; import java.lang.annotation.Target; import javax.interceptor.InterceptorBinding; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright Nov 13, 2012 */ @InterceptorBinding @Target({TYPE, METHOD}) @Retention(RUNTIME) public @interface WriterInterceptorBinding { } package-info.java000066400000000000000000000011361225215345600405460ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/interceptors/** * This package (along with @see org.jboss.resteasy.test.cdi.interceptors) tests the application * of interceptors to: * * *) ContainerRequestFilter * *) ContainerResponseFilter * *) ReaderInterceptor * *) MessageBodyReader * *) WriterInterceptor * *) MessageBodyWriter * *) Resources * * There are class level interceptors and method level interceptors. Some of them are bound through * the use of the @Interceptors annotation, and some are bound through CDI interceptor binding types. * * @see org.jboss.resteasy.package-info.java */ package org.jboss.resteasy.cdi.interceptors; 000077500000000000000000000000001225215345600343055ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/modulesInjectable.java000066400000000000000000000004261225215345600372120ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/modulespackage org.jboss.resteasy.cdi.modules; import javax.ejb.Stateless; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright Dec 20, 2012 */ @Stateless @InjectableBinder public class Injectable implements InjectableIntf { } InjectableBinder.java000066400000000000000000000012401225215345600403310ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/modulespackage org.jboss.resteasy.cdi.modules; import static java.lang.annotation.ElementType.FIELD; import static java.lang.annotation.ElementType.METHOD; import static java.lang.annotation.ElementType.PARAMETER; import static java.lang.annotation.ElementType.TYPE; import static java.lang.annotation.RetentionPolicy.RUNTIME; import java.lang.annotation.Retention; import java.lang.annotation.Target; import javax.inject.Qualifier; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright Dec 14, 2012 */ @Qualifier @Retention(RUNTIME) @Target({METHOD, FIELD, PARAMETER, TYPE}) public @interface InjectableBinder { } InjectableIntf.java000066400000000000000000000003521225215345600400310ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/modulespackage org.jboss.resteasy.cdi.modules; import javax.ejb.Local; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright Dec 20, 2012 */ @Local public interface InjectableIntf { }JaxRsActivator.java000066400000000000000000000007771225215345600400670ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/modulespackage org.jboss.resteasy.cdi.modules; import javax.ws.rs.ApplicationPath; import javax.ws.rs.core.Application; /** * A class extending {@link Application} and annotated with @ApplicationPath is the Java EE 6 * "no XML" approach to activating JAX-RS. * *

* Resources are served relative to the servlet path specified in the {@link ApplicationPath} * annotation. *

*/ @ApplicationPath("/rest") public class JaxRsActivator extends Application { /* class body intentionally left blank */ } ModulesResource.java000066400000000000000000000013661225215345600402760ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/modulespackage org.jboss.resteasy.cdi.modules; import java.util.logging.Logger; import javax.ejb.Stateless; import javax.inject.Inject; import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.core.Response; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright Dec 18, 2012 */ @Stateless @Path("modules") public class ModulesResource implements ModulesResourceIntf { @Inject private Logger log; @Inject @InjectableBinder private InjectableIntf injectable; @Override @GET @Path("test") public Response test() { log.info("entering TestResource.test()"); return (injectable != null) ? Response.ok().build() : Response.serverError().build(); } } ModulesResourceIntf.java000066400000000000000000000006011225215345600411060ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/modulespackage org.jboss.resteasy.cdi.modules; import javax.ejb.Local; import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.core.Response; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright Dec 20, 2012 */ @Local public interface ModulesResourceIntf { @GET @Path("test") public abstract Response test(); }package-info.java000066400000000000000000000004171225215345600374760ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/modules/** * This package (along with @see org.jboss.resteasy.test.cdi.modules) tests injection * of beans into JAX-RS resources across various jar, ejb-jar, war, and ear boundaries. * * @see org.jboss.resteasy.package-info.java */ package org.jboss.resteasy.cdi.modules; 000077500000000000000000000000001225215345600336125ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/utilConstants.java000066400000000000000000000006231225215345600364320ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/utilpackage org.jboss.resteasy.cdi.util; import javax.ws.rs.core.MediaType; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright Jun 29, 2012 */ public class Constants { public static final String MEDIA_TYPE_TEST_XML = "application/test+xml"; public static final MediaType MEDIA_TYPE_TEST_XML_TYPE = MediaType.valueOf(MEDIA_TYPE_TEST_XML); } Counter.java000066400000000000000000000012671225215345600361020ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/utilpackage org.jboss.resteasy.cdi.util; import java.util.concurrent.atomic.AtomicInteger; import javax.ejb.Singleton; import javax.enterprise.context.ApplicationScoped; /** * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright May 8, 2012 */ @Singleton @CounterBinding @ApplicationScoped public class Counter { public static final int INITIAL_VALUE = 17; private static AtomicInteger counter = new AtomicInteger(INITIAL_VALUE); public int getNext() { System.out.println("In Counter: counter: " + counter); return counter.getAndIncrement(); } public void reset() { counter.set(INITIAL_VALUE); } } CounterBinding.java000066400000000000000000000012261225215345600373700ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/utilpackage org.jboss.resteasy.cdi.util; import static java.lang.annotation.ElementType.FIELD; import static java.lang.annotation.ElementType.METHOD; import static java.lang.annotation.ElementType.PARAMETER; import static java.lang.annotation.ElementType.TYPE; import static java.lang.annotation.RetentionPolicy.RUNTIME; import java.lang.annotation.Retention; import java.lang.annotation.Target; import javax.inject.Qualifier; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright Nov 19, 2012 */ @Qualifier @Retention(RUNTIME) @Target({METHOD, FIELD, PARAMETER, TYPE}) public @interface CounterBinding { } PersistenceUnitProducer.java000066400000000000000000000007621225215345600413120ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/utilpackage org.jboss.resteasy.cdi.util; import javax.enterprise.inject.Produces; import javax.persistence.EntityManager; import javax.persistence.PersistenceContext; import org.jboss.resteasy.cdi.injection.ResourceBinding; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright Jun 11, 2012 */ public class PersistenceUnitProducer { @Produces @ResourceBinding @PersistenceContext(unitName="test") EntityManager persistenceContext; } Utilities.java000066400000000000000000000152471225215345600364410ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/utilpackage org.jboss.resteasy.cdi.util; import java.lang.annotation.Annotation; import java.lang.reflect.Type; import java.util.Arrays; import java.util.HashSet; import java.util.Iterator; import java.util.Set; import javax.ejb.Singleton; import javax.enterprise.context.ApplicationScoped; import javax.enterprise.context.Dependent; import javax.enterprise.context.NormalScope; import javax.enterprise.context.RequestScoped; import javax.enterprise.context.SessionScoped; import javax.enterprise.inject.spi.Bean; import javax.enterprise.inject.spi.BeanManager; import javax.inject.Inject; import javax.inject.Qualifier; import org.jboss.resteasy.cdi.extension.bean.Boston; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright May 30, 2012 */ @Singleton public class Utilities { @Inject private BeanManager beanManager; public boolean isApplicationScoped(Class c) { return testScope(c, ApplicationScoped.class); } public boolean isDependentScoped(Class c) { return testScope(c, Dependent.class); } public boolean isRequestScoped(Class c) { return testScope(c, RequestScoped.class); } public boolean isSessionScoped(Class c) { return testScope(c, SessionScoped.class); } public boolean testScope(Class c, Class scopeClass) { Class annotation = getScope(c); if (annotation == null) { return false; } return annotation.isAssignableFrom(scopeClass); } public Class getScope(Class c) { // Set> allBeans = beanManager.getBeans(Object.class); //// System.out.println(allBeans); //// Iterator> it2 = allBeans.iterator(); //// while (it2.hasNext()) //// { //// System.out.println(it2.next()); //// } // Iterator> it = allBeans.iterator(); // while (it.hasNext()) // { // Bean b = it.next(); // if (c.equals(b.getBeanClass())) // { // return b.getScope(); // } // } // return null; Set> beans = beanManager.getBeans(c); if (beans != null && !beans.isEmpty()) { Iterator> it = beans.iterator(); if (it.hasNext()) { Bean bean = beans.iterator().next(); return bean.getScope(); } } // for (Annotation annotation: c.getAnnotations()) // { // if (beanManager.isScope(annotation.annotationType())) // { // return annotation.annotationType(); // } // } return null; } static public Class getScopeAnnotation(Class c) { return getScopeAnnotation(c.getAnnotations()); } static public Class getScopeAnnotation(Annotation[] annotations) { for (int i = 0; i < annotations.length; i++) { Class annotationType = annotations[i].annotationType(); Annotation[] typeAnnotations = annotationType.getAnnotations(); for (int j = 0; j < typeAnnotations.length; j++) { if (NormalScope.class.equals(typeAnnotations[j].annotationType())) { return annotationType; } } } return null; } static public Class getScopeAnnotation(Set annotations) { for (Annotation annotation : annotations) { Class annotationType = annotation.annotationType(); Annotation[] typeAnnotations = annotationType.getAnnotations(); for (int j = 0; j < typeAnnotations.length; j++) { if (NormalScope.class.equals(typeAnnotations[j].annotationType())) { return annotationType; } } } return null; } static public Set getQualifiers(Class clazz) { return getQualifiers(clazz.getAnnotations()); } static public Set getQualifiers(Annotation[] annotations) { HashSet result = new HashSet(); for (int i = 0; i < annotations.length; i++) { Class annotationType = annotations[i].annotationType(); Annotation[] typeAnnotations = annotationType.getAnnotations(); for (int j = 0; j < typeAnnotations.length; j++) { if (Qualifier.class.equals(typeAnnotations[j].annotationType())) { result.add(annotations[i]); break; } } } return result; } static public boolean hasQualifier(Class clazz, Class qualifier) { Annotation[] annotations = clazz.getAnnotations(); for (int i = 0; i < annotations.length; i++) { if (qualifier.equals(annotations[i].annotationType())) { return true; } } return false; } static public boolean hasQualifier(Set annotations, Class qualifier) { for (Annotation annotation: annotations) { if (qualifier.equals(annotation.annotationType())) { return true; } } return false; } static public boolean isBoston(Class clazz) { return hasQualifier(clazz, Boston.class); } static public Set getTypeClosure(Class clazz) { HashSet set = new HashSet(); accumulateTypes(set, clazz); return set; } static void accumulateTypes(Set set, Class clazz) { set.add(clazz); if (clazz.getSuperclass() != null) { accumulateTypes(set, clazz.getSuperclass()); } for (Class c : clazz.getInterfaces()) { accumulateTypes(set, c); } } static public Set getAnnotationSet(Class clazz) { return new HashSet(Arrays.asList(clazz.getAnnotations())); } static public boolean isAnnotationPresent(Class clazz, Class annotationType) { for (Annotation annotation : clazz.getAnnotations()) { if (annotation.annotationType().equals(annotationType)) { return true; } } return false; } @SuppressWarnings("unchecked") static public T getAnnotation(Class clazz, Class annotationType) { for (Annotation annotation : clazz.getAnnotations()) { if (annotation.annotationType().equals(annotationType)) { return (T) annotation; } } return null; } } UtilityProducer.java000066400000000000000000000012161225215345600376240ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/utilpackage org.jboss.resteasy.cdi.util; import java.util.Random; import java.util.logging.Logger; import javax.enterprise.inject.Produces; import javax.enterprise.inject.spi.InjectionPoint; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright Jun 11, 2012 */ public class UtilityProducer { static private Random random = new Random(); @Produces public Logger produceLog(InjectionPoint injectionPoint) { return Logger.getLogger(injectionPoint.getMember().getDeclaringClass().getName()); } @Produces public int randomInt() { return random.nextInt(); } } 000077500000000000000000000000001225215345600347675ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/validationErroneousResource.java000066400000000000000000000014361225215345600413270ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/validationpackage org.jboss.resteasy.cdi.validation; import javax.ejb.Local; import javax.validation.constraints.Max; import javax.validation.constraints.Min; import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.core.Response; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright Dec 25, 2012 */ @Local @SumConstraint(min=3, max=17) public interface ErroneousResource extends ResourceParent { public abstract int getNumberOne(); @Max(13) @Override public abstract int getNumberTwo(); public abstract void setNumberOne(int one); public abstract void setNumberTwo(int two); @GET @Path("correct/test/{num}") public Response test(@Min(5) @Max(10) @PathParam("num") int num); }ErroneousResourceImpl.java000066400000000000000000000026001225215345600421430ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/validationpackage org.jboss.resteasy.cdi.validation; import java.util.logging.Logger; import javax.ejb.Stateless; import javax.inject.Inject; import javax.validation.constraints.Max; import javax.validation.constraints.Min; import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.core.Response; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright Dec 25, 2012 */ @Path("/") @Stateless @SumConstraint(min=3, max=17) public class ErroneousResourceImpl implements ErroneousResource { @Inject private Logger log; @Inject @NumberOneBinding @Min(13) private int numberOne; private int numberTwo; @GET @Path("incorrect/test/{num}") public Response test(@Min(5) @Max(10) @PathParam("num") int num) { log.info("entering ErroneousResourceImpl.test()"); System.out.println("entering testClassValidator(): numberOne: " + numberOne + ", numberTwo: " + numberTwo); return Response.ok().build(); } @Override public int getNumberOne() { return numberOne; } @Max(13) @Override public int getNumberTwo() { return numberTwo; } @Override public void setNumberOne(int one) { numberOne = one; } @Override @Inject public void setNumberTwo(@NumberTwoBinding int two) { numberTwo = two; } } ErrorFreeResource.java000066400000000000000000000013251225215345600412360ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/validationpackage org.jboss.resteasy.cdi.validation; import javax.ejb.Local; import javax.validation.constraints.Max; import javax.validation.constraints.Min; import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.PathParam; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright Dec 25, 2012 */ @Local @Path("correct") public interface ErrorFreeResource extends ResourceParent { @GET @Path("test/{num}") @Max(10) public int test(@Min(5) @Max(10) @PathParam("num") int num); public abstract int getNumberOne(); public abstract int getNumberTwo(); public abstract void setNumberOne(int one); public abstract void setNumberTwo(int two); }ErrorFreeResourceImpl.java000066400000000000000000000023671225215345600420670ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/validationpackage org.jboss.resteasy.cdi.validation; import java.util.logging.Logger; import javax.ejb.Stateless; import javax.inject.Inject; import javax.validation.constraints.Max; import javax.validation.constraints.Min; import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.PathParam; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright Dec 25, 2012 */ @Path("correct") @Stateless @SumConstraint(min=3, max=17) public class ErrorFreeResourceImpl implements ErrorFreeResource { @Inject private Logger log; @Inject @Min(3) @Max(7) @NumberOneBinding private int numberOne; private int numberTwo; @GET @Path("test/{num}") @Max(10) public int test(@Min(5) @Max(10) @PathParam("num") int num) { log.info("entering ErrorFreeResourceImpl.test()"); return num + 1; } @Override public int getNumberOne() { return numberOne; } @Override @Min(13) @Max(17) public int getNumberTwo() { return numberTwo; } @Override public void setNumberOne(int one) { numberOne = one; } @Override @Inject public void setNumberTwo(@NumberTwoBinding int two) { numberTwo = two; } } IntegerProducer.java000066400000000000000000000010031225215345600407250ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/validationpackage org.jboss.resteasy.cdi.validation; import javax.enterprise.context.ApplicationScoped; import javax.enterprise.inject.Produces; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright Dec 25, 2012 */ @ApplicationScoped public class IntegerProducer { @Produces @NumberOneBinding int numberOne = 5; @Produces @NumberOneErrorBinding int numberOneError = 10; @Produces @NumberTwoBinding int numberTwo = 15; } JaxRsActivator.java000066400000000000000000000010021225215345600405270ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/validationpackage org.jboss.resteasy.cdi.validation; import javax.ws.rs.ApplicationPath; import javax.ws.rs.core.Application; /** * A class extending {@link Application} and annotated with @ApplicationPath is the Java EE 6 * "no XML" approach to activating JAX-RS. * *

* Resources are served relative to the servlet path specified in the {@link ApplicationPath} * annotation. *

*/ @ApplicationPath("/rest") public class JaxRsActivator extends Application { /* class body intentionally left blank */ } NumberOneBinding.java000066400000000000000000000012431225215345600410170ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/validationpackage org.jboss.resteasy.cdi.validation; import static java.lang.annotation.ElementType.FIELD; import static java.lang.annotation.ElementType.METHOD; import static java.lang.annotation.ElementType.PARAMETER; import static java.lang.annotation.ElementType.TYPE; import static java.lang.annotation.RetentionPolicy.RUNTIME; import java.lang.annotation.Retention; import java.lang.annotation.Target; import javax.inject.Qualifier; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright Dec 25, 2012 */ @Qualifier @Retention(RUNTIME) @Target({METHOD, FIELD, PARAMETER, TYPE}) public @interface NumberOneBinding { } NumberOneErrorBinding.java000066400000000000000000000012501225215345600420270ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/validationpackage org.jboss.resteasy.cdi.validation; import static java.lang.annotation.ElementType.FIELD; import static java.lang.annotation.ElementType.METHOD; import static java.lang.annotation.ElementType.PARAMETER; import static java.lang.annotation.ElementType.TYPE; import static java.lang.annotation.RetentionPolicy.RUNTIME; import java.lang.annotation.Retention; import java.lang.annotation.Target; import javax.inject.Qualifier; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright Dec 25, 2012 */ @Qualifier @Retention(RUNTIME) @Target({METHOD, FIELD, PARAMETER, TYPE}) public @interface NumberOneErrorBinding { } NumberTwoBinding.java000066400000000000000000000012431225215345600410470ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/validationpackage org.jboss.resteasy.cdi.validation; import static java.lang.annotation.ElementType.FIELD; import static java.lang.annotation.ElementType.METHOD; import static java.lang.annotation.ElementType.PARAMETER; import static java.lang.annotation.ElementType.TYPE; import static java.lang.annotation.RetentionPolicy.RUNTIME; import java.lang.annotation.Retention; import java.lang.annotation.Target; import javax.inject.Qualifier; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright Dec 25, 2012 */ @Qualifier @Retention(RUNTIME) @Target({METHOD, FIELD, PARAMETER, TYPE}) public @interface NumberTwoBinding { } ResourceParent.java000066400000000000000000000004331225215345600405730ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/validationpackage org.jboss.resteasy.cdi.validation; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright Jan 3, 2013 */ public interface ResourceParent { public abstract int getNumberOne(); public abstract int getNumberTwo(); } SumConstraint.java000066400000000000000000000013741225215345600404500ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/validationpackage org.jboss.resteasy.cdi.validation; import static java.lang.annotation.ElementType.TYPE; import static java.lang.annotation.RetentionPolicy.RUNTIME; import java.lang.annotation.Retention; import java.lang.annotation.Target; import javax.validation.Constraint; import javax.validation.Payload; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright Dec 25, 2012 */ @Target(TYPE) @Retention(RUNTIME) @Constraint(validatedBy = SumValidator.class) public @interface SumConstraint { String message() default "{org.jboss.resteasy.ejb.validation.SumConstraint}"; Class[] groups() default {}; Class[] payload() default {}; int min() default 0; int max() default 1024; } SumValidator.java000066400000000000000000000017241225215345600402500ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/validationpackage org.jboss.resteasy.cdi.validation; import javax.enterprise.context.ApplicationScoped; import javax.validation.ConstraintValidator; import javax.validation.ConstraintValidatorContext; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright Dec 25, 2012 */ @ApplicationScoped public class SumValidator implements ConstraintValidator { private int min; private int max; public void initialize(SumConstraint constraint) { min = constraint.min(); max = constraint.max(); } public boolean isValid(ResourceParent value, ConstraintValidatorContext context) { System.out.println("entering SumValidator.isValid(): min: " + min + ", max; " + max); System.out.println("one: " + value.getNumberOne() + ", two: " + value.getNumberTwo()); int sum = value.getNumberOne() + value.getNumberTwo(); return min <= sum && sum <= max; } } package-info.java000066400000000000000000000004111225215345600401520ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/validation/** * This package (along with @see org.jboss.resteasy.test.cdi.validation) tests the application * of validation (@see JSR 303: Bean Validation) to JAX-RS resources. * * @see org.jboss.resteasy.package-info.java */ package org.jboss.resteasy.cdi.validation; package-info.java000066400000000000000000000113611225215345600352670ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/** * This test suite is designed to exercise various interactions between Resteasy, CDI, and EJBs. * Among the topics covered are: * * I. Injection into JAX-RS * * A. @see org.jboss.resteasy.cdi.injection, @see org.jboss.resteasy.test.cdi.injection * B. Loggers, integers, BeanManagers, EntityManagers, SLSBs, SFSBs, JMS objects * C. Injected into JAX-RS resources, MessageBodyReaders, MessageBodyWriters, ReaderInterceptors, WriterInterceptors * D. Using @Inject, @EJB * E. Qualifiers * F. Issue: https://community.jboss.org/thread/213568?start=15&tstart=0 * * II. Injection from JAX-RS * * A. @see org.jboss.resteasy.cdi.injection.reverse, @see org.jboss.resteasy.test.cdi.injection.reverse * B. Of JAX-RS resources, MessageBodyReaders, MessageBodyWriters * C. Into SLSBs, SFSBs * * III. Generic types * * A. @see org.jboss.resteasy.cdi.generic, @see org.jboss.resteasy.test.cdi.generic * B. Generically typed beans are injected into JAX-RS resources and decorators, testing * upper and lower bounded wildcard types. * C. Issue: https://community.jboss.org/message/784561#784561 * * IV. EJBs * * A. @see org.jboss.resteasy.cdi.ejb, @see org.jboss.resteasy.test.cdi.ejb * B. SLSBs and SFSBs are used as JAX-RS resources, MessageBodyReaders, and MessageBodyWriters * * V. Interceptors * * A. @see org.jboss.resteasy.cdi.interceptors, @see org.jboss.resteasy.test.cdi.interceptors * B. On JAX-RS resources, MessageBodyReaders, MessageBodyWriters, * ReaderInterceptors, WriterInterceptors, ContainerRequestFilters, ContainerResponseFilters * C. Using @Interceptors, @InterceptorBinding * D. Intercepting business methods and lifecycle methods * E. Injecting SessionContext into JAX-RS resource to test EJB timer service * * VI. Decorators * * A. @see org.jboss.resteasy.cdi.decorators, @see org.jboss.resteasy.test.cdi.decorators * B. On JAX-RS resouces, MessageBodyReaders, MessageBodyWriters, * ReaderInterceptors, WriterInterceptors, ContainerRequestFilters, ContainerResponseFilters * C. Issue: https://community.jboss.org/message/784561#784561 * * VII. Events * * A. @see org.jboss.resteasy.cdi.events, @see org.jboss.resteasy.test.cdi.events * B. Injected into and fired by JAX-RS resources, MessageBodyReaders, MessageBodyWriters, * ReaderInterceptors, WriterInterceptors * C. Observed by an JAX-RS component (MessageBodyReader) * D. Events injected and observed by EJBs are tested as well * 1. @see org.jboss.resteasy.cdi.events.ejb, @see org.jboss.resteasy.test.cdi.events.ejb * * VIII. Inheritence * * A. @see org.jboss.resteasy.cdi.inheritence, @see org.jboss.resteasy.test.cdi.inheritence * B. Alternatives and specialized beans are injected into a JAX-RS resource. * C. Issue: https://community.jboss.org/message/780466 * * IX. Asynchronous processing * A. @see org.jboss.resteasy.cdi.asynch, @see org.jboss.resteasy.test.cdi.asynch * B. JAX-RS and EJB asynchronous processing are tested alone and together. * * X. Extensions - bean * A. @see org.jboss.resteasy.cdi.extension.bean, @see org.jboss.resteasy.test.cdi.extension.bean * B. An application defined implementation of javax.enterprise.inject.spi.Bean is introduced. * * XI. Extensions - scope * A. @see org.jboss.resteasy.cdi.extension.scope, @see org.jboss.resteasy.test.cdi.extension.scope * B. An application defined scope is introduced. * * XII. Modularity * A. @see org.jboss.resteasy.cdi.modules, @see org.jboss.resteasy.test.cdi.modules * B. Injection of an SFSB into a JAX-RS resource is tested across a variety of jar, ejb-jar, war, * and ear boundaries. * * XIII. Validation * A. @see org.jboss.resteasy.cdi.validation, @see org.jboss.resteasy.test.cdi.validation * B. The "experimental" validation facility (which was specified in a provisional JAX-RS 2.0 spec * and then removed) is tested. * C. Issue: https://community.jboss.org/thread/217515 * * * Note. These tests run in a version of AS7 with Resteasy 3.0-beta-2, with two modifications: * * 1. Weld 1.2.0-SNAPSHOT with a fix for WELD-1174. * 2. resteasy-jaxrs 3.0-alpha-1-SNAPSHOT with some modifications to the Bean Validation facility.. * * This version of AS7 is downloaded by maven from https://repository.jboss.org/nexus, where it is * identified as org.jboss.resteasy.test:as7-dist-cdi-ejb-7.1.1.Final:1.0:jar. */ package org.jboss.resteasy; Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/test/000077500000000000000000000000001225215345600255215ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/test/java/000077500000000000000000000000001225215345600264425ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/test/java/org/000077500000000000000000000000001225215345600272315ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/test/java/org/jboss/000077500000000000000000000000001225215345600303515ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/test/java/org/jboss/resteasy/000077500000000000000000000000001225215345600322105ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/test/java/org/jboss/resteasy/test/000077500000000000000000000000001225215345600331675ustar00rootroot00000000000000000077500000000000000000000000001225215345600336475ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/test/java/org/jboss/resteasy/test/cdiUtilitiesTest.java000066400000000000000000000060451225215345600373320ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/test/java/org/jboss/resteasy/test/cdipackage org.jboss.resteasy.test.cdi; import java.lang.annotation.Annotation; import java.lang.reflect.Type; import java.util.HashSet; import java.util.Iterator; import java.util.Set; import java.util.logging.Logger; import javax.enterprise.context.RequestScoped; import javax.enterprise.context.SessionScoped; import javax.enterprise.util.AnnotationLiteral; import junit.framework.Assert; import org.jboss.resteasy.cdi.extension.bean.Boston; import org.jboss.resteasy.cdi.extension.bean.BostonHolder; import org.jboss.resteasy.cdi.extension.bean.BostonlLeaf; import org.jboss.resteasy.cdi.extension.bean.TestResource; import org.jboss.resteasy.cdi.injection.BookResource; import org.jboss.resteasy.cdi.util.Utilities; import org.junit.Test; public class UtilitiesTest { private static Logger log = Logger.getLogger(UtilitiesTest.class.getName()); @RequestScoped @Boston static class C { } @Test public void testGetQualifiers() { log.info("entering testGetQualifiers()"); Set qualifiers = Utilities.getQualifiers(C.class); System.out.println(qualifiers); Assert.assertEquals(1, qualifiers.size()); HashSet> qualifierClasses = new HashSet>(); Iterator it = qualifiers.iterator(); while (it.hasNext()) { Annotation a = it.next(); System.out.println("a type: " + a.annotationType()); qualifierClasses.add(a.annotationType()); } Assert.assertTrue(qualifierClasses.contains(Boston.class)); log.info("testAnnotation() PASSES"); } @Test public void testHasQualifier() { log.info("entering testHasQualifier()"); Assert.assertTrue(Utilities.hasQualifier(BookResource.class, RequestScoped.class)); Assert.assertTrue(Utilities.isBoston(BostonHolder.class)); Assert.assertTrue(Utilities.isBoston(BostonlLeaf.class)); Assert.assertFalse(Utilities.isBoston(TestResource.class)); } interface i1 {} interface i2 extends i1 {} static class c1 implements i1 {} static class c2 extends c1 implements i2 {} @Test public void testTypeClosure() throws Exception { log.info("entering testTypeClosure()"); Set set = Utilities.getTypeClosure(c2.class); System.out.println(set); Assert.assertEquals(5, set.size()); Assert.assertTrue(set.contains(i1.class)); Assert.assertTrue(set.contains(i2.class)); Assert.assertTrue(set.contains(c1.class)); Assert.assertTrue(set.contains(c2.class)); Assert.assertTrue(set.contains(Object.class)); } @SuppressWarnings("serial") @Test public void testAnnotationPresent() throws Exception { Assert.assertTrue(Utilities.isAnnotationPresent(C.class, new AnnotationLiteral(){}.annotationType())); Assert.assertTrue(Utilities.isAnnotationPresent(C.class, new AnnotationLiteral(){}.annotationType())); Assert.assertFalse(Utilities.isAnnotationPresent(C.class, new AnnotationLiteral(){}.annotationType())); } } 000077500000000000000000000000001225215345600351345ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/test/java/org/jboss/resteasy/test/cdi/asynchAsynchronousTest.java000066400000000000000000000057631225215345600413450ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/test/java/org/jboss/resteasy/test/cdi/asynchpackage org.jboss.resteasy.test.cdi.asynch; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; import java.util.logging.Logger; import javax.inject.Inject; import org.jboss.arquillian.container.test.api.Deployment; import org.jboss.arquillian.junit.Arquillian; import org.jboss.resteasy.cdi.asynch.AsynchronousResource; import org.jboss.resteasy.cdi.asynch.AsynchronousStateless; import org.jboss.resteasy.cdi.asynch.AsynchronousStatelessLocal; import org.jboss.resteasy.cdi.asynch.JaxRsActivator; import org.jboss.resteasy.cdi.util.UtilityProducer; import org.jboss.resteasy.client.ClientRequest; import org.jboss.resteasy.client.ClientResponse; import org.jboss.shrinkwrap.api.Archive; import org.jboss.shrinkwrap.api.ShrinkWrap; import org.jboss.shrinkwrap.api.asset.EmptyAsset; import org.jboss.shrinkwrap.api.spec.WebArchive; import org.junit.Test; import org.junit.runner.RunWith; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright Dec 22, 2012 */ @RunWith(Arquillian.class) public class AsynchronousTest { @Inject private Logger log; @Inject private AsynchronousStatelessLocal stateless; @Deployment public static Archive createTestArchive() { WebArchive war = ShrinkWrap.create(WebArchive.class, "resteasy-ejb-test.war") .addClasses(JaxRsActivator.class, UtilityProducer.class) .addClasses(AsynchronousStatelessLocal.class, AsynchronousStateless.class) .addClasses(AsynchronousResource.class) .addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml"); System.out.println(war.toString(true)); return war; } @Test public void testAsynchJaxRs() throws Exception { log.info("starting testAsynch()"); ClientRequest request = new ClientRequest("http://localhost:8080/resteasy-ejb-test/rest/asynch/simple"); long start = System.currentTimeMillis(); log.info("calling resource"); ClientResponse clientResponse = request.get(); log.info("status: " + clientResponse.getStatus()); assertEquals(200, clientResponse.getStatus()); assertTrue(System.currentTimeMillis() - start > 2000); } @Test public void testAsynchEJBLocal() throws Exception { log.info("starting testAsynchEJB()"); long start = System.currentTimeMillis(); log.info("calling EJB"); stateless.asynch(); assertTrue(System.currentTimeMillis() - start > 2000); } @Test public void testAsynchResourceAsynchEJB() throws Exception { log.info("starting testAsynchResourceAsynchEJB()"); ClientRequest request = new ClientRequest("http://localhost:8080/resteasy-ejb-test/rest/asynch/ejb"); long start = System.currentTimeMillis(); log.info("calling resource"); ClientResponse clientResponse = request.get(); log.info("status: " + clientResponse.getStatus()); assertEquals(200, clientResponse.getStatus()); assertTrue(System.currentTimeMillis() - start > 2000); } } 000077500000000000000000000000001225215345600360145ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/test/java/org/jboss/resteasy/test/cdi/decoratorsDecoratorsTest.java000066400000000000000000000112731225215345600416300ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/test/java/org/jboss/resteasy/test/cdi/decoratorspackage org.jboss.resteasy.test.cdi.decorators; import static org.junit.Assert.assertEquals; import java.lang.reflect.Type; import java.util.logging.Logger; import javax.inject.Inject; import junit.framework.Assert; import org.jboss.arquillian.container.test.api.Deployment; import org.jboss.arquillian.junit.Arquillian; import org.jboss.resteasy.cdi.decorators.Book; import org.jboss.resteasy.cdi.decorators.BookReader; import org.jboss.resteasy.cdi.decorators.BookReaderDecorator; import org.jboss.resteasy.cdi.decorators.BookReaderInterceptor; import org.jboss.resteasy.cdi.decorators.BookReaderInterceptorDecorator; import org.jboss.resteasy.cdi.decorators.BookWriter; import org.jboss.resteasy.cdi.decorators.BookWriterDecorator; import org.jboss.resteasy.cdi.decorators.BookWriterInterceptor; import org.jboss.resteasy.cdi.decorators.BookWriterInterceptorDecorator; import org.jboss.resteasy.cdi.decorators.FilterBinding; import org.jboss.resteasy.cdi.decorators.JaxRsActivator; import org.jboss.resteasy.cdi.decorators.RequestFilterDecorator; import org.jboss.resteasy.cdi.decorators.ResourceBinding; import org.jboss.resteasy.cdi.decorators.ResourceDecorator; import org.jboss.resteasy.cdi.decorators.ResourceInterceptor; import org.jboss.resteasy.cdi.decorators.ResponseFilterDecorator; import org.jboss.resteasy.cdi.decorators.TestRequestFilter; import org.jboss.resteasy.cdi.decorators.TestResource; import org.jboss.resteasy.cdi.decorators.TestResourceIntf; import org.jboss.resteasy.cdi.decorators.TestResponseFilter; import org.jboss.resteasy.cdi.decorators.VisitList; import org.jboss.resteasy.cdi.util.Constants; import org.jboss.resteasy.cdi.util.Utilities; import org.jboss.resteasy.cdi.util.UtilityProducer; import org.jboss.resteasy.client.ClientRequest; import org.jboss.resteasy.client.ClientResponse; import org.jboss.resteasy.util.GenericType; import org.jboss.shrinkwrap.api.Archive; import org.jboss.shrinkwrap.api.ShrinkWrap; import org.jboss.shrinkwrap.api.spec.WebArchive; import org.junit.Test; import org.junit.runner.RunWith; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright Nov 13, 2012 */ @RunWith(Arquillian.class) public class DecoratorsTest { @Inject Logger log; @Deployment public static Archive createTestArchive() { WebArchive war = ShrinkWrap.create(WebArchive.class, "resteasy-cdi-ejb-test.war") .addClasses(JaxRsActivator.class, Constants.class, UtilityProducer.class, Utilities.class, VisitList.class) .addClasses(TestResourceIntf.class, TestResource.class, Book.class) .addClasses(BookReaderInterceptorDecorator.class, BookReaderInterceptor.class) .addClasses(BookReaderDecorator.class, BookReader.class) .addClasses(BookWriterInterceptorDecorator.class, BookWriterInterceptor.class) .addClasses(BookWriterDecorator.class, BookWriter.class) .addClasses(ResourceBinding.class, ResourceInterceptor.class, ResourceDecorator.class) .addClasses(FilterBinding.class, TestRequestFilter.class, RequestFilterDecorator.class, TestResponseFilter.class, ResponseFilterDecorator.class) .addAsWebInfResource("decorators/decoratorBeans.xml", "beans.xml"); System.out.println(war.toString(true)); return war; } @Test public void testDecorators() throws Exception { log.info("starting testDecorators()"); // Create book. ClientRequest request = new ClientRequest("http://localhost:8080/resteasy-cdi-ejb-test/rest/create/"); Book book = new Book("RESTEasy: the Sequel"); Type genericType = (new GenericType() {}).getGenericType(); request.body(Constants.MEDIA_TYPE_TEST_XML_TYPE, book, genericType); ClientResponse response = request.post(); assertEquals(200, response.getStatus()); log.info("Status: " + response.getStatus()); int id = response.getEntity(int.class); log.info("id: " + id); Assert.assertEquals(0, id); // Retrieve book. request = new ClientRequest("http://localhost:8080/resteasy-cdi-ejb-test/rest/book/" + id); request.accept(Constants.MEDIA_TYPE_TEST_XML); response = request.get(); log.info("Status: " + response.getStatus()); assertEquals(200, response.getStatus()); Book result = response.getEntity(Book.class); log.info("book: " + book); Assert.assertEquals(book, result); // Test order of decorator invocations. request = new ClientRequest("http://localhost:8080/resteasy-cdi-ejb-test/rest/test/"); response = request.post(); log.info("Status: " + response.getStatus()); assertEquals(200, response.getStatus()); response.releaseConnection(); } } 000077500000000000000000000000001225215345600344075ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/test/java/org/jboss/resteasy/test/cdi/ejbEJBTest.java000066400000000000000000000262011225215345600365130ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/test/java/org/jboss/resteasy/test/cdi/ejbpackage org.jboss.resteasy.test.cdi.ejb; import static org.junit.Assert.assertEquals; import java.util.Hashtable; import java.util.logging.Logger; import javax.inject.Inject; import javax.naming.Context; import javax.naming.InitialContext; import junit.framework.Assert; import org.jboss.arquillian.container.test.api.Deployment; import org.jboss.arquillian.junit.Arquillian; import org.jboss.resteasy.cdi.ejb.Book; import org.jboss.resteasy.cdi.ejb.EJBApplication; import org.jboss.resteasy.cdi.ejb.EJBBookReader; import org.jboss.resteasy.cdi.ejb.EJBBookReaderImpl; import org.jboss.resteasy.cdi.ejb.EJBBookResource; import org.jboss.resteasy.cdi.ejb.EJBBookWriterImpl; import org.jboss.resteasy.cdi.ejb.EJBLocalResource; import org.jboss.resteasy.cdi.ejb.EJBRemoteResource; import org.jboss.resteasy.cdi.ejb.EJBResourceParent; import org.jboss.resteasy.cdi.util.Constants; import org.jboss.resteasy.cdi.util.Counter; import org.jboss.resteasy.cdi.util.UtilityProducer; import org.jboss.resteasy.cdi.util.Utilities; import org.jboss.resteasy.client.ClientRequest; import org.jboss.resteasy.client.ClientResponse; import org.jboss.shrinkwrap.api.Archive; import org.jboss.shrinkwrap.api.ShrinkWrap; import org.jboss.shrinkwrap.api.asset.EmptyAsset; import org.jboss.shrinkwrap.api.spec.WebArchive; import org.junit.Test; import org.junit.runner.RunWith; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright Jun 29, 2012 */ @RunWith(Arquillian.class) public class EJBTest { @Inject private Logger log; @Inject EJBLocalResource localResource; @Deployment public static Archive createTestArchive() { WebArchive war = ShrinkWrap.create(WebArchive.class, "resteasy-ejb-test.war") .addClass(EJBApplication.class) .addClasses(Book.class, Constants.class, Counter.class, UtilityProducer.class, Utilities.class) .addClasses(EJBBookReader.class, EJBBookReaderImpl.class) .addClasses(EJBBookWriterImpl.class) .addClasses(EJBResourceParent.class, EJBLocalResource.class, EJBRemoteResource.class, EJBBookResource.class) .setWebXML("ejb/ejbtest_web.xml") .addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml"); System.out.println(war.toString(true)); return war; } /** * Verify that EJBBookReaderImpl, EJBBookWriterImpl, and EJBBookResource * are placed in the correct scope. * * @throws Exception */ @Test public void testVerifyScopesJaxRs() throws Exception { log.info("starting testVerifyScopesJaxRs()"); ClientRequest request = new ClientRequest("http://localhost:8080/resteasy-ejb-test/verifyScopes/"); ClientResponse response = request.get(); log.info("status: " + response.getStatus()); log.info("result: " + response.getEntity(Integer.class)); assertEquals(200, response.getStatus()); assertEquals(200, response.getEntity(Integer.class).intValue()); } /** * Verify that EJBBookReaderImpl, EJBBookWriterImpl, and EJBBookResource * are placed in the correct scope. * * @throws Exception */ @Test public void testVerifyScopesLocalEJB() throws Exception { log.info("starting testVerifyScopesLocalEJB()"); int result = localResource.verifyScopes(); log.info("result: " + result); assertEquals(200, result); } /** * Verify that EJBBookReaderImpl, EJBBookWriterImpl, and EJBBookResource * are placed in the correct scope. * * @throws Exception */ @Test public void testVerifyScopesRemoteEJB() throws Exception { log.info("starting testVerifyScopesRemoteEJB()"); // Get proxy to JAX-RS resource as EJB. EJBRemoteResource remoteResource = getRemoteResource(); log.info("remote: " + remoteResource); int result = remoteResource.verifyScopes(); log.info("result: " + result); assertEquals(200, result); } /** * Verify that EJBBookReader and EJBBookWriterImpl are correctly injected * into EJBBookResource. * * @throws Exception */ @Test public void testVerifyInjectionJaxRs() throws Exception { log.info("starting testVerifyInjectionJaxRs()"); ClientRequest request = new ClientRequest("http://localhost:8080/resteasy-ejb-test/verifyInjection/"); ClientResponse response = request.get(); log.info("result: " + response.getEntity(Integer.class)); assertEquals(200, response.getStatus()); assertEquals(200, response.getEntity(Integer.class).intValue()); } /** * Verify that EJBBookReader and EJBBookWriterImpl are correctly injected * into EJBBookResource. * * @throws Exception */ @Test public void testVerifyInjectionLocalEJB() throws Exception { log.info("starting testVerifyInjectionLocalEJB()"); int result = localResource.verifyInjection(); log.info("result: " + result); assertEquals(200, result); } /** * Verify that EJBBookReader and EJBBookWriterImpl are correctly injected * into EJBBookResource. * * @throws Exception */ @Test public void testVerifyInjectionRemoteEJB() throws Exception { log.info("starting testVerifyInjectionRemoteEJB()"); // Get proxy to JAX-RS resource as EJB. EJBRemoteResource remoteResource = getRemoteResource(); log.info("remote: " + remoteResource); int result = remoteResource.verifyInjection(); log.info("result: " + result); assertEquals(200, result); } /** * Further addresses the use of EJBs as JAX-RS components. * * @throws Exception */ @Test public void testAsJaxRSResource() throws Exception { log.info("entering testAsJaxRSResource()"); // Create book. ClientRequest request = new ClientRequest("http://localhost:8080/resteasy-ejb-test/create/"); Book book1 = new Book("RESTEasy: the Sequel"); request.body(Constants.MEDIA_TYPE_TEST_XML, book1); ClientResponse response = request.post(); log.info("Status: " + response.getStatus()); assertEquals(200, response.getStatus()); int id1 = response.getEntity(int.class); log.info("id: " + id1); Assert.assertEquals(Counter.INITIAL_VALUE, id1); // Create another book. request = new ClientRequest("http://localhost:8080/resteasy-ejb-test/create/"); Book book2 = new Book("RESTEasy: It's Alive"); request.body(Constants.MEDIA_TYPE_TEST_XML, book2); response = request.post(); log.info("Status: " + response.getStatus()); assertEquals(200, response.getStatus()); int id2 = response.getEntity(int.class); log.info("id: " + id2); Assert.assertEquals(Counter.INITIAL_VALUE + 1, id2); // Retrieve first book. request = new ClientRequest("http://localhost:8080/resteasy-ejb-test/book/" + id1); request.accept(Constants.MEDIA_TYPE_TEST_XML); response = request.get(); log.info("Status: " + response.getStatus()); assertEquals(200, response.getStatus()); Book result = response.getEntity(Book.class); log.info("book: " + book1); Assert.assertEquals(book1, result); // Retrieve second book. request = new ClientRequest("http://localhost:8080/resteasy-ejb-test/book/" + id2); request.accept(Constants.MEDIA_TYPE_TEST_XML); response = request.get(); log.info("Status: " + response.getStatus()); assertEquals(200, response.getStatus()); result = response.getEntity(Book.class); log.info("book: " + book2); Assert.assertEquals(book2, result); // Verify that EJBBookReader and EJBBookWriter have been used, twice on each side. request = new ClientRequest("http://localhost:8080/resteasy-ejb-test/uses/4"); response = request.get(); log.info("Status: " + response.getStatus()); assertEquals(200, response.getStatus()); response.releaseConnection(); // Reset counter. request = new ClientRequest("http://localhost:8080/resteasy-ejb-test/reset"); response = request.get(); log.info("Status: " + response.getStatus()); assertEquals(204, response.getStatus()); response.releaseConnection(); } /** * Invokes additional methods of JAX-RS resource as local EJB. */ @Test public void testAsLocalEJB() throws Exception { log.info("entering testAsLocalEJB()"); // Create book. Book book1 = new Book("RESTEasy: the Sequel"); int id1 = localResource.createBook(book1); log.info("id1: " + id1); Assert.assertEquals(Counter.INITIAL_VALUE, id1); // Create another book. Book book2 = new Book("RESTEasy: It's Alive"); int id2 = localResource.createBook(book2); log.info("id2: " + id2); Assert.assertEquals(Counter.INITIAL_VALUE + 1, id2); // Retrieve first book. Book bookResponse1 = localResource.lookupBookById(id1); log.info("book1 response: " + bookResponse1); Assert.assertEquals(book1, bookResponse1); // Retrieve second book. Book bookResponse2 = localResource.lookupBookById(id2); log.info("book2 response: " + bookResponse2); Assert.assertEquals(book2, bookResponse2); // Verify that EJBBookReader and EJBBookWriter haven't been used. localResource.testUse(0); // Reset counter. localResource.reset(); } /** * Invokes additional methods of JAX-RS resource as remote EJB. */ @Test public void testAsRemoteEJB() throws Exception { log.info("entering testAsRemoteEJB()"); // Get proxy to JAX-RS resource as EJB. EJBRemoteResource remoteResource = getRemoteResource(); log.info("remote: " + remoteResource); // Create book. Book book1 = new Book("RESTEasy: the Sequel"); int id1 = remoteResource.createBook(book1); log.info("id1: " + id1); Assert.assertEquals(Counter.INITIAL_VALUE, id1); // Create another book. Book book2 = new Book("RESTEasy: It's Alive"); int id2 = remoteResource.createBook(book2); log.info("id2: " + id2); Assert.assertEquals(Counter.INITIAL_VALUE + 1, id2); // Retrieve first book. Book bookResponse1 = remoteResource.lookupBookById(id1); log.info("book1 response: " + bookResponse1); Assert.assertEquals(book1, bookResponse1); // Retrieve second book. Book bookResponse2 = remoteResource.lookupBookById(id2); log.info("book2 response: " + bookResponse2); Assert.assertEquals(book2, bookResponse2); // Verify that EJBBookReader and EJBBookWriter haven't been used. remoteResource.testUse(0); // Reset counter. remoteResource.reset(); } private static EJBRemoteResource getRemoteResource() throws Exception { final Hashtable jndiProperties = new Hashtable(); jndiProperties.put(Context.URL_PKG_PREFIXES, "org.jboss.ejb.client.naming"); final Context context = new InitialContext(jndiProperties); String name = "ejb:/resteasy-ejb-test/EJBBookResource!" + EJBRemoteResource.class.getName(); return EJBRemoteResource.class.cast(context.lookup(name)); } } 000077500000000000000000000000001225215345600351535ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/test/java/org/jboss/resteasy/test/cdi/eventsEventsTest.java000066400000000000000000000076311225215345600401310ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/test/java/org/jboss/resteasy/test/cdi/eventspackage org.jboss.resteasy.test.cdi.events; import static org.junit.Assert.assertEquals; import java.lang.reflect.Type; import java.util.logging.Logger; import javax.inject.Inject; import javax.swing.text.Utilities; import junit.framework.Assert; import org.jboss.arquillian.container.test.api.Deployment; import org.jboss.arquillian.junit.Arquillian; import org.jboss.resteasy.cdi.events.EventResource; import org.jboss.resteasy.cdi.events.Read; import org.jboss.resteasy.cdi.events.ReadIntercept; import org.jboss.resteasy.cdi.events.Unused; import org.jboss.resteasy.cdi.events.Write; import org.jboss.resteasy.cdi.events.WriteIntercept; import org.jboss.resteasy.cdi.events.Book; import org.jboss.resteasy.cdi.events.BookReader; import org.jboss.resteasy.cdi.events.BookReaderInterceptor; import org.jboss.resteasy.cdi.events.BookWriter; import org.jboss.resteasy.cdi.events.BookWriterInterceptor; import org.jboss.resteasy.cdi.events.JaxRsActivator; import org.jboss.resteasy.cdi.util.Constants; import org.jboss.resteasy.cdi.util.UtilityProducer; import org.jboss.resteasy.client.ClientRequest; import org.jboss.resteasy.client.ClientResponse; import org.jboss.resteasy.util.GenericType; import org.jboss.shrinkwrap.api.Archive; import org.jboss.shrinkwrap.api.ShrinkWrap; import org.jboss.shrinkwrap.api.asset.EmptyAsset; import org.jboss.shrinkwrap.api.spec.WebArchive; import org.junit.Test; import org.junit.runner.RunWith; /** * This is a collection of tests addressed to the interactions of * Resteasy, CDI, EJB, and so forth in the context of a JEE Application Server. * * It tests the injection of a variety of beans into Resteasy objects. * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright May 8, 2012 */ @RunWith(Arquillian.class) public class EventsTest { @Inject Logger log; @Deployment public static Archive createTestArchive() { WebArchive war = ShrinkWrap.create(WebArchive.class, "resteasy-cdi-ejb-test.war") .addClasses(JaxRsActivator.class, Constants.class, UtilityProducer.class, Utilities.class) .addClasses(Book.class, BookReader.class, BookWriter.class) .addClasses(BookReaderInterceptor.class, BookWriterInterceptor.class) .addClasses(EventResource.class) .addClasses(Process.class, Read.class, ReadIntercept.class) .addClasses(Unused.class, Write.class, WriteIntercept.class) .addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml"); System.out.println(war.toString(true)); return war; } @Test public void testEvents() throws Exception { log.info("starting testEvents()"); // Create book. ClientRequest request = new ClientRequest("http://localhost:8080/resteasy-cdi-ejb-test/rest/create/"); Book book = new Book("RESTEasy: the Sequel"); Type genericType = (new GenericType() {}).getGenericType(); request.body(Constants.MEDIA_TYPE_TEST_XML_TYPE, book, genericType); ClientResponse response = request.post(); assertEquals(200, response.getStatus()); log.info("Status: " + response.getStatus()); int id = response.getEntity(int.class); log.info("id: " + id); Assert.assertEquals(0, id); // Retrieve book. request = new ClientRequest("http://localhost:8080/resteasy-cdi-ejb-test/rest/book/" + id); request.accept(Constants.MEDIA_TYPE_TEST_XML); response = request.get(); log.info("Status: " + response.getStatus()); assertEquals(200, response.getStatus()); Book result = response.getEntity(Book.class); log.info("book: " + book); Assert.assertEquals(book, result); request = new ClientRequest("http://localhost:8080/resteasy-cdi-ejb-test/rest/test/"); response = request.post(); log.info("Status: " + response.getStatus()); assertEquals(200, response.getStatus()); response.releaseConnection(); } } 000077500000000000000000000000001225215345600357135ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/test/java/org/jboss/resteasy/test/cdi/events/ejbEJBEventsTest.java000066400000000000000000000052611225215345600412070ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/test/java/org/jboss/resteasy/test/cdi/events/ejbpackage org.jboss.resteasy.test.cdi.events.ejb; import java.util.logging.Logger; import javax.inject.Inject; import junit.framework.Assert; import org.jboss.arquillian.container.test.api.Deployment; import org.jboss.arquillian.junit.Arquillian; import org.jboss.resteasy.cdi.events.ejb.Book; import org.jboss.resteasy.cdi.events.ejb.EventObserver; import org.jboss.resteasy.cdi.events.ejb.EventObserverImpl; import org.jboss.resteasy.cdi.events.ejb.EventSource; import org.jboss.resteasy.cdi.events.ejb.EventSourceImpl; import org.jboss.resteasy.cdi.events.ejb.ProcessRead; import org.jboss.resteasy.cdi.events.ejb.ProcessReadWrite; import org.jboss.resteasy.cdi.util.UtilityProducer; import org.jboss.shrinkwrap.api.Archive; import org.jboss.shrinkwrap.api.ShrinkWrap; import org.jboss.shrinkwrap.api.asset.EmptyAsset; import org.jboss.shrinkwrap.api.spec.WebArchive; import org.junit.Test; import org.junit.runner.RunWith; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright Jun 29, 2012 */ @RunWith(Arquillian.class) public class EJBEventsTest { @Inject private Logger log; @Inject EventSource eventSource; @Deployment public static Archive createTestArchive() { WebArchive war = ShrinkWrap.create(WebArchive.class, "resteasy-ejb-test.war") .addClasses(UtilityProducer.class, Book.class) .addClasses(EventObserver.class, EventObserverImpl.class) .addClasses(EventSource.class, EventSourceImpl.class) .addClasses(Process.class, ProcessRead.class, ProcessReadWrite.class) .setWebXML("ejb/ejbtest_web.xml") .addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml"); System.out.println(war.toString(true)); return war; } /** * Invokes additional methods of JAX-RS resource as local EJB. */ @Test public void testAsLocalEJB() throws Exception { log.info("entering testAsLocalEJB()"); // Create book. Book book1 = new Book("RESTEasy: the Sequel"); int id1 = eventSource.createBook(book1); log.info("id1: " + id1); Assert.assertEquals(0, id1); // Create another book. Book book2 = new Book("RESTEasy: It's Alive"); int id2 = eventSource.createBook(book2); log.info("id2: " + id2); Assert.assertEquals(1, id2); // Retrieve first book. Book bookResponse1 = eventSource.lookupBookById(id1); log.info("book1 response: " + bookResponse1); Assert.assertEquals(book1, bookResponse1); // Retrieve second book. Book bookResponse2 = eventSource.lookupBookById(id2); log.info("book2 response: " + bookResponse2); Assert.assertEquals(book2, bookResponse2); } } 000077500000000000000000000000001225215345600356635ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/test/java/org/jboss/resteasy/test/cdi/extension000077500000000000000000000000001225215345600365705ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/test/java/org/jboss/resteasy/test/cdi/extension/beanBeanExtensionTest.java000066400000000000000000000052721225215345600430430ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/test/java/org/jboss/resteasy/test/cdi/extension/beanpackage org.jboss.resteasy.test.cdi.extension.bean; import static org.junit.Assert.assertEquals; import java.util.logging.Logger; import javax.enterprise.inject.spi.Extension; import javax.inject.Inject; import org.jboss.arquillian.container.test.api.Deployment; import org.jboss.arquillian.junit.Arquillian; import org.jboss.resteasy.cdi.extension.bean.Boston; import org.jboss.resteasy.cdi.extension.bean.BostonBean; import org.jboss.resteasy.cdi.extension.bean.BostonBeanExtension; import org.jboss.resteasy.cdi.extension.bean.BostonHolder; import org.jboss.resteasy.cdi.extension.bean.BostonlLeaf; import org.jboss.resteasy.cdi.extension.bean.TestReader; import org.jboss.resteasy.cdi.extension.bean.TestResource; import org.jboss.resteasy.cdi.injection.JaxRsActivator; import org.jboss.resteasy.cdi.util.UtilityProducer; import org.jboss.resteasy.cdi.util.Utilities; import org.jboss.resteasy.client.ClientRequest; import org.jboss.resteasy.client.ClientResponse; import org.jboss.shrinkwrap.api.Archive; import org.jboss.shrinkwrap.api.ShrinkWrap; import org.jboss.shrinkwrap.api.asset.EmptyAsset; import org.jboss.shrinkwrap.api.spec.JavaArchive; import org.jboss.shrinkwrap.api.spec.WebArchive; import org.junit.Test; import org.junit.runner.RunWith; /** * CDIBeanExtensionTest tests that Resteasy components and beans defined by a CDI extension * can be injected into each other. * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright May 8, 2012 */ @RunWith(Arquillian.class) public class BeanExtensionTest { @Inject Logger log; @Deployment public static Archive createTestArchive() { WebArchive war = ShrinkWrap.create(WebArchive.class, "resteasy-extension-test.war") .addClasses(JaxRsActivator.class, UtilityProducer.class, Utilities.class) .addClasses(BostonBeanExtension.class, Boston.class, BostonBean.class) .addClasses(TestResource.class, TestReader.class) .addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml") .addAsServiceProvider(Extension.class, BostonBeanExtension.class); JavaArchive jar = ShrinkWrap.create(JavaArchive.class).addClasses(BostonHolder.class, BostonlLeaf.class); war.addAsLibrary(jar); System.out.println(war.toString(true)); return war; } @Test public void testBostonBeans() throws Exception { log.info("starting testBostonBeans()"); ClientRequest request = new ClientRequest("http://localhost:8080/resteasy-extension-test/rest/extension/boston/"); ClientResponse response = request.post(); log.info("Status: " + response.getStatus()); assertEquals(200, response.getStatus()); response.releaseConnection(); } } 000077500000000000000000000000001225215345600367745ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/test/java/org/jboss/resteasy/test/cdi/extension/scopeScopeExtensionTest.java000066400000000000000000000061531225215345600434520ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/test/java/org/jboss/resteasy/test/cdi/extension/scopepackage org.jboss.resteasy.test.cdi.extension.scope; import static org.junit.Assert.assertEquals; import java.util.logging.Logger; import javax.enterprise.inject.spi.Extension; import javax.inject.Inject; import org.jboss.arquillian.container.test.api.Deployment; import org.jboss.arquillian.junit.Arquillian; import org.jboss.resteasy.cdi.extension.scope.ExtensionResource; import org.jboss.resteasy.cdi.extension.scope.Obsolescent; import org.jboss.resteasy.cdi.extension.scope.ObsolescentAfterThreeUses; import org.jboss.resteasy.cdi.extension.scope.ObsolescentAfterTwoUses; import org.jboss.resteasy.cdi.extension.scope.PlannedObsolescenceContext; import org.jboss.resteasy.cdi.extension.scope.PlannedObsolescenceExtension; import org.jboss.resteasy.cdi.extension.scope.PlannedObsolescenceScope; import org.jboss.resteasy.cdi.injection.JaxRsActivator; import org.jboss.resteasy.cdi.util.UtilityProducer; import org.jboss.resteasy.cdi.util.Utilities; import org.jboss.resteasy.client.ClientRequest; import org.jboss.resteasy.client.ClientResponse; import org.jboss.shrinkwrap.api.Archive; import org.jboss.shrinkwrap.api.ShrinkWrap; import org.jboss.shrinkwrap.api.asset.EmptyAsset; import org.jboss.shrinkwrap.api.spec.WebArchive; import org.junit.Test; import org.junit.runner.RunWith; /** * CDIScopeExtensionTest tests that Resteasy interacts well with beans in * a user defined scope. * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright May 8, 2012 */ @RunWith(Arquillian.class) public class ScopeExtensionTest { @Inject Logger log; @Deployment public static Archive createTestArchive() { WebArchive war = ShrinkWrap.create(WebArchive.class, "resteasy-extension-test.war") .addClasses(JaxRsActivator.class, UtilityProducer.class, Utilities.class) .addClasses(PlannedObsolescenceExtension.class, PlannedObsolescenceScope.class) .addClasses(PlannedObsolescenceContext.class, ExtensionResource.class) .addClasses(Obsolescent.class, ObsolescentAfterTwoUses.class, ObsolescentAfterThreeUses.class) .addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml") .addAsServiceProvider(Extension.class, PlannedObsolescenceExtension.class); System.out.println(war.toString(true)); return war; } @Test public void testObsolescentScope() throws Exception { log.info("starting testScope()"); ClientRequest request = new ClientRequest("http://localhost:8080/resteasy-extension-test/rest/extension/setup/"); ClientResponse response = request.post(); log.info("Status: " + response.getStatus()); assertEquals(200, response.getStatus()); request = new ClientRequest("http://localhost:8080/resteasy-extension-test/rest/extension/test1/"); response = request.post(); log.info("Status: " + response.getStatus()); assertEquals(200, response.getStatus()); request = new ClientRequest("http://localhost:8080/resteasy-extension-test/rest/extension/test2/"); response = request.post(); log.info("Status: " + response.getStatus()); assertEquals(200, response.getStatus()); } } 000077500000000000000000000000001225215345600352635ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/test/java/org/jboss/resteasy/test/cdi/genericConcreteDecoratorTest.java000066400000000000000000000106331225215345600423760ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/test/java/org/jboss/resteasy/test/cdi/genericpackage org.jboss.resteasy.test.cdi.generic; import static org.junit.Assert.assertEquals; import java.util.logging.Logger; import javax.inject.Inject; import org.jboss.arquillian.container.test.api.Deployment; import org.jboss.arquillian.junit.Arquillian; import org.jboss.resteasy.cdi.generic.Animal; import org.jboss.resteasy.cdi.generic.Australopithecus; import org.jboss.resteasy.cdi.generic.ConcreteDecorator; import org.jboss.resteasy.cdi.generic.ConcreteResource; import org.jboss.resteasy.cdi.generic.ConcreteResourceIntf; import org.jboss.resteasy.cdi.generic.GenericsProducer; import org.jboss.resteasy.cdi.generic.HierarchyHolder; import org.jboss.resteasy.cdi.generic.HierarchyTypedResource; import org.jboss.resteasy.cdi.generic.HierarchyTypedResourceIntf; import org.jboss.resteasy.cdi.generic.HolderBinding; import org.jboss.resteasy.cdi.generic.JaxRsActivator; import org.jboss.resteasy.cdi.generic.LowerBoundHierarchyHolder; import org.jboss.resteasy.cdi.generic.LowerBoundTypedResource; import org.jboss.resteasy.cdi.generic.LowerBoundTypedResourceIntf; import org.jboss.resteasy.cdi.generic.NestedHierarchyHolder; import org.jboss.resteasy.cdi.generic.NestedTypedResource; import org.jboss.resteasy.cdi.generic.NestedTypedResourceIntf; import org.jboss.resteasy.cdi.generic.ObjectHolder; import org.jboss.resteasy.cdi.generic.ObjectTypedResource; import org.jboss.resteasy.cdi.generic.ObjectTypedResourceIntf; import org.jboss.resteasy.cdi.generic.Primate; import org.jboss.resteasy.cdi.generic.UpperBoundHierarchyHolder; import org.jboss.resteasy.cdi.generic.UpperBoundTypedResource; import org.jboss.resteasy.cdi.generic.UpperBoundTypedResourceIntf; import org.jboss.resteasy.cdi.generic.VisitList; import org.jboss.resteasy.cdi.util.UtilityProducer; import org.jboss.resteasy.client.ClientRequest; import org.jboss.resteasy.client.ClientResponse; import org.jboss.shrinkwrap.api.Archive; import org.jboss.shrinkwrap.api.ShrinkWrap; import org.jboss.shrinkwrap.api.spec.WebArchive; import org.junit.Test; import org.junit.runner.RunWith; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright Dec 14, 2012 */ @RunWith(Arquillian.class) public class ConcreteDecoratorTest { @Inject private Logger log; @Deployment public static Archive createTestArchive() { WebArchive war = ShrinkWrap.create(WebArchive.class, "resteasy-cdi-ejb-test.war") .addClasses(JaxRsActivator.class, UtilityProducer.class, VisitList.class) .addClasses(GenericsProducer.class, HolderBinding.class) .addClasses(ConcreteResourceIntf.class, ConcreteResource.class) .addClasses(ObjectTypedResourceIntf.class, ObjectTypedResource.class) .addClasses(HierarchyTypedResourceIntf.class, HierarchyTypedResource.class) .addClasses(NestedTypedResourceIntf.class, NestedTypedResource.class) .addClasses(UpperBoundTypedResourceIntf.class, UpperBoundTypedResource.class) .addClasses(LowerBoundTypedResourceIntf.class, LowerBoundTypedResource.class) .addClasses(ObjectHolder.class, HierarchyHolder.class, NestedHierarchyHolder.class) .addClasses(UpperBoundHierarchyHolder.class, LowerBoundHierarchyHolder.class) .addClasses(Animal.class, Primate.class, Australopithecus.class) .addClasses(ConcreteDecorator.class) .addAsWebInfResource("generic/concrete_beans.xml", "beans.xml"); System.out.println(war.toString(true)); return war; } @Test public void testConcreteConcreteDecorator() throws Exception { log.info("starting testConcreteConcreteDecorator()"); ClientRequest request = new ClientRequest("http://localhost:8080/resteasy-cdi-ejb-test/rest/concrete/decorators/clear"); ClientResponse response = request.get(); log.info("Status: " + response.getStatus()); assertEquals(200, response.getStatus()); request = new ClientRequest("http://localhost:8080/resteasy-cdi-ejb-test/rest/concrete/decorators/execute"); response = request.get(); log.info("Status: " + response.getStatus()); assertEquals(200, response.getStatus()); request = new ClientRequest("http://localhost:8080/resteasy-cdi-ejb-test/rest/concrete/decorators/test"); response = request.get(); log.info("Status: " + response.getStatus()); assertEquals(200, response.getStatus()); response.releaseConnection(); } } GenericsInjectionTest.java000066400000000000000000000144651225215345600424020ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/test/java/org/jboss/resteasy/test/cdi/genericpackage org.jboss.resteasy.test.cdi.generic; import static org.junit.Assert.assertEquals; import java.util.logging.Logger; import javax.inject.Inject; import org.jboss.arquillian.container.test.api.Deployment; import org.jboss.arquillian.junit.Arquillian; import org.jboss.resteasy.cdi.generic.HolderBinding; import org.jboss.resteasy.cdi.generic.Animal; import org.jboss.resteasy.cdi.generic.Australopithecus; import org.jboss.resteasy.cdi.generic.ConcreteDecorator; import org.jboss.resteasy.cdi.generic.ConcreteResource; import org.jboss.resteasy.cdi.generic.ConcreteResourceIntf; import org.jboss.resteasy.cdi.generic.UpperBoundDecorator; import org.jboss.resteasy.cdi.generic.GenericsProducer; import org.jboss.resteasy.cdi.generic.HierarchyHolder; import org.jboss.resteasy.cdi.generic.HierarchyTypedResource; import org.jboss.resteasy.cdi.generic.HierarchyTypedResourceIntf; import org.jboss.resteasy.cdi.generic.JaxRsActivator; import org.jboss.resteasy.cdi.generic.LowerBoundHierarchyHolder; import org.jboss.resteasy.cdi.generic.LowerBoundTypedResource; import org.jboss.resteasy.cdi.generic.LowerBoundTypedResourceIntf; import org.jboss.resteasy.cdi.generic.NestedHierarchyHolder; import org.jboss.resteasy.cdi.generic.NestedTypedResource; import org.jboss.resteasy.cdi.generic.NestedTypedResourceIntf; import org.jboss.resteasy.cdi.generic.ObjectHolder; import org.jboss.resteasy.cdi.generic.ObjectTypedResource; import org.jboss.resteasy.cdi.generic.ObjectTypedResourceIntf; import org.jboss.resteasy.cdi.generic.Primate; import org.jboss.resteasy.cdi.generic.UpperBoundHierarchyHolder; import org.jboss.resteasy.cdi.generic.UpperBoundTypedResource; import org.jboss.resteasy.cdi.generic.UpperBoundTypedResourceIntf; import org.jboss.resteasy.cdi.generic.VisitList; import org.jboss.resteasy.cdi.util.UtilityProducer; import org.jboss.resteasy.client.ClientRequest; import org.jboss.resteasy.client.ClientResponse; import org.jboss.shrinkwrap.api.Archive; import org.jboss.shrinkwrap.api.ShrinkWrap; import org.jboss.shrinkwrap.api.asset.EmptyAsset; import org.jboss.shrinkwrap.api.spec.WebArchive; import org.junit.Test; import org.junit.runner.RunWith; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright Dec 14, 2012 */ @RunWith(Arquillian.class) public class GenericsInjectionTest { @Inject private Logger log; @Deployment public static Archive createTestArchive() { WebArchive war = ShrinkWrap.create(WebArchive.class, "resteasy-cdi-ejb-test.war") .addClasses(JaxRsActivator.class, UtilityProducer.class, VisitList.class) .addClasses(GenericsProducer.class, HolderBinding.class) .addClasses(ConcreteResourceIntf.class, ConcreteResource.class) .addClasses(ObjectTypedResourceIntf.class, ObjectTypedResource.class) .addClasses(HierarchyTypedResourceIntf.class, HierarchyTypedResource.class) .addClasses(NestedTypedResourceIntf.class, NestedTypedResource.class) .addClasses(UpperBoundTypedResourceIntf.class, UpperBoundTypedResource.class) .addClasses(LowerBoundTypedResourceIntf.class, LowerBoundTypedResource.class) .addClasses(ObjectHolder.class, HierarchyHolder.class, NestedHierarchyHolder.class) .addClasses(UpperBoundHierarchyHolder.class, LowerBoundHierarchyHolder.class) .addClasses(Animal.class, Primate.class, Australopithecus.class) .addClasses(ConcreteDecorator.class, UpperBoundDecorator.class) .addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml"); System.out.println(war.toString(true)); return war; } @Test public void testConcreteResourceInjection() throws Exception { log.info("starting testConcreteResourceInjection()"); ClientRequest request = new ClientRequest("http://localhost:8080/resteasy-cdi-ejb-test/rest/concrete/injection"); ClientResponse response = request.get(); log.info("Status: " + response.getStatus()); assertEquals(200, response.getStatus()); response.releaseConnection(); } @Test public void testObjectTypedResourceInjection() throws Exception { log.info("starting testObjectTypedResourceInjection()"); ClientRequest request = new ClientRequest("http://localhost:8080/resteasy-cdi-ejb-test/rest/object/injection"); ClientResponse response = request.get(); log.info("Status: " + response.getStatus()); assertEquals(200, response.getStatus()); response.releaseConnection(); } @Test public void testHierarchyTypedResourceInjection() throws Exception { log.info("starting testHierarchyTypedResourceInjection()"); ClientRequest request = new ClientRequest("http://localhost:8080/resteasy-cdi-ejb-test/rest/hierarchy/injection"); ClientResponse response = request.get(); log.info("Status: " + response.getStatus()); assertEquals(200, response.getStatus()); response.releaseConnection(); } @Test public void testNestedTypedResourceInjection() throws Exception { log.info("starting testNestedTypedResourceInjection()"); ClientRequest request = new ClientRequest("http://localhost:8080/resteasy-cdi-ejb-test/rest/nested/injection"); ClientResponse response = request.get(); log.info("Status: " + response.getStatus()); assertEquals(200, response.getStatus()); response.releaseConnection(); } @Test public void testUpperBoundTypedResourceInjection() throws Exception { log.info("starting testUpperBoundTypedResourceInjection()"); ClientRequest request = new ClientRequest("http://localhost:8080/resteasy-cdi-ejb-test/rest/upperbound/injection"); ClientResponse response = request.get(); log.info("Status: " + response.getStatus()); assertEquals(200, response.getStatus()); response.releaseConnection(); } @Test public void testLowerBoundTypedResourceInjection() throws Exception { log.info("starting testLowerBoundTypedResourceInjection()"); ClientRequest request = new ClientRequest("http://localhost:8080/resteasy-cdi-ejb-test/rest/lowerbound/injection"); ClientResponse response = request.get(); log.info("Status: " + response.getStatus()); assertEquals(200, response.getStatus()); response.releaseConnection(); } } LowerBoundDecoratorTest.java000066400000000000000000000107541225215345600427200ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/test/java/org/jboss/resteasy/test/cdi/genericpackage org.jboss.resteasy.test.cdi.generic; import static org.junit.Assert.assertEquals; import java.util.logging.Logger; import javax.inject.Inject; import org.jboss.arquillian.container.test.api.Deployment; import org.jboss.arquillian.junit.Arquillian; import org.jboss.resteasy.cdi.generic.Animal; import org.jboss.resteasy.cdi.generic.Australopithecus; import org.jboss.resteasy.cdi.generic.ConcreteResource; import org.jboss.resteasy.cdi.generic.ConcreteResourceIntf; import org.jboss.resteasy.cdi.generic.GenericsProducer; import org.jboss.resteasy.cdi.generic.HierarchyHolder; import org.jboss.resteasy.cdi.generic.HierarchyTypedResource; import org.jboss.resteasy.cdi.generic.HierarchyTypedResourceIntf; import org.jboss.resteasy.cdi.generic.HolderBinding; import org.jboss.resteasy.cdi.generic.JaxRsActivator; import org.jboss.resteasy.cdi.generic.LowerBoundDecorator; import org.jboss.resteasy.cdi.generic.LowerBoundHierarchyHolder; import org.jboss.resteasy.cdi.generic.LowerBoundTypedResource; import org.jboss.resteasy.cdi.generic.LowerBoundTypedResourceIntf; import org.jboss.resteasy.cdi.generic.NestedHierarchyHolder; import org.jboss.resteasy.cdi.generic.NestedTypedResource; import org.jboss.resteasy.cdi.generic.NestedTypedResourceIntf; import org.jboss.resteasy.cdi.generic.ObjectHolder; import org.jboss.resteasy.cdi.generic.ObjectTypedResource; import org.jboss.resteasy.cdi.generic.ObjectTypedResourceIntf; import org.jboss.resteasy.cdi.generic.Primate; import org.jboss.resteasy.cdi.generic.ResourceBinding; import org.jboss.resteasy.cdi.generic.UpperBoundHierarchyHolder; import org.jboss.resteasy.cdi.generic.UpperBoundTypedResource; import org.jboss.resteasy.cdi.generic.UpperBoundTypedResourceIntf; import org.jboss.resteasy.cdi.generic.VisitList; import org.jboss.resteasy.cdi.util.UtilityProducer; import org.jboss.resteasy.client.ClientRequest; import org.jboss.resteasy.client.ClientResponse; import org.jboss.shrinkwrap.api.Archive; import org.jboss.shrinkwrap.api.ShrinkWrap; import org.jboss.shrinkwrap.api.spec.WebArchive; import org.junit.Test; import org.junit.runner.RunWith; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright Dec 14, 2012 */ @RunWith(Arquillian.class) public class LowerBoundDecoratorTest { @Inject private Logger log; @Deployment public static Archive createTestArchive() { WebArchive war = ShrinkWrap.create(WebArchive.class, "resteasy-cdi-ejb-test.war") .addClasses(JaxRsActivator.class, UtilityProducer.class, VisitList.class) .addClasses(GenericsProducer.class, HolderBinding.class, ResourceBinding.class) .addClasses(ConcreteResourceIntf.class, ConcreteResource.class) .addClasses(ObjectTypedResourceIntf.class, ObjectTypedResource.class) .addClasses(HierarchyTypedResourceIntf.class, HierarchyTypedResource.class) .addClasses(NestedTypedResourceIntf.class, NestedTypedResource.class) .addClasses(UpperBoundTypedResourceIntf.class, UpperBoundTypedResource.class) .addClasses(LowerBoundTypedResourceIntf.class, LowerBoundTypedResource.class) .addClasses(ObjectHolder.class, HierarchyHolder.class, NestedHierarchyHolder.class) .addClasses(UpperBoundHierarchyHolder.class, LowerBoundHierarchyHolder.class) .addClasses(Animal.class, Primate.class, Australopithecus.class) .addClasses(LowerBoundDecorator.class) .addAsWebInfResource("generic/lower_bound_beans.xml", "beans.xml"); System.out.println(war.toString(true)); return war; } @Test public void testLowerBoundDecorator() throws Exception { log.info("starting testLowerBoundDecorator()"); ClientRequest request = new ClientRequest("http://localhost:8080/resteasy-cdi-ejb-test/rest/lowerbound/decorators/clear"); ClientResponse response = request.get(); log.info("Status: " + response.getStatus()); assertEquals(200, response.getStatus()); request = new ClientRequest("http://localhost:8080/resteasy-cdi-ejb-test/rest/lowerbound/decorators/execute"); response = request.get(); log.info("Status: " + response.getStatus()); assertEquals(200, response.getStatus()); request = new ClientRequest("http://localhost:8080/resteasy-cdi-ejb-test/rest/lowerbound/decorators/test"); response = request.get(); log.info("Status: " + response.getStatus()); assertEquals(200, response.getStatus()); response.releaseConnection(); } } UpperBoundDecoratorTest.java000066400000000000000000000107541225215345600427230ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/test/java/org/jboss/resteasy/test/cdi/genericpackage org.jboss.resteasy.test.cdi.generic; import static org.junit.Assert.assertEquals; import java.util.logging.Logger; import javax.inject.Inject; import org.jboss.arquillian.container.test.api.Deployment; import org.jboss.arquillian.junit.Arquillian; import org.jboss.resteasy.cdi.generic.Animal; import org.jboss.resteasy.cdi.generic.Australopithecus; import org.jboss.resteasy.cdi.generic.ConcreteResource; import org.jboss.resteasy.cdi.generic.ConcreteResourceIntf; import org.jboss.resteasy.cdi.generic.GenericsProducer; import org.jboss.resteasy.cdi.generic.HierarchyHolder; import org.jboss.resteasy.cdi.generic.HierarchyTypedResource; import org.jboss.resteasy.cdi.generic.HierarchyTypedResourceIntf; import org.jboss.resteasy.cdi.generic.HolderBinding; import org.jboss.resteasy.cdi.generic.JaxRsActivator; import org.jboss.resteasy.cdi.generic.LowerBoundHierarchyHolder; import org.jboss.resteasy.cdi.generic.LowerBoundTypedResource; import org.jboss.resteasy.cdi.generic.LowerBoundTypedResourceIntf; import org.jboss.resteasy.cdi.generic.NestedHierarchyHolder; import org.jboss.resteasy.cdi.generic.NestedTypedResource; import org.jboss.resteasy.cdi.generic.NestedTypedResourceIntf; import org.jboss.resteasy.cdi.generic.ObjectHolder; import org.jboss.resteasy.cdi.generic.ObjectTypedResource; import org.jboss.resteasy.cdi.generic.ObjectTypedResourceIntf; import org.jboss.resteasy.cdi.generic.Primate; import org.jboss.resteasy.cdi.generic.ResourceBinding; import org.jboss.resteasy.cdi.generic.UpperBoundDecorator; import org.jboss.resteasy.cdi.generic.UpperBoundHierarchyHolder; import org.jboss.resteasy.cdi.generic.UpperBoundTypedResource; import org.jboss.resteasy.cdi.generic.UpperBoundTypedResourceIntf; import org.jboss.resteasy.cdi.generic.VisitList; import org.jboss.resteasy.cdi.util.UtilityProducer; import org.jboss.resteasy.client.ClientRequest; import org.jboss.resteasy.client.ClientResponse; import org.jboss.shrinkwrap.api.Archive; import org.jboss.shrinkwrap.api.ShrinkWrap; import org.jboss.shrinkwrap.api.spec.WebArchive; import org.junit.Test; import org.junit.runner.RunWith; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright Dec 14, 2012 */ @RunWith(Arquillian.class) public class UpperBoundDecoratorTest { @Inject private Logger log; @Deployment public static Archive createTestArchive() { WebArchive war = ShrinkWrap.create(WebArchive.class, "resteasy-cdi-ejb-test.war") .addClasses(JaxRsActivator.class, UtilityProducer.class, VisitList.class) .addClasses(GenericsProducer.class, HolderBinding.class, ResourceBinding.class) .addClasses(ConcreteResourceIntf.class, ConcreteResource.class) .addClasses(ObjectTypedResourceIntf.class, ObjectTypedResource.class) .addClasses(HierarchyTypedResourceIntf.class, HierarchyTypedResource.class) .addClasses(NestedTypedResourceIntf.class, NestedTypedResource.class) .addClasses(UpperBoundTypedResourceIntf.class, UpperBoundTypedResource.class) .addClasses(LowerBoundTypedResourceIntf.class, LowerBoundTypedResource.class) .addClasses(ObjectHolder.class, HierarchyHolder.class, NestedHierarchyHolder.class) .addClasses(UpperBoundHierarchyHolder.class, LowerBoundHierarchyHolder.class) .addClasses(Animal.class, Primate.class, Australopithecus.class) .addClasses(UpperBoundDecorator.class) .addAsWebInfResource("generic/upper_bound_beans.xml", "beans.xml"); System.out.println(war.toString(true)); return war; } @Test public void testUpperBoundDecorator() throws Exception { log.info("starting testUpperBoundDecorator()"); ClientRequest request = new ClientRequest("http://localhost:8080/resteasy-cdi-ejb-test/rest/upperbound/decorators/clear"); ClientResponse response = request.get(); log.info("Status: " + response.getStatus()); assertEquals(200, response.getStatus()); request = new ClientRequest("http://localhost:8080/resteasy-cdi-ejb-test/rest/upperbound/decorators/execute"); response = request.get(); log.info("Status: " + response.getStatus()); assertEquals(200, response.getStatus()); request = new ClientRequest("http://localhost:8080/resteasy-cdi-ejb-test/rest/upperbound/decorators/test"); response = request.get(); log.info("Status: " + response.getStatus()); assertEquals(200, response.getStatus()); response.releaseConnection(); } } 000077500000000000000000000000001225215345600361405ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/test/java/org/jboss/resteasy/test/cdi/inheritanceAlternativeSelectedInheritanceTest.java000066400000000000000000000043631225215345600457520ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/test/java/org/jboss/resteasy/test/cdi/inheritancepackage org.jboss.resteasy.test.cdi.inheritance; import static org.junit.Assert.assertEquals; import java.util.logging.Logger; import javax.inject.Inject; import org.jboss.arquillian.container.test.api.Deployment; import org.jboss.arquillian.junit.Arquillian; import org.jboss.resteasy.cdi.inheritence.Book; import org.jboss.resteasy.cdi.inheritence.BookVanillaAlternative; import org.jboss.resteasy.cdi.inheritence.BookSelectedAlternative; import org.jboss.resteasy.cdi.inheritence.InheritanceResource; import org.jboss.resteasy.cdi.inheritence.JaxRsActivator; import org.jboss.resteasy.cdi.inheritence.SelectBook; import org.jboss.resteasy.cdi.inheritence.StereotypeAlternative; import org.jboss.resteasy.cdi.util.UtilityProducer; import org.jboss.resteasy.client.ClientRequest; import org.jboss.resteasy.client.ClientResponse; import org.jboss.shrinkwrap.api.Archive; import org.jboss.shrinkwrap.api.ShrinkWrap; import org.jboss.shrinkwrap.api.spec.WebArchive; import org.junit.Test; import org.junit.runner.RunWith; /** * This class tests CDI inheritance. * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright Dec 5, 2012 */ @RunWith(Arquillian.class) public class AlternativeSelectedInheritanceTest { @Inject Logger log; @Deployment public static Archive createTestArchive() { WebArchive war = ShrinkWrap.create(WebArchive.class, "resteasy-cdi-ejb-test.war") .addClasses(JaxRsActivator.class, UtilityProducer.class) .addClasses(SelectBook.class, StereotypeAlternative.class) .addClasses(Book.class, BookVanillaAlternative.class, BookSelectedAlternative.class, InheritanceResource.class) .addAsWebInfResource("inheritence/alternativeSelectedBeans.xml", "beans.xml"); System.out.println(war.toString(true)); return war; } @Test public void testAlternative() throws Exception { log.info("starting testAlternative()"); ClientRequest request = new ClientRequest("http://localhost:8080/resteasy-cdi-ejb-test/rest/alternative/selected"); ClientResponse response = request.get(); log.info("Status: " + response.getStatus()); assertEquals(200, response.getStatus()); response.releaseConnection(); } } AlternativeVanillaInheritanceTest.java000066400000000000000000000041661225215345600456110ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/test/java/org/jboss/resteasy/test/cdi/inheritancepackage org.jboss.resteasy.test.cdi.inheritance; import static org.junit.Assert.assertEquals; import java.util.logging.Logger; import javax.inject.Inject; import org.jboss.arquillian.container.test.api.Deployment; import org.jboss.arquillian.junit.Arquillian; import org.jboss.resteasy.cdi.inheritence.Book; import org.jboss.resteasy.cdi.inheritence.BookVanillaAlternative; import org.jboss.resteasy.cdi.inheritence.InheritanceResource; import org.jboss.resteasy.cdi.inheritence.JaxRsActivator; import org.jboss.resteasy.cdi.inheritence.SelectBook; import org.jboss.resteasy.cdi.inheritence.StereotypeAlternative; import org.jboss.resteasy.cdi.util.UtilityProducer; import org.jboss.resteasy.client.ClientRequest; import org.jboss.resteasy.client.ClientResponse; import org.jboss.shrinkwrap.api.Archive; import org.jboss.shrinkwrap.api.ShrinkWrap; import org.jboss.shrinkwrap.api.spec.WebArchive; import org.junit.Test; import org.junit.runner.RunWith; /** * This class tests CDI inheritance. * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright Dec 5, 2012 */ @RunWith(Arquillian.class) public class AlternativeVanillaInheritanceTest { @Inject Logger log; @Deployment public static Archive createTestArchive() { WebArchive war = ShrinkWrap.create(WebArchive.class, "resteasy-cdi-ejb-test.war") .addClasses(JaxRsActivator.class, UtilityProducer.class) .addClasses(Book.class, SelectBook.class, StereotypeAlternative.class, BookVanillaAlternative.class, InheritanceResource.class) .addAsWebInfResource("inheritence/alternativeVanillaBeans.xml", "beans.xml"); System.out.println(war.toString(true)); return war; } @Test public void testAlternative() throws Exception { log.info("starting testAlternative()"); ClientRequest request = new ClientRequest("http://localhost:8080/resteasy-cdi-ejb-test/rest/alternative/vanilla"); ClientResponse response = request.get(); log.info("Status: " + response.getStatus()); assertEquals(200, response.getStatus()); response.releaseConnection(); } } SpecializedInheritanceTest.java000066400000000000000000000041521225215345600442530ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/test/java/org/jboss/resteasy/test/cdi/inheritancepackage org.jboss.resteasy.test.cdi.inheritance; import static org.junit.Assert.assertEquals; import java.util.logging.Logger; import javax.inject.Inject; import org.jboss.arquillian.container.test.api.Deployment; import org.jboss.arquillian.junit.Arquillian; import org.jboss.resteasy.cdi.inheritence.Book; import org.jboss.resteasy.cdi.inheritence.BookSpecialized; import org.jboss.resteasy.cdi.inheritence.InheritanceResource; import org.jboss.resteasy.cdi.inheritence.JaxRsActivator; import org.jboss.resteasy.cdi.inheritence.SelectBook; import org.jboss.resteasy.cdi.inheritence.StereotypeAlternative; import org.jboss.resteasy.cdi.util.UtilityProducer; import org.jboss.resteasy.client.ClientRequest; import org.jboss.resteasy.client.ClientResponse; import org.jboss.shrinkwrap.api.Archive; import org.jboss.shrinkwrap.api.ShrinkWrap; import org.jboss.shrinkwrap.api.spec.WebArchive; import org.junit.Test; import org.junit.runner.RunWith; /** * This class tests CDI inheritance. * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright Dec 5, 2012 */ @RunWith(Arquillian.class) public class SpecializedInheritanceTest { @Inject Logger log; @Deployment public static Archive createTestArchive() { WebArchive war = ShrinkWrap.create(WebArchive.class, "resteasy-cdi-ejb-test.war") .addClasses(JaxRsActivator.class, UtilityProducer.class) .addClasses(SelectBook.class, StereotypeAlternative.class) .addClasses(Book.class, BookSpecialized.class, InheritanceResource.class) .addAsWebInfResource("inheritence/specializedBeans.xml", "beans.xml"); System.out.println(war.toString(true)); return war; } @Test public void testAlternative() throws Exception { log.info("starting testAlternative()"); ClientRequest request = new ClientRequest("http://localhost:8080/resteasy-cdi-ejb-test/rest/specialized"); ClientResponse response = request.get(); log.info("Status: " + response.getStatus()); assertEquals(200, response.getStatus()); response.releaseConnection(); } } VanillaInheritanceTest.java000066400000000000000000000036361225215345600434130ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/test/java/org/jboss/resteasy/test/cdi/inheritancepackage org.jboss.resteasy.test.cdi.inheritance; import static org.junit.Assert.assertEquals; import java.util.logging.Logger; import javax.inject.Inject; import org.jboss.arquillian.container.test.api.Deployment; import org.jboss.arquillian.junit.Arquillian; import org.jboss.resteasy.cdi.inheritence.Book; import org.jboss.resteasy.cdi.inheritence.InheritanceResource; import org.jboss.resteasy.cdi.inheritence.JaxRsActivator; import org.jboss.resteasy.cdi.inheritence.SelectBook; import org.jboss.resteasy.cdi.util.UtilityProducer; import org.jboss.resteasy.client.ClientRequest; import org.jboss.resteasy.client.ClientResponse; import org.jboss.shrinkwrap.api.Archive; import org.jboss.shrinkwrap.api.ShrinkWrap; import org.jboss.shrinkwrap.api.asset.EmptyAsset; import org.jboss.shrinkwrap.api.spec.WebArchive; import org.junit.Test; import org.junit.runner.RunWith; /** * This class tests CDI inheritance. * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright Dec 5, 2012 */ @RunWith(Arquillian.class) public class VanillaInheritanceTest { @Inject Logger log; @Deployment public static Archive createTestArchive() { WebArchive war = ShrinkWrap.create(WebArchive.class, "resteasy-cdi-ejb-test.war") .addClasses(JaxRsActivator.class, UtilityProducer.class, Book.class, SelectBook.class, InheritanceResource.class) .addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml"); System.out.println(war.toString(true)); return war; } @Test public void testVanilla() throws Exception { log.info("starting testVanilla()"); ClientRequest request = new ClientRequest("http://localhost:8080/resteasy-cdi-ejb-test/rest/vanilla/"); ClientResponse response = request.get(); log.info("Status: " + response.getStatus()); assertEquals(200, response.getStatus()); response.releaseConnection(); } } 000077500000000000000000000000001225215345600356315ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/test/java/org/jboss/resteasy/test/cdi/injectionInjectionTest.java000066400000000000000000000350161225215345600412630ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/test/java/org/jboss/resteasy/test/cdi/injectionpackage org.jboss.resteasy.test.cdi.injection; import static org.junit.Assert.assertEquals; import java.lang.reflect.ParameterizedType; import java.lang.reflect.Type; import java.util.Collection; import java.util.Iterator; import java.util.logging.Logger; import javax.annotation.Resource; import javax.inject.Inject; import javax.ws.rs.core.MediaType; import junit.framework.Assert; import org.jboss.arquillian.container.test.api.Deployment; import org.jboss.arquillian.junit.Arquillian; import org.jboss.resteasy.cdi.injection.Book; import org.jboss.resteasy.cdi.injection.BookBag; import org.jboss.resteasy.cdi.injection.BookBagLocal; import org.jboss.resteasy.cdi.injection.BookCollection; import org.jboss.resteasy.cdi.injection.BookReader; import org.jboss.resteasy.cdi.injection.BookResource; import org.jboss.resteasy.cdi.injection.BookWriter; import org.jboss.resteasy.cdi.injection.DependentScoped; import org.jboss.resteasy.cdi.injection.JaxRsActivator; import org.jboss.resteasy.cdi.injection.NewBean; import org.jboss.resteasy.cdi.injection.ResourceProducer; import org.jboss.resteasy.cdi.injection.ScopeInheritingStereotype; import org.jboss.resteasy.cdi.injection.ScopeStereotype; import org.jboss.resteasy.cdi.injection.StatefulEJB; import org.jboss.resteasy.cdi.injection.StereotypedApplicationScope; import org.jboss.resteasy.cdi.injection.StereotypedDependentScope; import org.jboss.resteasy.cdi.injection.UnscopedResource; import org.jboss.resteasy.cdi.util.Constants; import org.jboss.resteasy.cdi.util.Counter; import org.jboss.resteasy.cdi.util.PersistenceUnitProducer; import org.jboss.resteasy.cdi.util.UtilityProducer; import org.jboss.resteasy.client.ClientExecutor; import org.jboss.resteasy.client.ClientRequest; import org.jboss.resteasy.client.ClientResponse; import org.jboss.resteasy.client.core.executors.ApacheHttpClient4Executor; import org.jboss.shrinkwrap.api.Archive; import org.jboss.shrinkwrap.api.ShrinkWrap; import org.jboss.shrinkwrap.api.asset.EmptyAsset; import org.jboss.shrinkwrap.api.spec.WebArchive; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; /** * This is a collection of tests addressed to the interactions of * Resteasy, CDI, EJB, and so forth in the context of a JEE Application Server. * * It tests the injection of a variety of beans into Resteasy objects. * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright May 8, 2012 */ @RunWith(Arquillian.class) public class InjectionTest { @Inject Logger log; private static int invocationCounter; static ParameterizedType BookCollectionType = new ParameterizedType() { @Override public Type[] getActualTypeArguments() { return new Type[]{Book.class}; } @Override public Type getRawType() { return Collection.class; } @Override public Type getOwnerType() { return null; } }; @Deployment public static Archive createTestArchive() { WebArchive war = ShrinkWrap.create(WebArchive.class, "resteasy-cdi-ejb-test.war") .addClasses(Book.class, BookResource.class, JaxRsActivator.class, Constants.class, UtilityProducer.class, BookCollectionType.getClass()) .addClasses(Counter.class, BookCollection.class, BookReader.class, BookWriter.class) .addClasses(DependentScoped.class, StatefulEJB.class, UnscopedResource.class) .addClasses(BookBagLocal.class, BookBag.class) .addClasses(NewBean.class) .addClasses(ScopeStereotype.class, ScopeInheritingStereotype.class) .addClasses(StereotypedApplicationScope.class, StereotypedDependentScope.class) .addClasses(Resource.class, ResourceProducer.class, PersistenceUnitProducer.class) .addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml") .addAsResource("injection/persistence.xml", "META-INF/persistence.xml"); System.out.println(war.toString(true)); return war; } @Before public void preparePersistenceTest() throws Exception { System.out.println("Dumping old records..."); ClientRequest request = new ClientRequest("http://localhost:8080/resteasy-cdi-ejb-test/rest/empty/"); ClientResponse response = request.post(); invocationCounter++; response.releaseConnection(); } /** * Addresses the correct handling of built-in scopes. E.g. * * 1) Providers are in the application scope, whether they are annotated or not. * 2) Resources are in the request scope, annotated or not. * 3) Objects in the dependent scope, when injected into JAX-RS objects, are handled properly. * 4) Singletons in the application scope, when injected in request scoped JAX-RS resources as * EJB proxies or Weld proxies, are handled properly. * * A side effect of 3) and 4) is to test that beans managed by CDI (managed beans, singleton beans, * stateless EJBs) are injected properly into JAX-RS objects. */ @Test public void testVerifyScopes() throws Exception { log.info("starting testVerifyScopes()"); ClientRequest request = new ClientRequest("http://localhost:8080/resteasy-cdi-ejb-test/rest/verifyScopes/"); ClientResponse response = request.get(); invocationCounter++; log.info("Status: " + response.getStatus()); assertEquals(200, response.getStatus()); response.releaseConnection(); response = request.get(); invocationCounter++; log.info("Status: " + response.getStatus()); assertEquals(200, response.getStatus()); response.releaseConnection(); } /** * Addresses the injection of managed beans, singletons, and stateless EJBs into JAX-RS objects. * Uses a singleton (BookCollection) to interact with an EntityManager. */ @Test public void testEJBs() throws Exception { log.info("starting testEJBs()"); // Create book. ClientRequest request = new ClientRequest("http://localhost:8080/resteasy-cdi-ejb-test/rest/create/"); Book book1 = new Book("RESTEasy: the Sequel"); request.body("application/test+xml", book1); ClientResponse response = request.post(); invocationCounter++; assertEquals(200, response.getStatus()); log.info("Status: " + response.getStatus()); int id1 = response.getEntity(int.class); log.info("id: " + id1); Assert.assertEquals(Counter.INITIAL_VALUE, id1); // Create another book. request = new ClientRequest("http://localhost:8080/resteasy-cdi-ejb-test/rest/create/"); Book book2 = new Book("RESTEasy: It's Alive"); request.body("application/test+xml", book2); response = request.post(); invocationCounter++; assertEquals(200, response.getStatus()); log.info("Status: " + response.getStatus()); int id2 = response.getEntity(int.class); log.info("id: " + id2); Assert.assertEquals(Counter.INITIAL_VALUE + 1, id2); // Retrieve first book. request = new ClientRequest("http://localhost:8080/resteasy-cdi-ejb-test/rest/book/" + id1); request.accept("application/test+xml"); response = request.get(); invocationCounter++; log.info("Status: " + response.getStatus()); assertEquals(200, response.getStatus()); Book result = response.getEntity(Book.class); log.info("book: " + book1); Assert.assertEquals(book1, result); // Retrieve second book. request = new ClientRequest("http://localhost:8080/resteasy-cdi-ejb-test/rest/book/" + id2); request.accept("application/test+xml"); response = request.get(); invocationCounter++; log.info("Status: " + response.getStatus()); assertEquals(200, response.getStatus()); result = response.getEntity(Book.class); log.info("book: " + book2); Assert.assertEquals(book2, result); // Retrieve all books. request = new ClientRequest("http://localhost:8080/resteasy-cdi-ejb-test/rest/books/"); request.accept(MediaType.APPLICATION_XML); response = request.get(); invocationCounter++; log.info("Status: " + response.getStatus()); @SuppressWarnings("unchecked") Collection books = response.getEntity(Collection.class, BookCollectionType); log.info("Collection: " + books); Assert.assertEquals(2, books.size()); Iterator it = books.iterator(); Book b1 = it.next(); Book b2 = it.next(); log.info("First book in list: " + b1); log.info("Second book in list: " + b2); Assert.assertTrue(book1.equals(b1) && book2.equals(b2) || book1.equals(b2) && book2.equals(b1)); // Test EntityManager injected in BookResource request = new ClientRequest("http://localhost:8080/resteasy-cdi-ejb-test/rest/entityManager"); response = request.post(); invocationCounter++; log.info("Status: " + response.getStatus()); assertEquals(200, response.getStatus()); response.releaseConnection(); } /** * This test verifies that a session scoped SFSB survives throughout the course of a session and is * re-injected into the request scoped BookResource over the course of the session. Also, it is destroyed * and replaced when an invocation is made on BookResource after the session ends. */ @Test public void testSessionScope() throws Exception { log.info("starting testSessionScope()"); // Need to supply each ClientRequest with a single ClientExecutor to maintain a single // cookie cache, which keeps the session alive. ClientExecutor executor = new ApacheHttpClient4Executor(); // Create a book, which gets stored in the session scoped BookBag. ClientRequest request = new ClientRequest("http://localhost:8080/resteasy-cdi-ejb-test/rest/session/add/", executor); Book book1 = new Book(13, "Dead Man Napping"); request.body(Constants.MEDIA_TYPE_TEST_XML, book1); ClientResponse response = request.post(); invocationCounter++; log.info("status: " + response.getStatus()); Assert.assertEquals(200, response.getStatus()); response.releaseConnection(); // Create another book, which should get stored in the same BookBag. request = new ClientRequest("http://localhost:8080/resteasy-cdi-ejb-test/rest/session/add/", executor); Book book2 = new Book(Counter.INITIAL_VALUE, "Dead Man Dozing"); request.body(Constants.MEDIA_TYPE_TEST_XML, book2); response = request.post(); invocationCounter++; log.info("status: " + response.getStatus()); Assert.assertEquals(200, response.getStatus()); response.releaseConnection(); // Get the current contents of the BookBag, and verify that it holds both of the books sent in the // previous two invocations. When this method is called, the session is terminated. request = new ClientRequest("http://localhost:8080/resteasy-cdi-ejb-test/rest/session/get/", executor); response = request.get(); invocationCounter++; log.info("status: " + response.getStatus()); Assert.assertEquals(200, response.getStatus()); @SuppressWarnings("unchecked") Collection books = response.getEntity(Collection.class, BookCollectionType); log.info("Collection: " + books); Assert.assertEquals(2, books.size()); Iterator it = books.iterator(); Book b1 = it.next(); Book b2 = it.next(); log.info("First book in list: " + b1); log.info("Second book in list: " + b2); Assert.assertTrue(book1.equals(b1) && book2.equals(b2) || book1.equals(b2) && book2.equals(b1)); // Verify that the BookBag has been replaced by a new, empty one for the new session. request = new ClientRequest("http://localhost:8080/resteasy-cdi-ejb-test/rest/session/test/"); response = request.post(); invocationCounter++; log.info("status: " + response.getStatus()); Assert.assertEquals(200, response.getStatus()); response.releaseConnection(); } /** * Tests the injection of JMS Producers, Consumers, and Queues using producer fields and methods. */ @Test public void testJMS() throws Exception { log.info("starting testJMS()"); // Send a book title. ClientRequest request = new ClientRequest("http://localhost:8080/resteasy-cdi-ejb-test/rest/produceMessage/"); String title = "Dead Man Lounging"; Book book = new Book(23, title); request.body(Constants.MEDIA_TYPE_TEST_XML, book); ClientResponse response = request.post(); invocationCounter++; log.info("status: " + response.getStatus()); log.info(response.getEntity(String.class)); Assert.assertEquals(200, response.getStatus()); // Verify that the received book title is the one that was sent. request = new ClientRequest("http://localhost:8080/resteasy-cdi-ejb-test/rest/queue/consumeMessage/"); log.info("consuming book"); response = request.get(); invocationCounter++; log.info("status: " + response.getStatus()); Assert.assertEquals(200, response.getStatus()); Assert.assertEquals(title, response.getEntity(String.class)); } /** * Verifies that BookResource.postConstruct() and preDestroy() are called for each invocation. */ @Test public void testPostConstructPreDestroy() throws Exception { log.info("starting testPostConstructPreDestroy()"); // Send a book title. log.info("invocationCounter: " + invocationCounter); ClientRequest request = new ClientRequest("http://localhost:8080/resteasy-cdi-ejb-test/rest/getCounters/"); ClientResponse response = request.get(); log.info("status: " + response.getStatus()); String result = response.getEntity(String.class); log.info(result); Assert.assertEquals(200, response.getStatus()); String[] counters = result.split(":"); Assert.assertTrue(invocationCounter + 1 == Integer.valueOf(counters[0])); // invocations of postConstruct() Assert.assertTrue(invocationCounter == Integer.valueOf(counters[1])); // invocations of preDestroy() } /** * Verifies that ResourceProducer disposer method has been called for Queue. */ @Test public void testDisposer() throws Exception { log.info("starting testDisposer()"); ClientRequest request = new ClientRequest("http://localhost:8080/resteasy-cdi-ejb-test/rest/disposer/"); ClientResponse response = request.get(); log.info("status: " + response.getStatus()); Assert.assertEquals(200, response.getStatus()); response.releaseConnection(); } } MDBInjectionTest.java000066400000000000000000000112341225215345600416020ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/test/java/org/jboss/resteasy/test/cdi/injectionpackage org.jboss.resteasy.test.cdi.injection; import java.util.logging.Logger; import javax.annotation.Resource; import javax.inject.Inject; import junit.framework.Assert; import org.jboss.arquillian.container.test.api.Deployment; import org.jboss.arquillian.junit.Arquillian; import org.jboss.resteasy.cdi.injection.Book; import org.jboss.resteasy.cdi.injection.BookBag; import org.jboss.resteasy.cdi.injection.BookBagLocal; import org.jboss.resteasy.cdi.injection.BookCollection; import org.jboss.resteasy.cdi.injection.BookMDB; import org.jboss.resteasy.cdi.injection.BookReader; import org.jboss.resteasy.cdi.injection.BookResource; import org.jboss.resteasy.cdi.injection.BookWriter; import org.jboss.resteasy.cdi.injection.DependentScoped; import org.jboss.resteasy.cdi.injection.JaxRsActivator; import org.jboss.resteasy.cdi.injection.NewBean; import org.jboss.resteasy.cdi.injection.ResourceProducer; import org.jboss.resteasy.cdi.injection.ScopeInheritingStereotype; import org.jboss.resteasy.cdi.injection.ScopeStereotype; import org.jboss.resteasy.cdi.injection.StatefulEJB; import org.jboss.resteasy.cdi.injection.StereotypedApplicationScope; import org.jboss.resteasy.cdi.injection.StereotypedDependentScope; import org.jboss.resteasy.cdi.injection.UnscopedResource; import org.jboss.resteasy.cdi.util.Constants; import org.jboss.resteasy.cdi.util.Counter; import org.jboss.resteasy.cdi.util.PersistenceUnitProducer; import org.jboss.resteasy.cdi.util.UtilityProducer; import org.jboss.resteasy.client.ClientRequest; import org.jboss.resteasy.client.ClientResponse; import org.jboss.shrinkwrap.api.Archive; import org.jboss.shrinkwrap.api.ShrinkWrap; import org.jboss.shrinkwrap.api.asset.EmptyAsset; import org.jboss.shrinkwrap.api.spec.WebArchive; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; /** * This class tests the use of MDBs with Resteasy, including the injection of a * JAX-RS resource into an MDB. * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright Dec 8, 2012 */ @RunWith(Arquillian.class) public class MDBInjectionTest { @Inject Logger log; @Deployment public static Archive createTestArchive() { WebArchive war = ShrinkWrap.create(WebArchive.class, "resteasy-cdi-ejb-test.war") .addClasses(Book.class, BookResource.class, JaxRsActivator.class, Constants.class, UtilityProducer.class) .addClasses(Counter.class, BookCollection.class, BookReader.class, BookWriter.class) .addClasses(DependentScoped.class, StatefulEJB.class, UnscopedResource.class) .addClasses(BookBagLocal.class, BookBag.class) .addClasses(BookMDB.class) .addClasses(NewBean.class) .addClasses(ScopeStereotype.class, ScopeInheritingStereotype.class) .addClasses(StereotypedApplicationScope.class, StereotypedDependentScope.class) .addClasses(Resource.class, ResourceProducer.class, PersistenceUnitProducer.class) .addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml") .setManifest("reverseInjection/hornetq_manifest.mf") .addAsResource("injection/persistence.xml", "META-INF/persistence.xml"); System.out.println(war.toString(true)); return war; } @Before public void preparePersistenceTest() throws Exception { System.out.println("Dumping old records..."); ClientRequest request = new ClientRequest("http://localhost:8080/resteasy-cdi-ejb-test/rest/empty/"); ClientResponse response = request.post(); response.releaseConnection(); } /** * Tests the injection of JMS Producers, Consumers, Queues, and MDBs using producer fields and methods. */ @Test public void testMDB() throws Exception { log.info("starting testJMS()"); // Send a book title. ClientRequest request = new ClientRequest("http://localhost:8080/resteasy-cdi-ejb-test/rest/produceMessage/"); String title = "Dead Man Lounging"; Book book = new Book(23, title); request.body(Constants.MEDIA_TYPE_TEST_XML, book); ClientResponse response = request.post(); log.info("status: " + response.getStatus()); log.info(response.getEntity(String.class)); Assert.assertEquals(200, response.getStatus()); // Verify that the received book title is the one that was sent. request = new ClientRequest("http://localhost:8080/resteasy-cdi-ejb-test/rest/mdb/consumeMessage/"); response = request.get(); log.info("status: " + response.getStatus()); Assert.assertEquals(200, response.getStatus()); Assert.assertEquals(title, response.getEntity(String.class)); } } 000077500000000000000000000000001225215345600373045ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/test/java/org/jboss/resteasy/test/cdi/injection/reverseReverseInjectionTest.java000066400000000000000000000324541225215345600442750ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/test/java/org/jboss/resteasy/test/cdi/injection/reversepackage org.jboss.resteasy.test.cdi.injection.reverse; import static org.jboss.resteasy.cdi.injection.reverse.ReverseInjectionResource.NON_CONTEXTUAL; import java.lang.reflect.ParameterizedType; import java.lang.reflect.Type; import java.util.Collection; import java.util.Hashtable; import java.util.Iterator; import java.util.logging.Logger; import javax.inject.Inject; import javax.jms.Connection; import javax.jms.ConnectionFactory; import javax.jms.JMSException; import javax.jms.MessageProducer; import javax.jms.Queue; import javax.jms.Session; import javax.jms.TextMessage; import javax.naming.Context; import javax.naming.InitialContext; import junit.framework.Assert; import org.jboss.arquillian.container.test.api.Deployment; import org.jboss.arquillian.junit.Arquillian; import org.jboss.resteasy.cdi.injection.Book; import org.jboss.resteasy.cdi.injection.BookBag; import org.jboss.resteasy.cdi.injection.BookBagLocal; import org.jboss.resteasy.cdi.injection.BookCollection; import org.jboss.resteasy.cdi.injection.BookMDB; import org.jboss.resteasy.cdi.injection.BookReader; import org.jboss.resteasy.cdi.injection.BookResource; import org.jboss.resteasy.cdi.injection.BookWriter; import org.jboss.resteasy.cdi.injection.DependentScoped; import org.jboss.resteasy.cdi.injection.JaxRsActivator; import org.jboss.resteasy.cdi.injection.NewBean; import org.jboss.resteasy.cdi.injection.ResourceBinding; import org.jboss.resteasy.cdi.injection.ResourceProducer; import org.jboss.resteasy.cdi.injection.StatefulEJB; import org.jboss.resteasy.cdi.injection.StereotypedApplicationScope; import org.jboss.resteasy.cdi.injection.StereotypedDependentScope; import org.jboss.resteasy.cdi.injection.UnscopedResource; import org.jboss.resteasy.cdi.injection.reverse.EJBHolder; import org.jboss.resteasy.cdi.injection.reverse.EJBHolderLocal; import org.jboss.resteasy.cdi.injection.reverse.EJBHolderRemote; import org.jboss.resteasy.cdi.injection.reverse.EJBInterface; import org.jboss.resteasy.cdi.injection.reverse.ReverseInjectionResource; import org.jboss.resteasy.cdi.injection.reverse.StatefulApplicationScopedEJBwithJaxRsComponents; import org.jboss.resteasy.cdi.injection.reverse.StatefulApplicationScopedEJBwithJaxRsComponentsInterface; import org.jboss.resteasy.cdi.injection.reverse.StatefulDependentScopedEJBwithJaxRsComponents; import org.jboss.resteasy.cdi.injection.reverse.StatefulDependentScopedEJBwithJaxRsComponentsInterface; import org.jboss.resteasy.cdi.injection.reverse.StatefulRequestScopedEJBwithJaxRsComponents; import org.jboss.resteasy.cdi.injection.reverse.StatefulRequestScopedEJBwithJaxRsComponentsInterface; import org.jboss.resteasy.cdi.injection.reverse.StatelessEJBwithJaxRsComponents; import org.jboss.resteasy.cdi.injection.reverse.StatelessEJBwithJaxRsComponentsInterface; import org.jboss.resteasy.cdi.util.Constants; import org.jboss.resteasy.cdi.util.Counter; import org.jboss.resteasy.cdi.util.PersistenceUnitProducer; import org.jboss.resteasy.cdi.util.Utilities; import org.jboss.resteasy.cdi.util.UtilityProducer; import org.jboss.resteasy.client.ClientRequest; import org.jboss.resteasy.client.ClientResponse; import org.jboss.shrinkwrap.api.Archive; import org.jboss.shrinkwrap.api.ShrinkWrap; import org.jboss.shrinkwrap.api.asset.EmptyAsset; import org.jboss.shrinkwrap.api.spec.WebArchive; import org.junit.Test; import org.junit.runner.RunWith; /** * ReverseInjectionTest goes beyond InjectionTest by injecting Resteasy objects * into other kinds of beans, e.g., EJBs. * * For example, * * *) an EJB called EJBHolder is injected into the Resteasy resource ReverseInjectionResource * *) a variety of EJBs, e.g., StatelessEJBwithJaxRsComponents, are injected into EJBHolder * *) a variety of Resteasy resources are injected into StatelessEJBwithJaxRsComponents and similar EJBs. * * Also, the EJBs like StatelessEJBwithJaxRsComponents are injected into EJBHolder using both * @EJB and @Inject, and the semantics of both are tested. * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright May 8, 2012 */ @RunWith(Arquillian.class) public class ReverseInjectionTest { @Inject Logger log; static ParameterizedType BookCollectionType = new ParameterizedType() { @Override public Type[] getActualTypeArguments() { return new Type[]{Book.class}; } @Override public Type getRawType() { return Collection.class; } @Override public Type getOwnerType() { return null; } }; @Deployment public static Archive createTestArchive() { WebArchive war = ShrinkWrap.create(WebArchive.class, "resteasy-reverse-injection-test.war") .addClasses(Constants.class, PersistenceUnitProducer.class, UtilityProducer.class, Utilities.class) .addClasses(JaxRsActivator.class, Book.class, BookResource.class) .addClasses(ResourceBinding.class, ResourceProducer.class) .addClasses(Counter.class, BookCollection.class, BookReader.class, BookWriter.class) .addClasses(DependentScoped.class, StatefulEJB.class, UnscopedResource.class) .addClasses(BookBagLocal.class, BookBag.class) .addClasses(BookMDB.class) .addClasses(EJBInterface.class) .addClasses(StatelessEJBwithJaxRsComponentsInterface.class, StatelessEJBwithJaxRsComponents.class) .addClasses(StatefulDependentScopedEJBwithJaxRsComponentsInterface.class, StatefulDependentScopedEJBwithJaxRsComponents.class) .addClasses(StatefulRequestScopedEJBwithJaxRsComponentsInterface.class, StatefulRequestScopedEJBwithJaxRsComponents.class) .addClasses(StatefulApplicationScopedEJBwithJaxRsComponentsInterface.class, StatefulApplicationScopedEJBwithJaxRsComponents.class) .addClasses(EJBHolderRemote.class, EJBHolderLocal.class, EJBHolder.class) .addClasses(ReverseInjectionResource.class) .addClasses(NewBean.class, StereotypedApplicationScope.class, StereotypedDependentScope.class) .addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml") .setManifest("reverseInjection/hornetq_manifest.mf") .addAsResource("injection/persistence.xml", "META-INF/persistence.xml"); System.out.println(war.toString(true)); return war; } /** * Addresses injection of JAX-RS components (BookResource, BookReader, BookWriter) into * a stateless EJB3. The target SLSB is not a contextual object, since it is * obtained through JNDI, so CDI performs injections when the SLSB is created, * but there is no scope management. It follows that the target SLSB is not recreated * for the second invocation. */ @Test public void testSLSB() throws Exception { log.info("starting testSLSB()"); final Hashtable jndiProperties = new Hashtable(); jndiProperties.put(Context.URL_PKG_PREFIXES, "org.jboss.ejb.client.naming"); final Context context = new InitialContext(jndiProperties); String name = "ejb:/resteasy-reverse-injection-test/StatelessEJBwithJaxRsComponents!" + StatelessEJBwithJaxRsComponentsInterface.class.getName(); StatelessEJBwithJaxRsComponentsInterface remote = StatelessEJBwithJaxRsComponentsInterface.class.cast(context.lookup(name)); log.info("remote: " + remote); remote.setUp(NON_CONTEXTUAL); Assert.assertTrue(remote.test(NON_CONTEXTUAL)); } /** * Addresses injection of JAX-RS components (BookResource, BookReader, BookWriter) into * a @Dependent annotated stateful EJB3. The target SFSB is not a contextual object, * since it is obtained through JNDI, so CDI performs injections when the SFSB is created, * but there is no scope management. It follows that the target SFSB is not recreated * for the second invocation. */ @Test public void testSFSBDependentScope() throws Exception { log.info("starting testSFSBDependentScope()"); doTestSFSB("Dependent"); } /** * Addresses injection of JAX-RS components (BookResource, BookReader, BookWriter) into * a @RequestScoped annotated stateful EJB3. The target SFSB is not a contextual object, * since it is obtained through JNDI, so CDI performs injections when the SFSB is created, * but there is no scope management. It follows that the target SFSB is not recreated * for the second invocation. */ @Test public void testSFSBRequestScope() throws Exception { log.info("starting testSFSBRequestScope()"); doTestSFSB("Request"); } /** * Addresses injection of JAX-RS components (BookResource, BookReader, BookWriter) into * a @ApplicationScoped annotated stateful EJB3. The target SFSB is not a contextual object, * since it is obtained through JNDI, so CDI performs injections when the SFSB is created, * but there is no scope management. It follows that the target SFSB is not recreated * for the second invocation. */ @Test public void testSFSBApplicationScope() throws Exception { log.info("starting testSFSBApplicationScope()"); doTestSFSB("Application"); } private void doTestSFSB(String scope) throws Exception { final Hashtable jndiProperties = new Hashtable(); jndiProperties.put(Context.URL_PKG_PREFIXES, "org.jboss.ejb.client.naming"); final Context context = new InitialContext(jndiProperties); String className = "Stateful" + scope + "ScopedEJBwithJaxRsComponents"; Class viewName = Class.forName("org.jboss.resteasy.cdi.injection.reverse." + className + "Interface"); String lookup = "ejb:/resteasy-reverse-injection-test/" + className + "!" + viewName.getName() + "?stateful"; log.info("lookup: " + lookup); EJBInterface remote = EJBInterface.class.cast(context.lookup(lookup)); log.info("remote: " + remote); remote.setUp(NON_CONTEXTUAL); Assert.assertTrue(remote.test(NON_CONTEXTUAL)); } /** * Verifies the scopes of the EJBs used in this set of tests. */ @Test public void testEJBHolderInResourceScopes() throws Exception { log.info("starting testEJBHolderInResourceScopes()"); ClientRequest request = new ClientRequest("http://localhost:8080/resteasy-reverse-injection-test/rest/reverse/testScopes/"); ClientResponse response = request.post(); log.info("status: " + response.getStatus()); Assert.assertEquals(200, response.getStatus()); response.releaseConnection(); } @Test public void testEJBHolderInResource() throws Exception { log.info("starting testEJBHolderInResource()"); ClientRequest request = new ClientRequest("http://localhost:8080/resteasy-reverse-injection-test/rest/reverse/setup/"); ClientResponse response = request.post(); log.info("status: " + response.getStatus()); Assert.assertEquals(200, response.getStatus()); response.releaseConnection(); request = new ClientRequest("http://localhost:8080/resteasy-reverse-injection-test/rest/reverse/test/"); response = request.post(); log.info("status: " + response.getStatus()); Assert.assertEquals(200, response.getStatus()); response.releaseConnection(); } /** * Tests the injection of a JAX-RS resource (BookResource) into an MDB. */ @Test public void testMDB() throws Exception { log.info("starting testMDB()"); String destinationName = "queue/test"; Context ic = null; ConnectionFactory cf = null; Connection connection = null; try { ic = new InitialContext(); cf = (ConnectionFactory)ic.lookup("/ConnectionFactory"); Queue queue = (Queue)ic.lookup(destinationName); connection = cf.createConnection(); Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); MessageProducer producer = session.createProducer(queue); connection.start(); Book book1 = new Book("Dead Man Snoring"); TextMessage message = session.createTextMessage(book1.getName()); producer.send(message); log.info("Message sent to to the JMS Provider: " + book1.getName()); Book book2 = new Book("Dead Man Drooling"); message = session.createTextMessage(book2.getName()); producer.send(message); log.info("Message sent to to the JMS Provider: " + book2.getName()); ClientRequest request = new ClientRequest("http://localhost:8080/resteasy-reverse-injection-test/rest/mdb/books"); ClientResponse response = request.get(); log.info("status: " + response.getStatus()); Assert.assertEquals(200, response.getStatus()); @SuppressWarnings("unchecked") Collection books = response.getEntity(Collection.class, BookCollectionType); log.info("Collection: " + books); Assert.assertEquals(2, books.size()); Iterator it = books.iterator(); Book b1 = it.next(); Book b2 = it.next(); Assert.assertTrue(book1.equals(b1) && book2.equals(b2) || book1.equals(b2) && book2.equals(b1)); } catch (Exception exc) { exc.printStackTrace(); } finally { if (connection != null) { try { connection.close(); } catch (JMSException e) { e.printStackTrace(); } } } } } 000077500000000000000000000000001225215345600363705ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/test/java/org/jboss/resteasy/test/cdi/interceptorsInterceptorTest.java000066400000000000000000000136101225215345600423720ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/test/java/org/jboss/resteasy/test/cdi/interceptorspackage org.jboss.resteasy.test.cdi.interceptors; import static org.junit.Assert.assertEquals; import java.lang.reflect.Type; import java.util.logging.Logger; import javax.inject.Inject; import javax.swing.text.Utilities; import junit.framework.Assert; import org.jboss.arquillian.container.test.api.Deployment; import org.jboss.arquillian.junit.Arquillian; import org.jboss.resteasy.cdi.interceptors.Book; import org.jboss.resteasy.cdi.interceptors.BookReader; import org.jboss.resteasy.cdi.interceptors.BookReaderInterceptor; import org.jboss.resteasy.cdi.interceptors.BookReaderInterceptorInterceptor; import org.jboss.resteasy.cdi.interceptors.BookWriter; import org.jboss.resteasy.cdi.interceptors.BookWriterInterceptor; import org.jboss.resteasy.cdi.interceptors.BookWriterInterceptorInterceptor; import org.jboss.resteasy.cdi.interceptors.ClassBinding; import org.jboss.resteasy.cdi.interceptors.ClassInterceptorStereotype; import org.jboss.resteasy.cdi.interceptors.ClassMethodInterceptorStereotype; import org.jboss.resteasy.cdi.interceptors.FilterBinding; import org.jboss.resteasy.cdi.interceptors.LifecycleBinding; import org.jboss.resteasy.cdi.interceptors.PostConstructInterceptor; import org.jboss.resteasy.cdi.interceptors.PreDestroyInterceptor; import org.jboss.resteasy.cdi.interceptors.RequestFilterInterceptorBinding; import org.jboss.resteasy.cdi.interceptors.ResponseFilterInterceptorBinding; import org.jboss.resteasy.cdi.interceptors.Interceptor0; import org.jboss.resteasy.cdi.interceptors.Interceptor1; import org.jboss.resteasy.cdi.interceptors.Interceptor2; import org.jboss.resteasy.cdi.interceptors.Interceptor3; import org.jboss.resteasy.cdi.interceptors.InterceptorResource; import org.jboss.resteasy.cdi.interceptors.JaxRsActivator; import org.jboss.resteasy.cdi.interceptors.MethodBinding; import org.jboss.resteasy.cdi.interceptors.ReaderInterceptorBinding; import org.jboss.resteasy.cdi.interceptors.RequestFilterInterceptor; import org.jboss.resteasy.cdi.interceptors.ResponseFilterInterceptor; import org.jboss.resteasy.cdi.interceptors.Stereotyped; import org.jboss.resteasy.cdi.interceptors.TestRequestFilter; import org.jboss.resteasy.cdi.interceptors.TestResponseFilter; import org.jboss.resteasy.cdi.interceptors.VisitList; import org.jboss.resteasy.cdi.interceptors.WriterInterceptorBinding; import org.jboss.resteasy.cdi.util.Constants; import org.jboss.resteasy.cdi.util.UtilityProducer; import org.jboss.resteasy.client.ClientRequest; import org.jboss.resteasy.client.ClientResponse; import org.jboss.resteasy.util.GenericType; import org.jboss.shrinkwrap.api.Archive; import org.jboss.shrinkwrap.api.ShrinkWrap; import org.jboss.shrinkwrap.api.spec.WebArchive; import org.junit.Test; import org.junit.runner.RunWith; /** * This is a collection of tests addressed to the interactions of * Resteasy, CDI, EJB, and so forth in the context of a JEE Application Server. * * It tests the injection of a variety of beans into Resteasy objects. * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright May 8, 2012 */ @RunWith(Arquillian.class) public class InterceptorTest { @Inject Logger log; @Deployment public static Archive createTestArchive() { WebArchive war = ShrinkWrap.create(WebArchive.class, "resteasy-cdi-ejb-test.war") .addClasses(JaxRsActivator.class, Constants.class, UtilityProducer.class, Utilities.class, VisitList.class) .addClasses(InterceptorResource.class, Interceptor0.class, Interceptor1.class) .addClasses(ClassBinding.class, MethodBinding.class, Interceptor2.class, Interceptor3.class) .addClasses(FilterBinding.class, RequestFilterInterceptorBinding.class, ResponseFilterInterceptorBinding.class) .addClasses(RequestFilterInterceptor.class, ResponseFilterInterceptor.class, TestRequestFilter.class, TestResponseFilter.class) .addClasses(ReaderInterceptorBinding.class, WriterInterceptorBinding.class) .addClasses(Book.class, BookReader.class, BookWriter.class) .addClasses(BookReaderInterceptor.class, BookWriterInterceptor.class) .addClasses(BookReaderInterceptorInterceptor.class, BookWriterInterceptorInterceptor.class) .addClasses(ClassInterceptorStereotype.class, ClassMethodInterceptorStereotype.class, Stereotyped.class) .addClasses(LifecycleBinding.class, PostConstructInterceptor.class, PreDestroyInterceptor.class) .addAsWebInfResource("interceptors/interceptorBeans.xml", "beans.xml"); System.out.println(war.toString(true)); return war; } @Test public void testInterceptors() throws Exception { log.info("starting testInterceptors()"); // Create book. ClientRequest request = new ClientRequest("http://localhost:8080/resteasy-cdi-ejb-test/rest/create/"); Book book = new Book("RESTEasy: the Sequel"); Type genericType = (new GenericType() {}).getGenericType(); request.body(Constants.MEDIA_TYPE_TEST_XML_TYPE, book, genericType); ClientResponse response = request.post(); log.info("Status: " + response.getStatus()); assertEquals(200, response.getStatus()); int id = response.getEntity(int.class); log.info("id: " + id); Assert.assertEquals(0, id); // Retrieve book. request = new ClientRequest("http://localhost:8080/resteasy-cdi-ejb-test/rest/book/" + id); request.accept(Constants.MEDIA_TYPE_TEST_XML); response = request.get(); log.info("Status: " + response.getStatus()); assertEquals(200, response.getStatus()); Book result = response.getEntity(Book.class); log.info("book: " + book); Assert.assertEquals(book, result); request = new ClientRequest("http://localhost:8080/resteasy-cdi-ejb-test/rest/test/"); response = request.post(); log.info("Status: " + response.getStatus()); assertEquals(200, response.getStatus()); response.releaseConnection(); } } TimerInterceptorTest.java000066400000000000000000000046571225215345600434060ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/test/java/org/jboss/resteasy/test/cdi/interceptorspackage org.jboss.resteasy.test.cdi.interceptors; import static org.junit.Assert.assertEquals; import java.util.logging.Logger; import javax.inject.Inject; import org.jboss.arquillian.container.test.api.Deployment; import org.jboss.arquillian.junit.Arquillian; import org.jboss.resteasy.cdi.interceptors.JaxRsActivator; import org.jboss.resteasy.cdi.interceptors.TimerInterceptorResource; import org.jboss.resteasy.cdi.interceptors.TimerInterceptorResourceIntf; import org.jboss.resteasy.cdi.util.UtilityProducer; import org.jboss.resteasy.client.ClientRequest; import org.jboss.resteasy.client.ClientResponse; import org.jboss.shrinkwrap.api.Archive; import org.jboss.shrinkwrap.api.ShrinkWrap; import org.jboss.shrinkwrap.api.asset.EmptyAsset; import org.jboss.shrinkwrap.api.spec.WebArchive; import org.junit.Test; import org.junit.runner.RunWith; /** * This is a collection of tests addressed to the interactions of * Resteasy, CDI, EJB, and so forth in the context of a JEE Application Server. * * It tests the injection of a variety of beans into Resteasy objects. * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright May 8, 2012 */ @RunWith(Arquillian.class) public class TimerInterceptorTest { @Inject Logger log; @Deployment public static Archive createTestArchive() { WebArchive war = ShrinkWrap.create(WebArchive.class, "resteasy-cdi-ejb-test.war") .addClasses(JaxRsActivator.class, UtilityProducer.class) .addClasses(TimerInterceptorResourceIntf.class, TimerInterceptorResource.class) .addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml"); System.out.println(war.toString(true)); return war; } @Test public void testTimerInterceptor() throws Exception { log.info("starting testTimerInterceptor()"); // Schedule timer. ClientRequest request = new ClientRequest("http://localhost:8080/resteasy-cdi-ejb-test/rest/timer/schedule"); ClientResponse response = request.get(); log.info("Status: " + response.getStatus()); assertEquals(200, response.getStatus()); // Verify timer expired and timer interceptor was executed. request = new ClientRequest("http://localhost:8080/resteasy-cdi-ejb-test/rest/timer/test"); response = request.get(); log.info("Status: " + response.getStatus()); assertEquals(200, response.getStatus()); response.releaseConnection(); } } 000077500000000000000000000000001225215345600353175ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/test/java/org/jboss/resteasy/test/cdi/modulesEarLibIntoEarLibTest_Save.java000066400000000000000000000050331225215345600430500ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/test/java/org/jboss/resteasy/test/cdi/modulespackage org.jboss.resteasy.test.cdi.modules; import static org.junit.Assert.assertEquals; import java.util.logging.Logger; import javax.inject.Inject; import org.jboss.arquillian.container.test.api.Deployment; import org.jboss.arquillian.junit.Arquillian; import org.jboss.resteasy.cdi.modules.Injectable; import org.jboss.resteasy.cdi.modules.InjectableBinder; import org.jboss.resteasy.cdi.modules.InjectableIntf; import org.jboss.resteasy.cdi.modules.JaxRsActivator; import org.jboss.resteasy.cdi.modules.ModulesResource; import org.jboss.resteasy.cdi.modules.ModulesResourceIntf; import org.jboss.resteasy.cdi.util.UtilityProducer; import org.jboss.resteasy.client.ClientRequest; import org.jboss.resteasy.client.ClientResponse; import org.jboss.shrinkwrap.api.Archive; import org.jboss.shrinkwrap.api.ShrinkWrap; import org.jboss.shrinkwrap.api.asset.EmptyAsset; import org.jboss.shrinkwrap.api.spec.EnterpriseArchive; import org.jboss.shrinkwrap.api.spec.JavaArchive; import org.junit.Test; import org.junit.runner.RunWith; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright Dec 18, 2012 */ @RunWith(Arquillian.class) public class EarLibIntoEarLibTest_Save { @Inject Logger log; @Deployment public static Archive createTestArchive() { JavaArchive fromJar = ShrinkWrap.create(JavaArchive.class, "from.jar") .addClasses(InjectableBinder.class, InjectableIntf.class, Injectable.class) .add(EmptyAsset.INSTANCE, "META-INF/beans.xml"); JavaArchive toJar = ShrinkWrap.create(JavaArchive.class, "to.jar") .addClasses(EarLibIntoEarLibTest_Save.class, JaxRsActivator.class, UtilityProducer.class) .addClasses(ModulesResourceIntf.class, ModulesResource.class) .add(EmptyAsset.INSTANCE, "META-INF/beans.xml"); EnterpriseArchive ear = ShrinkWrap.create(EnterpriseArchive.class, "test.ear") .addAsLibrary(fromJar) .addAsLibrary(toJar); System.out.println(fromJar.toString(true)); System.out.println(toJar.toString(true)); System.out.println(ear.toString(true)); return ear; } @Test public void testModules() throws Exception { log.info("starting testModules()"); ClientRequest request = new ClientRequest("http://localhost:8080/resteasy-cdi-ejb-test/rest/modules/test/"); ClientResponse response = request.get(); log.info("Status: " + response.getStatus()); assertEquals(200, response.getStatus()); response.releaseConnection(); } } EarLibIntoWarLibTest.java000066400000000000000000000054521225215345600421210ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/test/java/org/jboss/resteasy/test/cdi/modulespackage org.jboss.resteasy.test.cdi.modules; import static org.junit.Assert.assertEquals; import java.util.logging.Logger; import javax.inject.Inject; import org.jboss.arquillian.container.test.api.Deployment; import org.jboss.arquillian.junit.Arquillian; import org.jboss.resteasy.cdi.modules.Injectable; import org.jboss.resteasy.cdi.modules.InjectableBinder; import org.jboss.resteasy.cdi.modules.InjectableIntf; import org.jboss.resteasy.cdi.modules.JaxRsActivator; import org.jboss.resteasy.cdi.modules.ModulesResource; import org.jboss.resteasy.cdi.modules.ModulesResourceIntf; import org.jboss.resteasy.cdi.util.UtilityProducer; import org.jboss.resteasy.client.ClientRequest; import org.jboss.resteasy.client.ClientResponse; import org.jboss.shrinkwrap.api.Archive; import org.jboss.shrinkwrap.api.ShrinkWrap; import org.jboss.shrinkwrap.api.asset.EmptyAsset; import org.jboss.shrinkwrap.api.spec.EnterpriseArchive; import org.jboss.shrinkwrap.api.spec.JavaArchive; import org.jboss.shrinkwrap.api.spec.WebArchive; import org.junit.Test; import org.junit.runner.RunWith; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright Dec 18, 2012 */ @RunWith(Arquillian.class) public class EarLibIntoWarLibTest { @Inject Logger log; @Deployment public static Archive createTestArchive() { JavaArchive fromJar = ShrinkWrap.create(JavaArchive.class, "from.jar") .addClasses(InjectableBinder.class, InjectableIntf.class, Injectable.class) .add(EmptyAsset.INSTANCE, "META-INF/beans.xml"); JavaArchive toJar = ShrinkWrap.create(JavaArchive.class, "to.jar") .addClasses(EarLibIntoWarLibTest.class, JaxRsActivator.class, UtilityProducer.class) .addClasses(ModulesResourceIntf.class, ModulesResource.class) .add(EmptyAsset.INSTANCE, "META-INF/beans.xml"); WebArchive war = ShrinkWrap.create(WebArchive.class, "resteasy-cdi-ejb-test.war") .addAsLibrary(toJar) .addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml"); EnterpriseArchive ear = ShrinkWrap.create(EnterpriseArchive.class, "test.ear") .addAsLibrary(fromJar) .addAsModule(war); System.out.println(fromJar.toString(true)); System.out.println(toJar.toString(true)); System.out.println(war.toString(true)); System.out.println(ear.toString(true)); return ear; } @Test public void testModules() throws Exception { log.info("starting testModules()"); ClientRequest request = new ClientRequest("http://localhost:8080/resteasy-cdi-ejb-test/rest/modules/test/"); ClientResponse response = request.get(); log.info("Status: " + response.getStatus()); assertEquals(200, response.getStatus()); response.releaseConnection(); } } EjbjarLibIntoWarLibTest.java000066400000000000000000000057721225215345600426140ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/test/java/org/jboss/resteasy/test/cdi/modulespackage org.jboss.resteasy.test.cdi.modules; import static org.junit.Assert.assertEquals; import java.io.File; import java.util.logging.Logger; import javax.inject.Inject; import org.jboss.arquillian.container.test.api.Deployment; import org.jboss.arquillian.junit.Arquillian; import org.jboss.resteasy.cdi.modules.Injectable; import org.jboss.resteasy.cdi.modules.InjectableBinder; import org.jboss.resteasy.cdi.modules.InjectableIntf; import org.jboss.resteasy.cdi.modules.JaxRsActivator; import org.jboss.resteasy.cdi.modules.ModulesResource; import org.jboss.resteasy.cdi.modules.ModulesResourceIntf; import org.jboss.resteasy.cdi.util.UtilityProducer; import org.jboss.resteasy.client.ClientRequest; import org.jboss.resteasy.client.ClientResponse; import org.jboss.shrinkwrap.api.Archive; import org.jboss.shrinkwrap.api.ShrinkWrap; import org.jboss.shrinkwrap.api.asset.EmptyAsset; import org.jboss.shrinkwrap.api.asset.FileAsset; import org.jboss.shrinkwrap.api.spec.EnterpriseArchive; import org.jboss.shrinkwrap.api.spec.JavaArchive; import org.jboss.shrinkwrap.api.spec.WebArchive; import org.junit.Test; import org.junit.runner.RunWith; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright Dec 18, 2012 */ @RunWith(Arquillian.class) public class EjbjarLibIntoWarLibTest { @Inject Logger log; @Deployment public static Archive createTestArchive() { JavaArchive fromJar = ShrinkWrap.create(JavaArchive.class, "ejb-jar.jar") .addClasses(InjectableBinder.class, InjectableIntf.class, Injectable.class) .add(new FileAsset(new File("src/test/resources/modules/ejb-jar.xml")), "META-INF/ejb-jar.xml") .add(EmptyAsset.INSTANCE, "META-INF/beans.xml"); JavaArchive toJar = ShrinkWrap.create(JavaArchive.class, "to.jar") .addClasses(EjbjarLibIntoWarLibTest.class, JaxRsActivator.class, UtilityProducer.class) .addClasses(ModulesResourceIntf.class, ModulesResource.class) .add(EmptyAsset.INSTANCE, "META-INF/beans.xml"); WebArchive war = ShrinkWrap.create(WebArchive.class, "resteasy-cdi-ejb-test.war") .addAsLibrary(toJar) .addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml"); EnterpriseArchive ear = ShrinkWrap.create(EnterpriseArchive.class, "test.ear") .addAsLibrary(fromJar) .addAsModule(war); System.out.println(fromJar.toString(true)); System.out.println(toJar.toString(true)); System.out.println(war.toString(true)); System.out.println(ear.toString(true)); return ear; } /** */ @Test public void testModules() throws Exception { log.info("starting testModules()"); ClientRequest request = new ClientRequest("http://localhost:8080/resteasy-cdi-ejb-test/rest/modules/test/"); ClientResponse response = request.get(); log.info("Status: " + response.getStatus()); assertEquals(200, response.getStatus()); response.releaseConnection(); } } WarClassesIntoWarLibTest.java000066400000000000000000000045431225215345600430320ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/test/java/org/jboss/resteasy/test/cdi/modulespackage org.jboss.resteasy.test.cdi.modules; import static org.junit.Assert.assertEquals; import java.util.logging.Logger; import javax.inject.Inject; import org.jboss.arquillian.container.test.api.Deployment; import org.jboss.arquillian.junit.Arquillian; import org.jboss.resteasy.cdi.modules.Injectable; import org.jboss.resteasy.cdi.modules.InjectableBinder; import org.jboss.resteasy.cdi.modules.InjectableIntf; import org.jboss.resteasy.cdi.modules.JaxRsActivator; import org.jboss.resteasy.cdi.modules.ModulesResource; import org.jboss.resteasy.cdi.modules.ModulesResourceIntf; import org.jboss.resteasy.cdi.util.UtilityProducer; import org.jboss.resteasy.client.ClientRequest; import org.jboss.resteasy.client.ClientResponse; import org.jboss.shrinkwrap.api.Archive; import org.jboss.shrinkwrap.api.ShrinkWrap; import org.jboss.shrinkwrap.api.asset.EmptyAsset; import org.jboss.shrinkwrap.api.spec.JavaArchive; import org.jboss.shrinkwrap.api.spec.WebArchive; import org.junit.Test; import org.junit.runner.RunWith; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright Dec 18, 2012 */ @RunWith(Arquillian.class) public class WarClassesIntoWarLibTest { @Inject Logger log; @Deployment public static Archive createTestArchive() { JavaArchive jar = ShrinkWrap.create(JavaArchive.class, "test.jar") .addClasses(ModulesResourceIntf.class, ModulesResource.class) .add(EmptyAsset.INSTANCE, "META-INF/beans.xml"); WebArchive war = ShrinkWrap.create(WebArchive.class, "resteasy-cdi-ejb-test.war") .addClasses(JaxRsActivator.class, UtilityProducer.class) .addClasses(InjectableBinder.class, InjectableIntf.class, Injectable.class) .addAsLibrary(jar) .addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml"); System.out.println(jar.toString(true)); System.out.println(war.toString(true)); return war; } /** */ @Test public void testModules() throws Exception { log.info("starting testModules()"); ClientRequest request = new ClientRequest("http://localhost:8080/resteasy-cdi-ejb-test/rest/modules/test/"); ClientResponse response = request.get(); log.info("Status: " + response.getStatus()); assertEquals(200, response.getStatus()); response.releaseConnection(); } } WarLibIntoWarClassesTest.java000066400000000000000000000045431225215345600430320ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/test/java/org/jboss/resteasy/test/cdi/modulespackage org.jboss.resteasy.test.cdi.modules; import static org.junit.Assert.assertEquals; import java.util.logging.Logger; import javax.inject.Inject; import org.jboss.arquillian.container.test.api.Deployment; import org.jboss.arquillian.junit.Arquillian; import org.jboss.resteasy.cdi.modules.Injectable; import org.jboss.resteasy.cdi.modules.InjectableBinder; import org.jboss.resteasy.cdi.modules.InjectableIntf; import org.jboss.resteasy.cdi.modules.JaxRsActivator; import org.jboss.resteasy.cdi.modules.ModulesResource; import org.jboss.resteasy.cdi.modules.ModulesResourceIntf; import org.jboss.resteasy.cdi.util.UtilityProducer; import org.jboss.resteasy.client.ClientRequest; import org.jboss.resteasy.client.ClientResponse; import org.jboss.shrinkwrap.api.Archive; import org.jboss.shrinkwrap.api.ShrinkWrap; import org.jboss.shrinkwrap.api.asset.EmptyAsset; import org.jboss.shrinkwrap.api.spec.JavaArchive; import org.jboss.shrinkwrap.api.spec.WebArchive; import org.junit.Test; import org.junit.runner.RunWith; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright Dec 18, 2012 */ @RunWith(Arquillian.class) public class WarLibIntoWarClassesTest { @Inject Logger log; @Deployment public static Archive createTestArchive() { JavaArchive jar = ShrinkWrap.create(JavaArchive.class, "test.jar") .addClasses(InjectableBinder.class, InjectableIntf.class, Injectable.class) .add(EmptyAsset.INSTANCE, "META-INF/beans.xml"); WebArchive war = ShrinkWrap.create(WebArchive.class, "resteasy-cdi-ejb-test.war") .addClasses(JaxRsActivator.class, UtilityProducer.class) .addClasses(ModulesResourceIntf.class, ModulesResource.class) .addAsLibrary(jar) .addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml"); System.out.println(jar.toString(true)); System.out.println(war.toString(true)); return war; } /** */ @Test public void testModules() throws Exception { log.info("starting testModules()"); ClientRequest request = new ClientRequest("http://localhost:8080/resteasy-cdi-ejb-test/rest/modules/test/"); ClientResponse response = request.get(); log.info("Status: " + response.getStatus()); assertEquals(200, response.getStatus()); response.releaseConnection(); } } 000077500000000000000000000000001225215345600360015ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/test/java/org/jboss/resteasy/test/cdi/validationValidationTest.java000066400000000000000000000126671225215345600416120ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/test/java/org/jboss/resteasy/test/cdi/validationpackage org.jboss.resteasy.test.cdi.validation; import java.util.List; import java.util.logging.Logger; import javax.inject.Inject; import junit.framework.Assert; import org.jboss.arquillian.container.test.api.Deployment; import org.jboss.arquillian.junit.Arquillian; import org.jboss.resteasy.cdi.util.UtilityProducer; import org.jboss.resteasy.cdi.validation.ErroneousResource; import org.jboss.resteasy.cdi.validation.ErroneousResourceImpl; import org.jboss.resteasy.cdi.validation.ErrorFreeResource; import org.jboss.resteasy.cdi.validation.ErrorFreeResourceImpl; import org.jboss.resteasy.cdi.validation.IntegerProducer; import org.jboss.resteasy.cdi.validation.JaxRsActivator; import org.jboss.resteasy.cdi.validation.NumberOneBinding; import org.jboss.resteasy.cdi.validation.NumberOneErrorBinding; import org.jboss.resteasy.cdi.validation.NumberTwoBinding; import org.jboss.resteasy.cdi.validation.ResourceParent; import org.jboss.resteasy.cdi.validation.SumConstraint; import org.jboss.resteasy.cdi.validation.SumValidator; import org.jboss.resteasy.client.ClientRequest; import org.jboss.resteasy.client.ClientResponse; import org.jboss.shrinkwrap.api.Archive; import org.jboss.shrinkwrap.api.ShrinkWrap; import org.jboss.shrinkwrap.api.asset.EmptyAsset; import org.jboss.shrinkwrap.api.spec.WebArchive; import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; /** * * @author Ron Sigal * @version $Revision: 1.1 $ * * Copyright Dec 25, 2012 */ @RunWith(Arquillian.class) public class ValidationTest { @Inject Logger log; @Deployment public static Archive createTestArchive() { WebArchive war = ShrinkWrap.create(WebArchive.class, "resteasy-cdi-ejb-test.war") .addClasses(JaxRsActivator.class, UtilityProducer.class, IntegerProducer.class) .addClasses(NumberOneBinding.class, NumberOneErrorBinding.class, NumberTwoBinding.class) .addClasses(SumConstraint.class, SumValidator.class) .addClasses(ResourceParent.class) .addClasses(ErrorFreeResource.class, ErrorFreeResourceImpl.class) .addClasses(ErroneousResource.class, ErroneousResourceImpl.class) .addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml"); System.out.println(war.toString(true)); return war; } @Ignore @Test public void testCorrectValues() throws Exception { log.info("starting testCorrectValues()"); ClientRequest request = new ClientRequest("http://localhost:8080/resteasy-cdi-ejb-test/rest/correct/test/7"); ClientResponse response = request.get(); log.info("status: " + response.getStatus()); log.info("response: " + response.getEntity(Integer.class)); Assert.assertEquals(200, response.getStatus()); Assert.assertTrue(8 == response.getEntity(Integer.class)); response.releaseConnection(); } @Ignore @SuppressWarnings("unchecked") @Test public void testIncorrectInputValues() throws Exception { log.info("starting testIncorrectInputValues()"); ClientRequest request = new ClientRequest("http://localhost:8080/resteasy-cdi-ejb-test/rest/incorrect/test/17"); ClientResponse response = request.get(); log.info("status: " + response.getStatus()); List> violations = response.getEntity(List.class); log.info("result: " + violations); Assert.assertEquals(400, response.getStatus()); List fieldViolations = violations.get(0); Assert.assertEquals(0, fieldViolations.size()); List propertyViolations = violations.get(1); Assert.assertEquals(1, propertyViolations.size()); Assert.assertTrue(propertyViolations.get(0).indexOf("numberTwo") > -1); List classViolations = violations.get(2); Assert.assertEquals(1, classViolations.size()); Assert.assertTrue(classViolations.get(0).indexOf("SumConstraint") > -1); List parameterViolations = violations.get(3); Assert.assertEquals(1, parameterViolations.size()); Assert.assertTrue(parameterViolations.get(0).indexOf("ErroneousResource#test(arg0)") > -1); List returnValueViolations = violations.get(4); Assert.assertEquals(0, returnValueViolations.size()); } @Ignore @SuppressWarnings("unchecked") @Test public void testIncorrectReturnValue() throws Exception { log.info("starting testIncorrectReturnValue()"); ClientRequest request = new ClientRequest("http://localhost:8080/resteasy-cdi-ejb-test/rest/correct/test/10"); ClientResponse response = request.get(); log.info("status: " + response.getStatus()); List> violations = response.getEntity(List.class); log.info("result: " + violations); Assert.assertEquals(500, response.getStatus()); List fieldViolations = violations.get(0); Assert.assertEquals(0, fieldViolations.size()); List propertyViolations = violations.get(1); Assert.assertEquals(0, propertyViolations.size()); List classViolations = violations.get(2); Assert.assertEquals(0, classViolations.size()); List parameterViolations = violations.get(3); Assert.assertEquals(0, parameterViolations.size()); List returnValueViolations = violations.get(4); Assert.assertEquals(1, returnValueViolations.size()); Assert.assertTrue(returnValueViolations.get(0).indexOf("return value") > -1); } } 000077500000000000000000000000001225215345600352705ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/test/java/org/jboss/resteasy/test/experimentInterfaceTypeExperiment.java000066400000000000000000000007701225215345600427420ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/test/java/org/jboss/resteasy/test/experimentpackage org.jboss.resteasy.test.experiment; import org.jboss.resteasy.util.Types; import org.junit.Test; public class InterfaceTypeExperiment { class C {} interface I {} interface J extends I {} class D implements J {} class E implements I {} @Test public void testType() throws Exception { System.out.println(Types.getTemplateParameterOfInterface(D.class, J.class)); System.out.println(Types.getTemplateParameterOfInterface(E.class, I.class)); } } Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/test/resources/000077500000000000000000000000001225215345600275335ustar00rootroot00000000000000application-roles.properties000066400000000000000000000012071225215345600352170ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/test/resources# # Properties declaration of users roles for the realm 'ApplicationRealm'. # # This includes the following protocols: remote ejb, remote jndi, web, remote jms # # Users can be added to this properties file at any time, updates after the server has started # will be automatically detected. # # The format of this file is as follows: - # username=role1,role2,role3 # # A utility script is provided which can be executed from the bin folder to add the users: - # - Linux # bin/add-user.sh # # - Windows # bin\add-user.bat # # The following illustrates how an admin user could be defined. # #admin=PowerUser,BillingAdmin, #guest=guest guest=guest application-users.properties000066400000000000000000000015241225215345600352360ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/test/resources# # Properties declaration of users for the realm 'ApplicationRealm' which is the default realm # for application services on a new AS 7.1 installation. # # This includes the following protocols: remote ejb, remote jndi, web, remote jms # # Users can be added to this properties file at any time, updates after the server has started # will be automatically detected. # # The format of this realm is as follows: - # username=HEX( MD5( username ':' realm ':' password)) # # A utility script is provided which can be executed from the bin folder to add the users: - # - Linux # bin/add-user.sh # # - Windows # bin\add-user.bat # # The following illustrates how an admin user could be defined, this # is for illustration only and does not correspond to a usable password. # #admin=2a0923285184943425d1f53ddd58ec7a guest=d1156ab4a42115ea2fa0a46e2e5cb165 Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/test/resources/arquillian.xml000066400000000000000000000046721225215345600324270ustar00rootroot00000000000000 target/deployments target/jboss-as-7.1.1.Final.cdi-ejb standalone-full.xml Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/test/resources/decorators/000077500000000000000000000000001225215345600317005ustar00rootroot00000000000000decoratorBeans.xml000066400000000000000000000015751225215345600353060ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/test/resources/decorators org.jboss.resteasy.cdi.decorators.ResourceInterceptor org.jboss.resteasy.cdi.decorators.RequestFilterDecorator org.jboss.resteasy.cdi.decorators.ResponseFilterDecorator org.jboss.resteasy.cdi.decorators.BookReaderInterceptorDecorator org.jboss.resteasy.cdi.decorators.BookReaderDecorator org.jboss.resteasy.cdi.decorators.BookWriterInterceptorDecorator org.jboss.resteasy.cdi.decorators.BookWriterDecorator org.jboss.resteasy.cdi.decorators.ResourceDecorator Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/test/resources/ejb/000077500000000000000000000000001225215345600302735ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/test/resources/ejb/ejbtest_web.xml000066400000000000000000000021201225215345600333050ustar00rootroot00000000000000 Archetype Created Web Application resteasy.jndi.resources global/resteasy-ejb-test/EJBBookResource!org.jboss.resteasy.cdi.ejb.EJBLocalResource Resteasy org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher javax.ws.rs.Application org.jboss.resteasy.cdi.ejb.EJBApplication Resteasy /* Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/test/resources/generic/000077500000000000000000000000001225215345600311475ustar00rootroot00000000000000concrete_beans.xml000066400000000000000000000004741225215345600345710ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/test/resources/generic org.jboss.resteasy.cdi.generic.ConcreteDecorator lower_bound_beans.xml000066400000000000000000000004761225215345600353100ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/test/resources/generic org.jboss.resteasy.cdi.generic.LowerBoundDecorator upper_bound_beans.xml000066400000000000000000000004761225215345600353130ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/test/resources/generic org.jboss.resteasy.cdi.generic.UpperBoundDecorator Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/test/resources/inheritence/000077500000000000000000000000001225215345600320305ustar00rootroot00000000000000alternativeSelectedBeans.xml000066400000000000000000000007751225215345600374440ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/test/resources/inheritence org.jboss.resteasy.cdi.inheritence.StereotypeAlternative alternativeVanillaBeans.xml000066400000000000000000000006501225215345600372720ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/test/resources/inheritence org.jboss.resteasy.cdi.inheritence.StereotypeAlternative specializedBeans.xml000066400000000000000000000007751225215345600357510ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/test/resources/inheritence org.jboss.resteasy.cdi.inheritence.StereotypeAlternative Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/test/resources/injection/000077500000000000000000000000001225215345600315155ustar00rootroot00000000000000persistence.xml000066400000000000000000000016761225215345600345160ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/test/resources/injection java:jboss/datasources/ExampleDS java:jboss/datasources/ExampleDS Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/test/resources/interceptors/000077500000000000000000000000001225215345600322545ustar00rootroot00000000000000interceptorBeans.xml000066400000000000000000000016061225215345600362310ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/test/resources/interceptors org.jboss.resteasy.cdi.interceptors.RequestFilterInterceptor org.jboss.resteasy.cdi.interceptors.ResponseFilterInterceptor org.jboss.resteasy.cdi.interceptors.Interceptor2 org.jboss.resteasy.cdi.interceptors.Interceptor3 org.jboss.resteasy.cdi.interceptors.BookReaderInterceptorInterceptor org.jboss.resteasy.cdi.interceptors.BookWriterInterceptorInterceptor org.jboss.resteasy.cdi.interceptors.PostConstructInterceptor org.jboss.resteasy.cdi.interceptors.PreDestroyInterceptor Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/test/resources/modules/000077500000000000000000000000001225215345600312035ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/test/resources/modules/ejb-jar.xml000066400000000000000000000011501225215345600332340ustar00rootroot00000000000000 MEJB JAR Injectable Injectable org.jboss.resteasy.cdi.modules.Injectable Stateless Container Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/test/resources/reverseInjection/000077500000000000000000000000001225215345600330515ustar00rootroot00000000000000hornetq_manifest.mf000066400000000000000000000000311225215345600366560ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/arquillian/resteasy-cdi-ejb-test/src/test/resources/reverseInjectionDependencies: org.hornetqResteasy-3.0.6.Final/jaxrs/as7-integration-testing/000077500000000000000000000000001225215345600221715ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/as7-integration-testing/cdi-test/000077500000000000000000000000001225215345600237055ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/as7-integration-testing/cdi-test/pom.xml000077500000000000000000000065761225215345600252430ustar00rootroot00000000000000 org.jboss.resteasy resteasy-jaxrs-all 3.0.6.Final ../../pom.xml 4.0.0 org.jboss.resteasy.test as7-cdi-test war as7-cdi-test http://maven.apache.org junit junit javax.enterprise cdi-api 1.0 provided org.jboss.resteasy resteasy-jaxrs ${project.version} provided cdi-test org.jboss.as.plugins jboss-as-maven-plugin 7.4.Final jboss-deploy pre-integration-test deploy jboss-undeploy post-integration-test undeploy org.apache.maven.plugins maven-surefire-plugin true surefire-it integration-test test false org.apache.maven.plugins maven-deploy-plugin true org.apache.maven.plugins maven-compiler-plugin 1.6 1.6 Resteasy-3.0.6.Final/jaxrs/as7-integration-testing/cdi-test/src/000077500000000000000000000000001225215345600244745ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/as7-integration-testing/cdi-test/src/main/000077500000000000000000000000001225215345600254205ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/as7-integration-testing/cdi-test/src/main/java/000077500000000000000000000000001225215345600263415ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/as7-integration-testing/cdi-test/src/main/java/org/000077500000000000000000000000001225215345600271305ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/as7-integration-testing/cdi-test/src/main/java/org/jboss/000077500000000000000000000000001225215345600302505ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/as7-integration-testing/cdi-test/src/main/java/org/jboss/resteasy/000077500000000000000000000000001225215345600321075ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/as7-integration-testing/cdi-test/src/main/java/org/jboss/resteasy/tests/000077500000000000000000000000001225215345600332515ustar00rootroot00000000000000DummyApp.java000066400000000000000000000005471225215345600355770ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/as7-integration-testing/cdi-test/src/main/java/org/jboss/resteasy/testspackage org.jboss.resteasy.tests; import javax.ws.rs.ApplicationPath; import javax.ws.rs.core.Application; /** * Test that you can have more than one Application class. This should be ignored. * * @author Bill Burke * @version $Revision: 1 $ */ public class DummyApp // extends Application { } MyApplication.java000066400000000000000000000004371225215345600366120ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/as7-integration-testing/cdi-test/src/main/java/org/jboss/resteasy/testspackage org.jboss.resteasy.tests; import javax.ws.rs.ApplicationPath; import javax.ws.rs.core.Application; /** * @author Bill Burke * @version $Revision: 1 $ */ @ApplicationPath("/jaxrs") public class MyApplication extends Application { } MyAsyncResource.java000066400000000000000000000033141225215345600371310ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/as7-integration-testing/cdi-test/src/main/java/org/jboss/resteasy/testspackage org.jboss.resteasy.tests; import org.jboss.resteasy.annotations.Suspend; import org.jboss.resteasy.spi.AsynchronousResponse; import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.Produces; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; /** * @author Bill Burke * @version $Revision: 1 $ */ @Path("/async") public class MyAsyncResource { @GET @Produces("text/plain") public void get(final @Suspend(2000) AsynchronousResponse response) { Thread t = new Thread() { @Override public void run() { try { System.out.println("STARTED Regular!!!!"); Thread.sleep(100); Response jaxrs = Response.ok("hello").type(MediaType.TEXT_PLAIN).build(); response.setResponse(jaxrs); } catch (Exception e) { e.printStackTrace(); } } }; t.start(); } @GET @Path("timeout") @Produces("text/plain") public void timeout(final @Suspend(10) AsynchronousResponse response) { System.out.println("**** TIMEOUT CALLED ****"); Thread t = new Thread() { @Override public void run() { try { System.out.println("STARTED Timeout!!!!"); Thread.sleep(100000); Response jaxrs = Response.ok("goodbye").type(MediaType.TEXT_PLAIN).build(); response.setResponse(jaxrs); } catch (Exception e) { e.printStackTrace(); } } }; t.start(); } }MyConfigBean.java000066400000000000000000000003361225215345600363400ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/as7-integration-testing/cdi-test/src/main/java/org/jboss/resteasy/testspackage org.jboss.resteasy.tests; /** * @author Bill Burke * @version $Revision: 1 $ */ public class MyConfigBean { public String version() { return "1.1"; } } MyService.java000066400000000000000000000013501225215345600357420ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/as7-integration-testing/cdi-test/src/main/java/org/jboss/resteasy/testspackage org.jboss.resteasy.tests; import javax.inject.Inject; import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.Produces; /** * @author Bill Burke * @version $Revision: 1 $ */ @Path("/") public class MyService { @Inject MyConfigBean bean; /** * Tests to make sure that a CDI bean was injected and that the XFormat provider overrides the default XML provider * * @return */ @GET @Produces("application/xml") public XFormat get() { if (bean != null) System.out.println("MyConfigBean version: " + bean.version()); else throw new RuntimeException("CDI Bean Injection didn't work for test!"); return new XFormat("foo"); } } XFormat.java000066400000000000000000000014471225215345600354230ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/as7-integration-testing/cdi-test/src/main/java/org/jboss/resteasy/testspackage org.jboss.resteasy.tests; import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlRootElement; /** * @author Bill Burke * @version $Revision: 1 $ */ @XmlRootElement(name = "xformat") public class XFormat { protected String id; protected String bean; public XFormat() { } public XFormat(String id) { this.id = id; } public XFormat(String id, String bean) { this.id = id; this.bean = bean; } @XmlAttribute public String getId() { return id; } public void setId(String id) { this.id = id; } @XmlAttribute public String getBean() { return bean; } public void setBean(String bean) { this.bean = bean; } } XFormatProvider.java000066400000000000000000000054521225215345600371360ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/as7-integration-testing/cdi-test/src/main/java/org/jboss/resteasy/testspackage org.jboss.resteasy.tests; import org.jboss.resteasy.util.ReadFromStream; import javax.inject.Inject; import javax.ws.rs.Consumes; import javax.ws.rs.Produces; import javax.ws.rs.WebApplicationException; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.MultivaluedMap; import javax.ws.rs.ext.MessageBodyReader; import javax.ws.rs.ext.MessageBodyWriter; import javax.ws.rs.ext.Provider; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.lang.annotation.Annotation; import java.lang.reflect.Type; /** * Tests to make sure that a CDI bean was injected and that this provider overrides the default XML provider * * @author Bill Burke * @version $Revision: 1 $ */ @Provider //@Produces("application/x-format") //@Consumes("application/x-format") @Produces("application/xml") @Consumes("application/xml") public class XFormatProvider implements MessageBodyReader, MessageBodyWriter { @Inject MyConfigBean bean; @Override public boolean isReadable(Class type, Type genericType, Annotation[] annotations, MediaType mediaType) { return XFormat.class.isAssignableFrom(type); } @Override public XFormat readFrom(Class type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap httpHeaders, InputStream entityStream) throws IOException, WebApplicationException { System.out.println("********** readFrom ********"); if (bean != null) { System.out.println("XFormatProvider: MyConfigBean version: " + bean.version()); } byte[] bytes = ReadFromStream.readFromStream(1024, entityStream); String val = new String(bytes); String[] split = val.split(" "); return new XFormat(split[0], split[1]); } @Override public boolean isWriteable(Class type, Type genericType, Annotation[] annotations, MediaType mediaType) { return XFormat.class.isAssignableFrom(type); } @Override public long getSize(XFormat xFormat, Class type, Type genericType, Annotation[] annotations, MediaType mediaType) { return -1; } @Override public void writeTo(XFormat xFormat, Class type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap httpHeaders, OutputStream entityStream) throws IOException, WebApplicationException { System.out.println("********** writeTo ********"); String message = ""; if (bean != null) { System.out.println("XFormatProvider: MyConfigBean version: " + bean.version()); message += xFormat.getId() + " " + bean.version(); } else { message += xFormat.getId() + " 0"; } entityStream.write(message.getBytes()); } } Resteasy-3.0.6.Final/jaxrs/as7-integration-testing/cdi-test/src/main/webapp/000077500000000000000000000000001225215345600266765ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/as7-integration-testing/cdi-test/src/main/webapp/WEB-INF/000077500000000000000000000000001225215345600277255ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/as7-integration-testing/cdi-test/src/main/webapp/WEB-INF/beans.xml000066400000000000000000000003761225215345600315450ustar00rootroot00000000000000 Resteasy-3.0.6.Final/jaxrs/as7-integration-testing/cdi-test/src/main/webapp/WEB-INF/web.xml000066400000000000000000000004451225215345600312270ustar00rootroot00000000000000 Resteasy-3.0.6.Final/jaxrs/as7-integration-testing/cdi-test/src/test/000077500000000000000000000000001225215345600254535ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/as7-integration-testing/cdi-test/src/test/java/000077500000000000000000000000001225215345600263745ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/as7-integration-testing/cdi-test/src/test/java/org/000077500000000000000000000000001225215345600271635ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/as7-integration-testing/cdi-test/src/test/java/org/jboss/000077500000000000000000000000001225215345600303035ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/as7-integration-testing/cdi-test/src/test/java/org/jboss/resteasy/000077500000000000000000000000001225215345600321425ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/as7-integration-testing/cdi-test/src/test/java/org/jboss/resteasy/tests/000077500000000000000000000000001225215345600333045ustar00rootroot00000000000000AsyncTest.java000066400000000000000000000016471225215345600360150ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/as7-integration-testing/cdi-test/src/test/java/org/jboss/resteasy/testspackage org.jboss.resteasy.tests; import org.jboss.resteasy.client.ClientRequest; import org.jboss.resteasy.client.ClientResponse; import org.junit.Assert; import org.junit.Test; /** * @author Bill Burke * @version $Revision: 1 $ */ public class AsyncTest { @Test public void testAsync() throws Exception { ClientRequest request = new ClientRequest("http://localhost:8080/cdi-test/jaxrs/async"); ClientResponse response = request.get(String.class); Assert.assertEquals(200, response.getStatus()); Assert.assertEquals("hello", response.getEntity()); } @Test public void testTimeout() throws Exception { ClientRequest request = new ClientRequest("http://localhost:8080/cdi-test/jaxrs/async/timeout"); ClientResponse response = request.get(String.class); Assert.assertEquals(503, response.getStatus()); } } EchoTest.java000066400000000000000000000007451225215345600356140ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/as7-integration-testing/cdi-test/src/test/java/org/jboss/resteasy/testspackage org.jboss.resteasy.tests; import org.jboss.resteasy.client.ClientRequest; import org.junit.Assert; import org.junit.Test; /** */ public class EchoTest { @Test public void testIt2() throws Exception { ClientRequest request = new ClientRequest("http://localhost:8080/cdi-test/jaxrs"); String format = request.getTarget(String.class); System.out.println("Format: " + format); Assert.assertEquals("foo 1.1", format); } } Resteasy-3.0.6.Final/jaxrs/as7-integration-testing/modules-test/000077500000000000000000000000001225215345600246165ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/as7-integration-testing/modules-test/pom.xml000077500000000000000000000100551225215345600261370ustar00rootroot00000000000000 org.jboss.resteasy resteasy-jaxrs-all 3.0.6.Final ../../pom.xml 4.0.0 org.jboss.resteasy.test as7-modules-test war as7-cdi-test http://maven.apache.org junit junit org.jboss.resteasy resteasy-crypto ${project.version} provided org.jboss.resteasy resteasy-jaxrs ${project.version} provided org.jboss.resteasy resteasy-client ${project.version} provided org.codehaus.jackson jackson-mapper-asl provided modules-test org.jboss.as.plugins jboss-as-maven-plugin 7.4.Final jboss-deploy pre-integration-test deploy jboss-undeploy post-integration-test undeploy org.apache.maven.plugins maven-surefire-plugin true surefire-it integration-test test false org.apache.maven.plugins maven-deploy-plugin true org.apache.maven.plugins maven-compiler-plugin 1.6 1.6 Resteasy-3.0.6.Final/jaxrs/as7-integration-testing/modules-test/src/000077500000000000000000000000001225215345600254055ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/as7-integration-testing/modules-test/src/main/000077500000000000000000000000001225215345600263315ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/as7-integration-testing/modules-test/src/main/java/000077500000000000000000000000001225215345600272525ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/as7-integration-testing/modules-test/src/main/java/org/000077500000000000000000000000001225215345600300415ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/as7-integration-testing/modules-test/src/main/java/org/jboss/000077500000000000000000000000001225215345600311615ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/as7-integration-testing/modules-test/src/main/java/org/jboss/resteasy/000077500000000000000000000000001225215345600330205ustar00rootroot00000000000000000077500000000000000000000000001225215345600341035ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/as7-integration-testing/modules-test/src/main/java/org/jboss/resteasy/testsMyApplication.java000066400000000000000000000010711225215345600375160ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/as7-integration-testing/modules-test/src/main/java/org/jboss/resteasy/testspackage org.jboss.resteasy.tests; import javax.ws.rs.ApplicationPath; import javax.ws.rs.core.Application; import java.util.HashSet; import java.util.Set; /** * @author Bill Burke * @version $Revision: 1 $ */ @ApplicationPath("/jaxrs") public class MyApplication extends Application { protected Set singletons = new HashSet(); public MyApplication() { singletons.add(new NewFeaturesResource()); } @Override public Set getSingletons() { return singletons; } } NewFeaturesResource.java000066400000000000000000000075351225215345600407200ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/as7-integration-testing/modules-test/src/main/java/org/jboss/resteasy/testspackage org.jboss.resteasy.tests; import org.apache.http.client.HttpClient; import org.apache.http.impl.client.DefaultHttpClient; import org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager; import org.codehaus.jackson.map.DeserializationConfig; import org.codehaus.jackson.map.ObjectMapper; import org.codehaus.jackson.map.SerializationConfig; import org.codehaus.jackson.map.annotate.JsonSerialize; import org.jboss.resteasy.client.jaxrs.ResteasyClient; import org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder; import org.jboss.resteasy.client.jaxrs.engines.ApacheHttpClient4Engine; import org.jboss.resteasy.security.BouncyIntegration; import org.jboss.resteasy.security.KeyTools; import org.jboss.resteasy.security.smime.PKCS7SignatureInput; import org.jboss.resteasy.security.smime.SignedOutput; import org.junit.Assert; import javax.ws.rs.Consumes; import javax.ws.rs.GET; import javax.ws.rs.POST; import javax.ws.rs.Path; import javax.ws.rs.Produces; import javax.ws.rs.core.MediaType; import java.security.InvalidKeyException; import java.security.KeyPair; import java.security.KeyPairGenerator; import java.security.NoSuchAlgorithmException; import java.security.NoSuchProviderException; import java.security.PrivateKey; import java.security.SignatureException; import java.security.cert.X509Certificate; /** * Should expose features not available in AS7 * * @author Bill Burke * @version $Revision: 1 $ */ @Path("/test") public class NewFeaturesResource { private X509Certificate cert; private PrivateKey privateKey; public static final ObjectMapper DEFAULT_MAPPER = new ObjectMapper(); public static final ObjectMapper WRAPPED_MAPPER = new ObjectMapper(); // this whole block makes sure Jackson is exported static { DEFAULT_MAPPER.setSerializationInclusion(JsonSerialize.Inclusion.NON_NULL); //DEFAULT_MAPPER.enable(SerializationConfig.Feature.INDENT_OUTPUT); DEFAULT_MAPPER.enable(DeserializationConfig.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY); WRAPPED_MAPPER.setSerializationInclusion(JsonSerialize.Inclusion.NON_NULL); //WRAPPED_MAPPER.enable(SerializationConfig.Feature.INDENT_OUTPUT); WRAPPED_MAPPER.enable(SerializationConfig.Feature.WRAP_ROOT_VALUE); WRAPPED_MAPPER.enable(DeserializationConfig.Feature.UNWRAP_ROOT_VALUE); WRAPPED_MAPPER.enable(DeserializationConfig.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY); } public NewFeaturesResource() { try { BouncyIntegration.init(); KeyPair keyPair = KeyPairGenerator.getInstance("RSA", "BC").generateKeyPair(); privateKey = keyPair.getPrivate(); cert = KeyTools.generateTestCertificate(keyPair); } catch (Exception e) { throw new RuntimeException(e); } } @GET @Path("signed/pkcs7-signature") @Produces("application/pkcs7-signature") public SignedOutput get() { SignedOutput output = new SignedOutput("hello world", "text/plain"); output.setCertificate(cert); output.setPrivateKey(privateKey); return output; } // make sure resteasy-crypto is exported @GET @Path("signed/text") @Produces("text/plain") public SignedOutput getText() { // just allocate a client to test that resteasy client is available and Apache HC4 is exposed. ResteasyClient client = new ResteasyClientBuilder().build(); ThreadSafeClientConnManager cm = new ThreadSafeClientConnManager(); cm.setMaxTotal(100); cm.setDefaultMaxPerRoute(100); HttpClient httpClient = new DefaultHttpClient(cm); SignedOutput output = new SignedOutput("hello world", "text/plain"); output.setCertificate(cert); output.setPrivateKey(privateKey); return output; } } Resteasy-3.0.6.Final/jaxrs/as7-integration-testing/modules-test/src/main/webapp/000077500000000000000000000000001225215345600276075ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/as7-integration-testing/modules-test/src/main/webapp/WEB-INF/000077500000000000000000000000001225215345600306365ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/as7-integration-testing/modules-test/src/main/webapp/WEB-INF/beans.xml000066400000000000000000000003761225215345600324560ustar00rootroot00000000000000 Resteasy-3.0.6.Final/jaxrs/as7-integration-testing/modules-test/src/main/webapp/WEB-INF/web.xml000066400000000000000000000004451225215345600321400ustar00rootroot00000000000000 Resteasy-3.0.6.Final/jaxrs/as7-integration-testing/modules-test/src/test/000077500000000000000000000000001225215345600263645ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/as7-integration-testing/modules-test/src/test/java/000077500000000000000000000000001225215345600273055ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/as7-integration-testing/modules-test/src/test/java/org/000077500000000000000000000000001225215345600300745ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/as7-integration-testing/modules-test/src/test/java/org/jboss/000077500000000000000000000000001225215345600312145ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/as7-integration-testing/modules-test/src/test/java/org/jboss/resteasy/000077500000000000000000000000001225215345600330535ustar00rootroot00000000000000000077500000000000000000000000001225215345600341365ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/as7-integration-testing/modules-test/src/test/java/org/jboss/resteasy/testsEchoTest.java000066400000000000000000000024571225215345600365270ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/as7-integration-testing/modules-test/src/test/java/org/jboss/resteasy/testspackage org.jboss.resteasy.tests; import org.jboss.resteasy.client.ClientRequest; import org.jboss.resteasy.security.smime.PKCS7SignatureInput; import org.jboss.resteasy.test.TestPortProvider; import org.junit.Assert; import org.junit.Test; import javax.ws.rs.client.Client; import javax.ws.rs.client.ClientBuilder; import javax.ws.rs.client.WebTarget; import javax.ws.rs.core.MediaType; /** */ public class EchoTest { @Test public void testIt2() throws Exception { Client client = ClientBuilder.newClient(); WebTarget target = client.target("http://localhost:8080/modules-test/jaxrs"); String data = target.path("test/signed/text").request().get(String.class); System.out.println(data); client.close(); } @Test public void testPKCS7SignedOutput() throws Exception { Client client = ClientBuilder.newClient(); WebTarget target = client.target("http://localhost:8080/modules-test/jaxrs"); target = target.path("test/signed/pkcs7-signature"); PKCS7SignatureInput signed = target.request().get(PKCS7SignatureInput.class); String output = (String) signed.getEntity(String.class, MediaType.TEXT_PLAIN_TYPE); System.out.println(output); Assert.assertEquals("hello world", output); } } Resteasy-3.0.6.Final/jaxrs/as7-integration-testing/pom.xml000077500000000000000000000020141225215345600235060ustar00rootroot00000000000000 org.jboss.resteasy resteasy-jaxrs-all 3.0.6.Final Resteasy JBoss AS7 Integration Tests 4.0.0 org.jboss.resteasy.test war-tests-pom pom org.apache.maven.plugins maven-deploy-plugin true cdi-test modules-test Resteasy-3.0.6.Final/jaxrs/as8-integration-testing/000077500000000000000000000000001225215345600221725ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/as8-integration-testing/application-test/000077500000000000000000000000001225215345600254525ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/as8-integration-testing/application-test/pom.xml000077500000000000000000000077401225215345600270020ustar00rootroot00000000000000 org.jboss.resteasy resteasy-jaxrs-all 3.0.6.Final ../../pom.xml 4.0.0 org.jboss.resteasy.test as8-application-test war http://maven.apache.org 8.0.0m-alpha-20130417-resteasy-3.0.6.Final junit junit test javax.enterprise cdi-api 1.0 provided org.jboss.resteasy resteasy-jaxrs ${project.version} provided org.jboss.resteasy resteasy-client ${project.version} provided application-test org.jboss.as.plugins jboss-as-maven-plugin 7.4.Final jboss-deploy pre-integration-test deploy jboss-undeploy post-integration-test undeploy org.apache.maven.plugins maven-surefire-plugin true surefire-it integration-test test false org.apache.maven.plugins maven-deploy-plugin true org.apache.maven.plugins maven-compiler-plugin 1.6 1.6 Resteasy-3.0.6.Final/jaxrs/as8-integration-testing/application-test/src/000077500000000000000000000000001225215345600262415ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/as8-integration-testing/application-test/src/main/000077500000000000000000000000001225215345600271655ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/as8-integration-testing/application-test/src/main/java/000077500000000000000000000000001225215345600301065ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/as8-integration-testing/application-test/src/main/java/org/000077500000000000000000000000001225215345600306755ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/as8-integration-testing/application-test/src/main/java/org/jboss/000077500000000000000000000000001225215345600320155ustar00rootroot00000000000000000077500000000000000000000000001225215345600335755ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/as8-integration-testing/application-test/src/main/java/org/jboss/resteasy000077500000000000000000000000001225215345600347375ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/as8-integration-testing/application-test/src/main/java/org/jboss/resteasy/testsAExplicitApplication.java000066400000000000000000000007771225215345600416630ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/as8-integration-testing/application-test/src/main/java/org/jboss/resteasy/testspackage org.jboss.resteasy.tests; import javax.ws.rs.ApplicationPath; import javax.ws.rs.core.Application; import java.util.HashSet; import java.util.Set; /** * @author Bill Burke * @version $Revision: 1 $ */ @ApplicationPath("a/explicit") public class AExplicitApplication extends Application { @Override public Set> getClasses() { HashSet> set = new HashSet>(); set.add(ResourceA.class); return set; } } BExplicitApplication.java000066400000000000000000000010251225215345600416470ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/as8-integration-testing/application-test/src/main/java/org/jboss/resteasy/testspackage org.jboss.resteasy.tests; import javax.ws.rs.ApplicationPath; import javax.ws.rs.core.Application; import java.util.HashSet; import java.util.Set; /** * @author Bill Burke * @version $Revision: 1 $ */ @ApplicationPath("b/explicit") public class BExplicitApplication extends Application { @Override public Set> getClasses() { HashSet> set = new HashSet>(); set.add(ResourceB.class); return set; } } IgnoredApplication.java000066400000000000000000000003451225215345600413570ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/as8-integration-testing/application-test/src/main/java/org/jboss/resteasy/testspackage org.jboss.resteasy.tests; import javax.ws.rs.core.Application; /** * @author Bill Burke * @version $Revision: 1 $ */ public class IgnoredApplication extends Application { } MappedApplication.java000066400000000000000000000004241225215345600411740ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/as8-integration-testing/application-test/src/main/java/org/jboss/resteasy/testspackage org.jboss.resteasy.tests; import javax.ws.rs.ApplicationPath; import javax.ws.rs.core.Application; /** * @author Bill Burke * @version $Revision: 1 $ */ public class MappedApplication extends Application { } ResourceA.java000066400000000000000000000005001225215345600374650ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/as8-integration-testing/application-test/src/main/java/org/jboss/resteasy/testspackage org.jboss.resteasy.tests; import javax.ws.rs.GET; import javax.ws.rs.Path; /** * @author Bill Burke * @version $Revision: 1 $ */ @Path("/resources") public class ResourceA { @Path("a") @GET public String get() { return "a"; } } ResourceB.java000066400000000000000000000005001225215345600374660ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/as8-integration-testing/application-test/src/main/java/org/jboss/resteasy/testspackage org.jboss.resteasy.tests; import javax.ws.rs.GET; import javax.ws.rs.Path; /** * @author Bill Burke * @version $Revision: 1 $ */ @Path("/resources") public class ResourceB { @Path("b") @GET public String get() { return "b"; } } ScannedApplication.java000066400000000000000000000005441225215345600413440ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/as8-integration-testing/application-test/src/main/java/org/jboss/resteasy/testspackage org.jboss.resteasy.tests; import javax.ws.rs.ApplicationPath; import javax.ws.rs.core.Application; import java.util.HashSet; import java.util.Set; /** * @author Bill Burke * @version $Revision: 1 $ */ @ApplicationPath("scanned") public class ScannedApplication extends Application { } Resteasy-3.0.6.Final/jaxrs/as8-integration-testing/application-test/src/main/webapp/000077500000000000000000000000001225215345600304435ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/as8-integration-testing/application-test/src/main/webapp/WEB-INF/000077500000000000000000000000001225215345600314725ustar00rootroot00000000000000beans.xml000066400000000000000000000003761225215345600332330ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/as8-integration-testing/application-test/src/main/webapp/WEB-INF Resteasy-3.0.6.Final/jaxrs/as8-integration-testing/application-test/src/main/webapp/WEB-INF/web.xml000066400000000000000000000007331225215345600327740ustar00rootroot00000000000000 org.jboss.resteasy.tests.MappedApplication /mapped/* Resteasy-3.0.6.Final/jaxrs/as8-integration-testing/application-test/src/test/000077500000000000000000000000001225215345600272205ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/as8-integration-testing/application-test/src/test/java/000077500000000000000000000000001225215345600301415ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/as8-integration-testing/application-test/src/test/java/org/000077500000000000000000000000001225215345600307305ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/as8-integration-testing/application-test/src/test/java/org/jboss/000077500000000000000000000000001225215345600320505ustar00rootroot00000000000000000077500000000000000000000000001225215345600336305ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/as8-integration-testing/application-test/src/test/java/org/jboss/resteasy000077500000000000000000000000001225215345600347725ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/as8-integration-testing/application-test/src/test/java/org/jboss/resteasy/testsApplicationTest.java000066400000000000000000000044111225215345600407400ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/as8-integration-testing/application-test/src/test/java/org/jboss/resteasy/testspackage org.jboss.resteasy.tests; import junit.framework.Assert; import org.junit.Test; import javax.ws.rs.client.Client; import javax.ws.rs.client.ClientBuilder; import javax.ws.rs.client.WebTarget; import javax.ws.rs.core.Response; /** * @author Bill Burke * @version $Revision: 1 $ */ public class ApplicationTest { @Test public void testExplicitA() throws Exception { Client client = ClientBuilder.newClient(); String value = null; WebTarget base = client.target("http://localhost:8080/application-test/a/explicit"); value = base.path("resources/a").request().get(String.class); Assert.assertEquals("a", value); Response response = base.path("resources/b").request().get(); Assert.assertEquals(404, response.getStatus()); client.close(); } @Test public void testExplicitB() throws Exception { Client client = ClientBuilder.newClient(); String value = null; WebTarget base = client.target("http://localhost:8080/application-test/b/explicit"); value = base.path("resources/b").request().get(String.class); Assert.assertEquals("b", value); Response response = base.path("resources/a").request().get(); Assert.assertEquals(404, response.getStatus()); client.close(); } @Test public void testScanned() throws Exception { Client client = ClientBuilder.newClient(); String value = null; WebTarget base = client.target("http://localhost:8080/application-test/scanned"); value = base.path("resources/a").request().get(String.class); Assert.assertEquals("a", value); value = base.path("resources/b").request().get(String.class); Assert.assertEquals("b", value); } @Test public void testMapped() throws Exception { Client client = ClientBuilder.newClient(); String value = null; WebTarget base = client.target("http://localhost:8080/application-test/mapped"); value = base.path("resources/a").request().get(String.class); Assert.assertEquals("a", value); value = base.path("resources/b").request().get(String.class); Assert.assertEquals("b", value); } } Resteasy-3.0.6.Final/jaxrs/as8-integration-testing/cdilocator-test/000077500000000000000000000000001225215345600252725ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/as8-integration-testing/cdilocator-test/pom.xml000077500000000000000000000101141225215345600266070ustar00rootroot00000000000000 org.jboss.resteasy resteasy-jaxrs-all 3.0.6.Final ../../pom.xml 4.0.0 org.jboss.resteasy.test cdilocator-test war http://maven.apache.org junit junit test javax.enterprise cdi-api 1.0 provided org.jboss.spec.javax.ejb jboss-ejb-api_3.1_spec 1.0.2.Final provided org.jboss.resteasy resteasy-jaxrs ${project.version} provided org.jboss.resteasy resteasy-client ${project.version} provided cdilocator-test org.jboss.as.plugins jboss-as-maven-plugin 7.4.Final jboss-deploy pre-integration-test deploy jboss-undeploy post-integration-test undeploy org.apache.maven.plugins maven-surefire-plugin true surefire-it integration-test test false org.apache.maven.plugins maven-deploy-plugin true org.apache.maven.plugins maven-compiler-plugin 1.6 1.6 Resteasy-3.0.6.Final/jaxrs/as8-integration-testing/cdilocator-test/src/000077500000000000000000000000001225215345600260615ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/as8-integration-testing/cdilocator-test/src/main/000077500000000000000000000000001225215345600270055ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/as8-integration-testing/cdilocator-test/src/main/java/000077500000000000000000000000001225215345600277265ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/as8-integration-testing/cdilocator-test/src/main/java/org/000077500000000000000000000000001225215345600305155ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/as8-integration-testing/cdilocator-test/src/main/java/org/jboss/000077500000000000000000000000001225215345600316355ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/as8-integration-testing/cdilocator-test/src/main/java/org/jboss/resteasy/000077500000000000000000000000001225215345600334745ustar00rootroot00000000000000000077500000000000000000000000001225215345600345575ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/as8-integration-testing/cdilocator-test/src/main/java/org/jboss/resteasy/testsTestResource.java000077500000000000000000000030451225215345600400560ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/as8-integration-testing/cdilocator-test/src/main/java/org/jboss/resteasy/testspackage org.jboss.resteasy.tests; import javax.enterprise.context.ApplicationScoped; import javax.inject.Inject; import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.QueryParam; import java.lang.reflect.Method; @Path("/test") @ApplicationScoped // Weld uses a proxy public class TestResource { @Inject FooResource fooResource; @GET public String get(@QueryParam("foo") java.util.List foos) { // Bug: It's not a List, it's a List for (Foo foo : foos) { return "OK"; } return null; } @Path("lookup") public FooResource lookup() throws Exception { System.out.println("classname: " + fooResource.getClass().getName()); for (Method m : fooResource.getClass().getMethods()) { if (m.getName().equals("get")) { System.out.println(m); System.out.println("@GET? " + m.isAnnotationPresent(GET.class)); } } return fooResource; } @ApplicationScoped // Weld uses a proxy public static class FooResource { @GET public String get(@QueryParam("foo") java.util.List foos) { // Bug: It's not a List, it's a List for (Foo foo : foos) { return "OK"; } return null; } } public static class Foo { String value; public Foo(String value) { this.value = value; } } } TheApp.java000077500000000000000000000010731225215345600366070ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/as8-integration-testing/cdilocator-test/src/main/java/org/jboss/resteasy/testspackage org.jboss.resteasy.tests; import java.util.HashSet; import java.util.Set; import javax.annotation.ManagedBean; import javax.annotation.PostConstruct; import javax.enterprise.context.ApplicationScoped; import javax.ws.rs.ApplicationPath; import javax.ws.rs.core.Application; import javax.ws.rs.core.Context; import javax.ws.rs.core.UriInfo; @ApplicationPath("/") public class TheApp extends Application { public Set> getClasses() { Set> resources = new HashSet>(); resources.add(TestResource.class); return resources; } } Resteasy-3.0.6.Final/jaxrs/as8-integration-testing/cdilocator-test/src/main/webapp/000077500000000000000000000000001225215345600302635ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/as8-integration-testing/cdilocator-test/src/main/webapp/WEB-INF/000077500000000000000000000000001225215345600313125ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/as8-integration-testing/cdilocator-test/src/main/webapp/WEB-INF/beans.xml000077500000000000000000000003761225215345600331350ustar00rootroot00000000000000 Resteasy-3.0.6.Final/jaxrs/as8-integration-testing/cdilocator-test/src/main/webapp/WEB-INF/web.xml000077500000000000000000000004551225215345600326200ustar00rootroot00000000000000 Resteasy-3.0.6.Final/jaxrs/as8-integration-testing/cdilocator-test/src/test/000077500000000000000000000000001225215345600270405ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/as8-integration-testing/cdilocator-test/src/test/java/000077500000000000000000000000001225215345600277615ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/as8-integration-testing/cdilocator-test/src/test/java/org/000077500000000000000000000000001225215345600305505ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/as8-integration-testing/cdilocator-test/src/test/java/org/jboss/000077500000000000000000000000001225215345600316705ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/as8-integration-testing/cdilocator-test/src/test/java/org/jboss/resteasy/000077500000000000000000000000001225215345600335275ustar00rootroot00000000000000000077500000000000000000000000001225215345600346125ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/as8-integration-testing/cdilocator-test/src/test/java/org/jboss/resteasy/testsApplicationTest.java000077500000000000000000000023621225215345600405660ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/as8-integration-testing/cdilocator-test/src/test/java/org/jboss/resteasy/testspackage org.jboss.resteasy.tests; import junit.framework.Assert; import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Test; import javax.ws.rs.client.Client; import javax.ws.rs.client.ClientBuilder; import javax.ws.rs.client.WebTarget; import javax.ws.rs.core.Response; /** * @author Bill Burke * @version $Revision: 1 $ */ //@FixMethodOrder(MethodSorters.NAME_ASCENDING) public class ApplicationTest { static Client client; static WebTarget baseTarget; @BeforeClass public static void initClient() { client = ClientBuilder.newClient(); baseTarget = client.target("http://localhost:8080/cdilocator-test"); } @AfterClass public static void closeClient() { client.close(); } @Test public void genericTypeTest() throws Exception { String result = baseTarget.path("test").queryParam("foo", "yo").request().get(String.class); System.out.println(result); } @Test public void locatorTest() throws Exception { String result = baseTarget.path("test/lookup").queryParam("foo", "yo").request().get(String.class); System.out.println(result); } } Resteasy-3.0.6.Final/jaxrs/as8-integration-testing/ejb-singleton-test/000077500000000000000000000000001225215345600257075ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/as8-integration-testing/ejb-singleton-test/pom.xml000077500000000000000000000101241225215345600272250ustar00rootroot00000000000000 org.jboss.resteasy resteasy-jaxrs-all 3.0.6.Final ../../pom.xml 4.0.0 org.jboss.resteasy.test as8-application-test war http://maven.apache.org junit junit test javax.enterprise cdi-api 1.0 provided org.jboss.spec.javax.ejb jboss-ejb-api_3.1_spec 1.0.2.Final provided org.jboss.resteasy resteasy-jaxrs ${project.version} provided org.jboss.resteasy resteasy-client ${project.version} provided ejb-singleton-test org.jboss.as.plugins jboss-as-maven-plugin 7.4.Final jboss-deploy pre-integration-test deploy jboss-undeploy post-integration-test undeploy org.apache.maven.plugins maven-surefire-plugin true surefire-it integration-test test false org.apache.maven.plugins maven-deploy-plugin true org.apache.maven.plugins maven-compiler-plugin 1.6 1.6 Resteasy-3.0.6.Final/jaxrs/as8-integration-testing/ejb-singleton-test/src/000077500000000000000000000000001225215345600264765ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/as8-integration-testing/ejb-singleton-test/src/main/000077500000000000000000000000001225215345600274225ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/as8-integration-testing/ejb-singleton-test/src/main/java/000077500000000000000000000000001225215345600303435ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/as8-integration-testing/ejb-singleton-test/src/main/java/org/000077500000000000000000000000001225215345600311325ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/as8-integration-testing/ejb-singleton-test/src/main/java/org/jboss/000077500000000000000000000000001225215345600322525ustar00rootroot00000000000000000077500000000000000000000000001225215345600340325ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/as8-integration-testing/ejb-singleton-test/src/main/java/org/jboss/resteasy000077500000000000000000000000001225215345600351745ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/as8-integration-testing/ejb-singleton-test/src/main/java/org/jboss/resteasy/testsScannedApplication.java000077500000000000000000000010441225215345600416000ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/as8-integration-testing/ejb-singleton-test/src/main/java/org/jboss/resteasy/testspackage org.jboss.resteasy.tests; import javax.ws.rs.ApplicationPath; import javax.ws.rs.core.Application; import java.util.HashSet; import java.util.Set; /** * @author Bill Burke * @version $Revision: 1 $ */ @ApplicationPath("/") public class ScannedApplication extends Application { public java.util.Set> getClasses() { Set> resources = new HashSet>(); resources.add(SingletonRootResource.class); return resources; }} SingletonLocalIF.java000077500000000000000000000003541225215345600412000ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/as8-integration-testing/ejb-singleton-test/src/main/java/org/jboss/resteasy/testspackage org.jboss.resteasy.tests; import javax.ws.rs.GET; /** * @author Bill Burke * @version $Revision: 1 $ */ public interface SingletonLocalIF { @GET String get(); } SingletonRootResource.java000077500000000000000000000025321225215345600423620ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/as8-integration-testing/ejb-singleton-test/src/main/java/org/jboss/resteasy/testspackage org.jboss.resteasy.tests; import javax.annotation.PostConstruct; import javax.ejb.EJB; import javax.ejb.EJBException; import javax.ejb.Singleton; import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.WebApplicationException; import javax.ws.rs.core.Application; import javax.ws.rs.core.Context; import javax.ws.rs.core.Response; /** * @author Bill Burke * @version $Revision: 1 $ */ @Singleton @Path("root") public class SingletonRootResource { @EJB SingletonSubResource sub; @EJB SingletonLocalIF rl; @Path("sub") public SingletonSubResource getSub() { return sub; } @Path("intfsub") public SingletonLocalIF getLocalSub() { return rl; } @Context private Application injectedApplication; private boolean isJaxrsInjectedPriorToPostConstruct = false; @PostConstruct public void postConstruct() { isJaxrsInjectedPriorToPostConstruct = injectedApplication != null; } @Path("injected") @GET public String injected(){ return String.valueOf(isJaxrsInjectedPriorToPostConstruct); } @Path("exception") @GET public String throwException (){ throw new EJBException(new WebApplicationException(Response.Status.CREATED)); } } SingletonSubResource.java000077500000000000000000000005741225215345600421740ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/as8-integration-testing/ejb-singleton-test/src/main/java/org/jboss/resteasy/testspackage org.jboss.resteasy.tests; import javax.ejb.Singleton; import javax.ws.rs.GET; import javax.ws.rs.Produces; /** * @author Bill Burke * @version $Revision: 1 $ */ @Singleton public class SingletonSubResource { @GET @Produces("text/plain") public String hello() { return "hello"; } } SingletonTestBean.java000077500000000000000000000011471225215345600414350ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/as8-integration-testing/ejb-singleton-test/src/main/java/org/jboss/resteasy/testspackage org.jboss.resteasy.tests; import javax.ejb.Local; import javax.ejb.Stateless; import javax.ws.rs.GET; import javax.ws.rs.core.Context; import javax.ws.rs.core.UriInfo; @Stateless(name = "SingletonTestBean") @Local({ SingletonLocalIF.class }) public class SingletonTestBean implements SingletonLocalIF { public SingletonTestBean() { } public void remove() { } @Context private UriInfo ui; @Override @GET public String get() { return "GET: " + ui.getRequestUri().toASCIIString() + " Hello From Singleton Local EJB Sub"; } }Resteasy-3.0.6.Final/jaxrs/as8-integration-testing/ejb-singleton-test/src/main/webapp/000077500000000000000000000000001225215345600307005ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/as8-integration-testing/ejb-singleton-test/src/main/webapp/WEB-INF/000077500000000000000000000000001225215345600317275ustar00rootroot00000000000000web.xml000077500000000000000000000004551225215345600331560ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/as8-integration-testing/ejb-singleton-test/src/main/webapp/WEB-INF Resteasy-3.0.6.Final/jaxrs/as8-integration-testing/ejb-singleton-test/src/test/000077500000000000000000000000001225215345600274555ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/as8-integration-testing/ejb-singleton-test/src/test/java/000077500000000000000000000000001225215345600303765ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/as8-integration-testing/ejb-singleton-test/src/test/java/org/000077500000000000000000000000001225215345600311655ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/as8-integration-testing/ejb-singleton-test/src/test/java/org/jboss/000077500000000000000000000000001225215345600323055ustar00rootroot00000000000000000077500000000000000000000000001225215345600340655ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/as8-integration-testing/ejb-singleton-test/src/test/java/org/jboss/resteasy000077500000000000000000000000001225215345600352275ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/as8-integration-testing/ejb-singleton-test/src/test/java/org/jboss/resteasy/testsApplicationTest.java000077500000000000000000000021061225215345600411770ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/as8-integration-testing/ejb-singleton-test/src/test/java/org/jboss/resteasy/testspackage org.jboss.resteasy.tests; import junit.framework.Assert; import org.junit.Test; import javax.ws.rs.client.Client; import javax.ws.rs.client.ClientBuilder; import javax.ws.rs.client.WebTarget; import javax.ws.rs.core.Response; /** * @author Bill Burke * @version $Revision: 1 $ */ public class ApplicationTest { @Test public void testSingleton() throws Exception { Client client = ClientBuilder.newClient(); String value = null; WebTarget base = client.target("http://localhost:8080/ejb-singleton-test/root"); value = base.path("sub").request().get(String.class); Assert.assertEquals("hello", value); value = base.path("injected").request().get(String.class); Assert.assertEquals("true", value); value = base.path("intfsub").request().get(String.class); System.out.println(value); Response response = base.path("exception").request().get(); Assert.assertEquals(201, response.getStatus()); client.close(); } } Resteasy-3.0.6.Final/jaxrs/as8-integration-testing/null-test/000077500000000000000000000000001225215345600241215ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/as8-integration-testing/null-test/src/000077500000000000000000000000001225215345600247105ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/as8-integration-testing/null-test/src/main/000077500000000000000000000000001225215345600256345ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/as8-integration-testing/null-test/src/main/java/000077500000000000000000000000001225215345600265555ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/as8-integration-testing/null-test/src/main/java/org/000077500000000000000000000000001225215345600273445ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/as8-integration-testing/null-test/src/main/java/org/jboss/000077500000000000000000000000001225215345600304645ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/as8-integration-testing/null-test/src/main/java/org/jboss/resteasy/000077500000000000000000000000001225215345600323235ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/as8-integration-testing/null-test/src/main/java/org/jboss/resteasy/tests/000077500000000000000000000000001225215345600334655ustar00rootroot00000000000000Resource.java000077500000000000000000000013261225215345600360450ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/as8-integration-testing/null-test/src/main/java/org/jboss/resteasy/testspackage org.jboss.resteasy.tests; import javax.servlet.http.HttpServletRequest; import javax.ws.rs.GET; import javax.ws.rs.POST; import javax.ws.rs.Path; import javax.ws.rs.core.Context; import javax.ws.rs.core.MultivaluedMap; import javax.ws.rs.core.Response; /** * @author Bill Burke * @version $Revision: 1 $ */ @Path("/") public class Resource { @Path("map") @POST public MultivaluedMap map(MultivaluedMap map) { System.out.println("********** MAP SIZE: " + map.size()); return map; } @Path("entity") @GET public Response entity() { return Response.ok().build(); } } Resteasy-3.0.6.Final/jaxrs/as8-integration-testing/pom.xml000077500000000000000000000021351225215345600235130ustar00rootroot00000000000000 org.jboss.resteasy resteasy-jaxrs-all 3.0.6.Final Resteasy AS8 Tests 4.0.0 org.jboss.resteasy.test as8-tests-pom pom org.apache.maven.plugins maven-deploy-plugin true cdilocator-test managedbean-test ejb-stateless-test application-test Resteasy-3.0.6.Final/jaxrs/as8-mavenized-distro/000077500000000000000000000000001225215345600214605ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/as8-mavenized-distro/assembly.xml000066400000000000000000000004601225215345600240210ustar00rootroot00000000000000 all zip true jboss-as-distro Resteasy-3.0.6.Final/jaxrs/as8-mavenized-distro/pom.xml000077500000000000000000000037061225215345600230060ustar00rootroot00000000000000 4.0.0 org.jboss.resteasy resteasy-jaxrs-all 3.0.6.Final org.jboss.as jboss-as-dist pom 8.0.0m-alpha-20130417 Custom AS8 Distribution maven-assembly-plugin 2.4 assemble package single assembly.xml target/distribution target/assembly/work jboss-as-${project.version} false org.apache.maven.plugins maven-install-plugin true Resteasy-3.0.6.Final/jaxrs/as8-resteasy/000077500000000000000000000000001225215345600200335ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/as8-resteasy/assembly.xml000066400000000000000000000036641225215345600224050ustar00rootroot00000000000000 all zip false ${project.build.directory}/jboss-as-${jboss.dist.version} jboss-as-${project.version} **/modules/system/layers/base/org/jboss/resteasy/resteasy-atom-provider/** **/modules/system/layers/base/org/jboss/resteasy/resteasy-cdi/** **/modules/system/layers/base/org/jboss/resteasy/resteasy-jackson-provider/** **/modules/system/layers/base/org/jboss/resteasy/resteasy-jaxb-provider/** **/modules/system/layers/base/org/jboss/resteasy/resteasy-jaxrs/** **/modules/system/layers/base/org/jboss/resteasy/resteasy-jettison-provider/** **/modules/system/layers/base/org/jboss/resteasy/resteasy-jsapi/** **/modules/system/layers/base/org/jboss/resteasy/resteasy-multipart-provider/** **/modules/system/layers/base/org/jboss/resteasy/resteasy-yaml-provider/** **/modules/system/layers/base/javax/ws/rs/** **/modules/system/layers/base/org/bouncycastle/** **/modules/system/layers/base/org/codehaus/jackson/** **/modules/system/layers/base/org/codehaus/jettison/** ../jboss-modules/target/mavenized/modules jboss-as-${project.version}/modules/system/layers/base Resteasy-3.0.6.Final/jaxrs/as8-resteasy/pom.xml000077500000000000000000000071161225215345600213600ustar00rootroot00000000000000 4.0.0 org.jboss.resteasy resteasy-jaxrs-all 3.0.6.Final org.jboss.as jboss-as-dist 8.0.0m-alpha-20130417-resteasy-3.0.6.Final pom Custom AS8 Resteasy Distribution 8.0.0m-alpha-20130417 org.jboss.as jboss-as-dist ${jboss.dist.version} zip org.apache.maven.plugins maven-dependency-plugin 2.7 unpack prepare-package unpack org.jboss.as jboss-as-dist ${jboss.dist.version} zip ${project.build.directory} maven-assembly-plugin 2.4 assemble package single assembly.xml target/distribution target/assembly/work jboss-as-${project.version} false org.apache.maven.plugins maven-install-plugin true Resteasy-3.0.6.Final/jaxrs/async-http-servlet-3.0/000077500000000000000000000000001225215345600215555ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/async-http-servlet-3.0/async-http-servlet-3.0-test/000077500000000000000000000000001225215345600266045ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/async-http-servlet-3.0/async-http-servlet-3.0-test/pom.xml000077500000000000000000000110631225215345600301250ustar00rootroot00000000000000 org.jboss.resteasy resteasy-jaxrs-all 3.0.6.Final ../../pom.xml 4.0.0 async-http-servlet-3.0-test war Async HTTP Servlet 3.0 Test org.jboss.resteasy resteasy-jaxrs ${project.version} org.jboss.resteasy resteasy-client ${project.version} org.jboss.resteasy resteasy-jaxb-provider ${project.version} org.jboss.resteasy async-http-servlet-3.0 ${project.version} junit junit commons-httpclient commons-httpclient 3.1 test org.apache.maven.plugins maven-deploy-plugin true org.mortbay.jetty jetty-maven-plugin 8.1.11.v20130520 / 10 foo 9999 start-jetty pre-integration-test run 0 true stop-jetty post-integration-test stop org.apache.maven.plugins maven-surefire-plugin true surefire-it integration-test test false org.apache.maven.plugins maven-compiler-plugin 1.6 1.6 Resteasy-3.0.6.Final/jaxrs/async-http-servlet-3.0/async-http-servlet-3.0-test/src/000077500000000000000000000000001225215345600273735ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/async-http-servlet-3.0/async-http-servlet-3.0-test/src/main/000077500000000000000000000000001225215345600303175ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/async-http-servlet-3.0/async-http-servlet-3.0-test/src/main/java/000077500000000000000000000000001225215345600312405ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/async-http-servlet-3.0/async-http-servlet-3.0-test/src/main/java/org/000077500000000000000000000000001225215345600320275ustar00rootroot00000000000000000077500000000000000000000000001225215345600330705ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/async-http-servlet-3.0/async-http-servlet-3.0-test/src/main/java/org/jboss000077500000000000000000000000001225215345600347275ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/async-http-servlet-3.0/async-http-servlet-3.0-test/src/main/java/org/jboss/resteasy000077500000000000000000000000001225215345600357065ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/async-http-servlet-3.0/async-http-servlet-3.0-test/src/main/java/org/jboss/resteasy/test000077500000000000000000000000001225215345600370235ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/async-http-servlet-3.0/async-http-servlet-3.0-test/src/main/java/org/jboss/resteasy/test/asyncAsyncResponseBlockingQueue.java000077500000000000000000000006131225215345600451430ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/async-http-servlet-3.0/async-http-servlet-3.0-test/src/main/java/org/jboss/resteasy/test/asyncpackage org.jboss.resteasy.test.async; import java.util.concurrent.ArrayBlockingQueue; import javax.ws.rs.container.AsyncResponse; public class AsyncResponseBlockingQueue extends ArrayBlockingQueue { private static final long serialVersionUID = -2445906740359075621L; public AsyncResponseBlockingQueue(int capacity) { super(capacity); } } JaxrsResource.java000077500000000000000000000104641225215345600424750ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/async-http-servlet-3.0/async-http-servlet-3.0-test/src/main/java/org/jboss/resteasy/test/asyncpackage org.jboss.resteasy.test.async; import javax.ws.rs.ForbiddenException; import javax.ws.rs.GET; import javax.ws.rs.POST; import javax.ws.rs.PUT; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.Produces; import javax.ws.rs.container.AsyncResponse; import javax.ws.rs.container.Suspended; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; /** * @author Bill Burke * @version $Revision: 1 $ */ @Path("/jaxrs") public class JaxrsResource { protected boolean cancelled; @GET @Path("resume/object") @Produces("application/xml") public void resumeObject(@Suspended final AsyncResponse response) { response.resume(new XmlData("bill")); } @GET @Path("resume/object/thread") @Produces("application/xml") public void resumeObjectThread(@Suspended final AsyncResponse response) throws Exception { Thread t = new Thread() { @Override public void run() { response.resume(new XmlData("bill")); } }; t.start(); } @GET @Path("injection-failure/{param}") public void injectionFailure(@Suspended final AsyncResponse response, @PathParam("param") int id) { throw new ForbiddenException("Should be unreachable"); } @GET @Path("method-failure") public void injectionFailure(@Suspended final AsyncResponse response) { throw new ForbiddenException("Should be unreachable"); } @GET @Path("cancelled") public Response getCancelled() { if (cancelled) return Response.noContent().build(); else return Response.status(500).build(); } @PUT @Path("cancelled") public void resetCancelled() { cancelled = false; } @GET @Produces("text/plain") public void get(@Suspended final AsyncResponse response) throws Exception { response.setTimeout(2000, TimeUnit.MILLISECONDS); Thread t = new Thread() { @Override public void run() { try { System.out.println("STARTED!!!!"); Thread.sleep(100); Response jaxrs = Response.ok("hello").type(MediaType.TEXT_PLAIN).build(); response.resume(jaxrs); } catch (Exception e) { e.printStackTrace(); } } }; t.start(); } @GET @Path("timeout") @Produces("text/plain") public void timeout(@Suspended final AsyncResponse response) { response.setTimeout(10, TimeUnit.MILLISECONDS); Thread t = new Thread() { @Override public void run() { try { System.out.println("STARTED!!!!"); Thread.sleep(100000); Response jaxrs = Response.ok("goodbye").type(MediaType.TEXT_PLAIN).build(); response.resume(jaxrs); } catch (Exception e) { e.printStackTrace(); } } }; t.start(); } @GET @Path("cancel") @Produces("text/plain") public void cancel(@Suspended final AsyncResponse response) throws Exception { response.setTimeout(10000, TimeUnit.MILLISECONDS); final CountDownLatch sync = new CountDownLatch(1); final CountDownLatch ready = new CountDownLatch(1); Thread t = new Thread() { @Override public void run() { try { sync.countDown(); System.out.println("cancel awaiting thread"); ready.await(); System.out.println("cancel resuming"); Response jaxrs = Response.ok("hello").type(MediaType.TEXT_PLAIN).build(); cancelled = !response.resume(jaxrs); } catch (Exception e) { e.printStackTrace(); } } }; t.start(); sync.await(); System.out.println("Cancelling..."); response.cancel(); ready.countDown(); } }MyApp.java000077500000000000000000000027311225215345600407220ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/async-http-servlet-3.0/async-http-servlet-3.0-test/src/main/java/org/jboss/resteasy/test/asyncpackage org.jboss.resteasy.test.async; import javax.ws.rs.core.Application; import javax.ws.rs.core.Response; import javax.ws.rs.ext.ExceptionMapper; import javax.ws.rs.ext.Provider; import java.io.PrintWriter; import java.io.StringWriter; import java.io.Writer; import java.util.HashSet; import java.util.Set; /** * @author Bill Burke * @version $Revision: 1 $ */ public class MyApp extends Application { private Set singletons = new HashSet(); private Set> classes = new HashSet>(); @Provider public static class PrintingErrorHandler implements ExceptionMapper { @Override public Response toResponse(Throwable throwable) { throwable.printStackTrace(); Writer result = new StringWriter(); PrintWriter printWriter = new PrintWriter(result); throwable.printStackTrace(printWriter); return Response.status(Response.Status.NOT_ACCEPTABLE).entity(result.toString()) .build(); } } public MyApp() { classes.add(Resource.class); classes.add(ServiceUnavailableExceptionMapper.class); classes.add(PrintingErrorHandler.class); singletons.add(new MyResource()); singletons.add(new JaxrsResource()); } @Override public Set> getClasses() { return classes; } @Override public Set getSingletons() { return singletons; } } MyResource.java000066400000000000000000000032001225215345600417560ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/async-http-servlet-3.0/async-http-servlet-3.0-test/src/main/java/org/jboss/resteasy/test/asyncpackage org.jboss.resteasy.test.async; import org.jboss.resteasy.annotations.Suspend; import org.jboss.resteasy.spi.AsynchronousResponse; import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.Produces; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; /** * @author Bill Burke * @version $Revision: 1 $ */ @Path("/") public class MyResource { @GET @Produces("text/plain") public void get(final @Suspend(2000) AsynchronousResponse response) { Thread t = new Thread() { @Override public void run() { try { System.out.println("STARTED!!!!"); Thread.sleep(100); Response jaxrs = Response.ok("hello").type(MediaType.TEXT_PLAIN).build(); response.setResponse(jaxrs); } catch (Exception e) { e.printStackTrace(); } } }; t.start(); } @GET @Path("timeout") @Produces("text/plain") public void timeout(final @Suspend(10) AsynchronousResponse response) { Thread t = new Thread() { @Override public void run() { try { System.out.println("STARTED!!!!"); Thread.sleep(100000); Response jaxrs = Response.ok("goodbye").type(MediaType.TEXT_PLAIN).build(); response.setResponse(jaxrs); } catch (Exception e) { e.printStackTrace(); } } }; t.start(); } }MyTimeoutHandler.java000077500000000000000000000014511225215345600431240ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/async-http-servlet-3.0/async-http-servlet-3.0-test/src/main/java/org/jboss/resteasy/test/asyncpackage org.jboss.resteasy.test.async; import java.util.concurrent.TimeUnit; import javax.ws.rs.container.AsyncResponse; import javax.ws.rs.container.TimeoutHandler; public class MyTimeoutHandler implements TimeoutHandler { private int function = 0; public MyTimeoutHandler(int function) { super(); this.function = function; } @Override public void handleTimeout(AsyncResponse asyncResponse) { switch (function) { case 1: asyncResponse.setTimeout(200, TimeUnit.MILLISECONDS); break; case 2: asyncResponse.cancel(); break; case 3: asyncResponse.resume(Resource.RESUMED); break; } } } Resource.java000077500000000000000000000152321225215345600414630ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/async-http-servlet-3.0/async-http-servlet-3.0-test/src/main/java/org/jboss/resteasy/test/asyncpackage org.jboss.resteasy.test.async; import javax.ws.rs.GET; import javax.ws.rs.POST; import javax.ws.rs.Path; import javax.ws.rs.QueryParam; import javax.ws.rs.WebApplicationException; import javax.ws.rs.container.AsyncResponse; import javax.ws.rs.container.Suspended; import javax.ws.rs.core.Response; import javax.ws.rs.core.Response.ResponseBuilder; import javax.ws.rs.core.Response.Status; import java.io.IOException; import java.util.Date; import java.util.concurrent.TimeUnit; @Path("resource") public class Resource { public static final String RESUMED = "Response resumed"; public static final String FALSE = "A method returned false"; public static final String TRUE = "A method return true"; // private static final AsyncResponseBlockingQueue[] stage = { new AsyncResponseBlockingQueue(1), new AsyncResponseBlockingQueue(1), new AsyncResponseBlockingQueue(1)}; @GET @Path("suspend") public void suspend(@Suspended AsyncResponse asyncResponse) { stage[0].add(asyncResponse); } @GET @Path("clear") public void clear() { for (int i = 0; i != stage.length; i++) stage[i].clear(); } @GET @Path("cancelvoid") public String cancel(@QueryParam("stage") String stage) { AsyncResponse response = takeAsyncResponse(stage); boolean ret = response.cancel(); System.out.println("*** response.cancel() 1 " + ret); // Invoking a cancel(...) method multiple times to cancel request // processing has the same effect as canceling the request processing // only once. ret &= response.cancel(); System.out.println("*** response.cancel() 2 " + ret); addResponse(response, stage); return ret ? TRUE : FALSE; } @POST @Path("cancelretry") public String cancelretry(@QueryParam("stage") String stage, String sRetryAfter) { AsyncResponse response = takeAsyncResponse(stage); int retryAfter = Integer.parseInt(sRetryAfter); boolean b = response.cancel(retryAfter); // Invoking a cancel(...) method multiple times to cancel request // processing has the same effect as canceling the request processing // only once. b &= response.cancel(retryAfter * 2); addResponse(response, stage); return b ? TRUE : FALSE; } @POST @Path("canceldate") public String cancelDate(@QueryParam("stage") String stage, String sRetryAfter) { AsyncResponse response = takeAsyncResponse(stage); long retryAfter = Long.parseLong(sRetryAfter); boolean b = response.cancel(new Date(retryAfter)); // Invoking a cancel(...) method multiple times to cancel request // processing has the same effect as canceling the request processing // only once. b &= response.cancel(new Date(retryAfter + 20000)); addResponse(response, stage); return b ? TRUE : FALSE; } @GET @Path("iscanceled") public String isCanceled(@QueryParam("stage") String stage) { AsyncResponse response = takeAsyncResponse(stage); boolean is = response.isCancelled(); addResponse(response, stage); return is ? TRUE : FALSE; } @GET @Path("isdone") public String isDone(@QueryParam("stage") String stage) { AsyncResponse response = takeAsyncResponse(stage); boolean is = response.isDone(); addResponse(response, stage); return is ? TRUE : FALSE; } @GET @Path("issuspended") public String isSuspended(@QueryParam("stage") String stage) { AsyncResponse response = takeAsyncResponse(stage); boolean is = response.isSuspended(); addResponse(response, stage); return is ? TRUE : FALSE; } @POST @Path("resume") public String resume(@QueryParam("stage") String stage, String response) { AsyncResponse async = takeAsyncResponse(stage); boolean b = resume(async, response); addResponse(async, stage); return b ? TRUE : FALSE; } @GET @Path("resumechecked") public String resumeWithCheckedException(@QueryParam("stage") String stage) { AsyncResponse async = takeAsyncResponse(stage); System.out.println("Before resourceWithCheckedException.resume()"); boolean b = async.resume(new IOException(RESUMED)); addResponse(async, stage); System.out.println("returning resourceWithCheckedException()"); return b ? TRUE : FALSE; } @GET @Path("resumeruntime") public String resumeWithRuntimeException(@QueryParam("stage") String stage) { AsyncResponse async = takeAsyncResponse(stage); boolean b = async.resume(new RuntimeException(RESUMED)); addResponse(async, stage); return b ? TRUE : FALSE; } @POST @Path("settimeout") public void setTimeOut(@QueryParam("stage") String stage, String milis) { AsyncResponse async = takeAsyncResponse(stage); async.setTimeout(Long.parseLong(milis), TimeUnit.MILLISECONDS); addResponse(async, stage); } @POST @Path("timeouthandler") public void setTimeoutHandler(@QueryParam("stage") String stage, int handlerValue) { MyTimeoutHandler handler = new MyTimeoutHandler(handlerValue); AsyncResponse async = takeAsyncResponse(stage); async.setTimeoutHandler(handler); async.setTimeout(200L, TimeUnit.MILLISECONDS); addResponse(async, stage); } // //////////////////////////////////////////////////////////////////////// protected static AsyncResponse takeAsyncResponse(String stageId) { return takeAsyncResponse(Integer.parseInt(stageId)); } protected static AsyncResponse takeAsyncResponse(int stageId) { final ResponseBuilder error = createErrorResponseBuilder(); AsyncResponse asyncResponse = null; try { asyncResponse = stage[stageId].take(); } catch (InterruptedException e) { throw new WebApplicationException(error.entity( "ArrayBlockingQueue#take").build()); } return asyncResponse; } protected static final void addResponse(AsyncResponse response, String stageId) { int id = Integer.parseInt(stageId) + 1; if (id != stage.length) stage[id].add(response); } protected static boolean resume(AsyncResponse takenResponse, Object response) { return takenResponse.resume(response); } protected static ResponseBuilder createErrorResponseBuilder() { return Response.status(Status.EXPECTATION_FAILED); } } ServiceUnavailableExceptionMapper.java000077500000000000000000000014121225215345600464570ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/async-http-servlet-3.0/async-http-servlet-3.0-test/src/main/java/org/jboss/resteasy/test/asyncpackage org.jboss.resteasy.test.async; import javax.ws.rs.ServiceUnavailableException; import javax.ws.rs.core.Response; import javax.ws.rs.core.Response.Status; import javax.ws.rs.ext.ExceptionMapper; import javax.ws.rs.ext.Provider; @Provider public class ServiceUnavailableExceptionMapper implements ExceptionMapper { @Override public Response toResponse(ServiceUnavailableException exception) { String entity = new StringBuilder() .append(exception.getClass().getName()).append(";status=") .append(exception.getResponse().getStatus()).toString(); return Response.status(Status.REQUEST_TIMEOUT).entity(entity).build(); } } XmlData.java000077500000000000000000000011051225215345600412200ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/async-http-servlet-3.0/async-http-servlet-3.0-test/src/main/java/org/jboss/resteasy/test/asyncpackage org.jboss.resteasy.test.async; import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlRootElement; /** * @author Bill Burke * @version $Revision: 1 $ */ @XmlRootElement(name = "data") public class XmlData { protected String name; public XmlData(String data) { this.name = data; } public XmlData() { } public String getName() { return name; } public void setName(String name) { this.name = name; } } Resteasy-3.0.6.Final/jaxrs/async-http-servlet-3.0/async-http-servlet-3.0-test/src/main/webapp/000077500000000000000000000000001225215345600315755ustar00rootroot00000000000000000077500000000000000000000000001225215345600325455ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/async-http-servlet-3.0/async-http-servlet-3.0-test/src/main/webapp/WEB-INFweb.xml000077500000000000000000000012761225215345600340550ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/async-http-servlet-3.0/async-http-servlet-3.0-test/src/main/webapp/WEB-INF Resteasy org.jboss.resteasy.plugins.server.servlet.HttpServlet30Dispatcher javax.ws.rs.Application org.jboss.resteasy.test.async.MyApp true Resteasy /* Resteasy-3.0.6.Final/jaxrs/async-http-servlet-3.0/async-http-servlet-3.0-test/src/test/000077500000000000000000000000001225215345600303525ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/async-http-servlet-3.0/async-http-servlet-3.0-test/src/test/java/000077500000000000000000000000001225215345600312735ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/async-http-servlet-3.0/async-http-servlet-3.0-test/src/test/java/org/000077500000000000000000000000001225215345600320625ustar00rootroot00000000000000000077500000000000000000000000001225215345600331235ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/async-http-servlet-3.0/async-http-servlet-3.0-test/src/test/java/org/jboss000077500000000000000000000000001225215345600347625ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/async-http-servlet-3.0/async-http-servlet-3.0-test/src/test/java/org/jboss/resteasy000077500000000000000000000000001225215345600357415ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/async-http-servlet-3.0/async-http-servlet-3.0-test/src/test/java/org/jboss/resteasy/test000077500000000000000000000000001225215345600370565ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/async-http-servlet-3.0/async-http-servlet-3.0-test/src/test/java/org/jboss/resteasy/test/asyncAsyncTest.java000077500000000000000000000017341225215345600416460ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/async-http-servlet-3.0/async-http-servlet-3.0-test/src/test/java/org/jboss/resteasy/test/asyncpackage org.jboss.resteasy.test.async; import org.jboss.resteasy.client.ClientRequest; import org.jboss.resteasy.client.ClientResponse; import org.junit.Assert; import org.junit.Test; /** * @author Bill Burke * @version $Revision: 1 $ */ public class AsyncTest { @Test public void testAsync() throws Exception { ClientRequest request = new ClientRequest("http://localhost:8080/"); ClientResponse response = request.get(String.class); Assert.assertEquals(200, response.getStatus()); Assert.assertEquals("hello", response.getEntity()); } @Test public void testTimeout() throws Exception { ClientRequest request = new ClientRequest("http://localhost:8080/timeout"); ClientResponse response = request.get(String.class); Assert.assertEquals(408, response.getStatus()); // exception mapper from another test overrides 503 to 408 } } ComprehensiveJaxrsTest.java000077500000000000000000000413151225215345600444070ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/async-http-servlet-3.0/async-http-servlet-3.0-test/src/test/java/org/jboss/resteasy/test/asyncpackage org.jboss.resteasy.test.async; import org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder; import org.junit.After; import org.junit.Assert; import org.junit.Before; import org.junit.Test; import javax.ws.rs.client.AsyncInvoker; import javax.ws.rs.client.Client; import javax.ws.rs.client.ClientBuilder; import javax.ws.rs.client.Entity; import javax.ws.rs.client.WebTarget; import javax.ws.rs.core.HttpHeaders; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import javax.ws.rs.core.Response.Status; import java.io.ByteArrayInputStream; import java.io.IOException; import java.text.DateFormat; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; import java.util.Locale; import java.util.TimeZone; import java.util.concurrent.Future; /** * @author Bill Burke * @version $Revision: 1 $ */ public class ComprehensiveJaxrsTest { protected Client client; @Before public void beforeTest() { client = new ResteasyClientBuilder().connectionPoolSize(10).build(); } @After public void afterTest() { client.close(); } protected static String objectsToString(Object... objects) { StringBuilder sb = new StringBuilder(); for (Object o : objects) sb.append(o).append(" "); return sb.toString().trim(); } public static void logMsg(Object... msg) { System.out.println(objectsToString(msg)); } @Test public void cancelVoidTest()throws Exception { invokeClear(); Future suspend = invokeRequest("suspend"); Future cancel = invokeRequest("cancelvoid?stage=0"); assertStatus(getResponse(suspend), Status.SERVICE_UNAVAILABLE); assertString(cancel, Resource.TRUE); } @Test public void cancelVoidOnResumedTest()throws Exception { suspendResumeTest(); Future cancel = invokeRequest("cancelvoid?stage=1"); assertString(cancel, Resource.FALSE); } @Test public void cancelVoidOnCanceledTest()throws Exception { cancelVoidTest(); Future cancel = invokeRequest("cancelvoid?stage=1"); assertString(cancel, Resource.TRUE); } @Test public void resumeCanceledTest()throws Exception { cancelVoidTest(); Future resumeCanceled = invokeRequest("resume?stage=1", ""); assertString(resumeCanceled, Resource.FALSE); } @Test public void cancelIntTest()throws Exception { String seconds = "20"; invokeClear(); Future suspend = invokeRequest("suspend"); Future cancel = invokeRequest("cancelretry?stage=0", seconds); Response response = getResponse(suspend); assertStatus(response, Status.SERVICE_UNAVAILABLE); assertString(cancel, Resource.TRUE); String retry = response.getHeaderString(HttpHeaders.RETRY_AFTER); assertEquals(seconds, retry, "Unexpected", HttpHeaders.RETRY_AFTER, "header value received", retry, "expected", seconds); logMsg("Found expected", HttpHeaders.RETRY_AFTER, "=", retry); } protected static void assertEquals(Object expected, Object actual, Object... msg) { Assert.assertEquals(objectsToString(msg), expected, actual); } @Test public void cancelIntOnResumedTest()throws Exception { suspendResumeTest(); Future cancel = invokeRequest("cancelretry?stage=1", "20"); assertString(cancel, Resource.FALSE); } @Test public void cancelIntOnCanceledTest()throws Exception { cancelVoidTest(); Future cancel = invokeRequest("cancelretry?stage=1", "20"); assertString(cancel, Resource.TRUE); } @Test public void resumeCanceledIntTest()throws Exception { cancelIntTest(); Future resume = invokeRequest("resume?stage=1", ""); assertString(resume, Resource.FALSE); } @Test public void cancelDateTest()throws Exception { long milis = (System.currentTimeMillis() / 1000) * 1000 + 20000; invokeClear(); Future suspend = invokeRequest("suspend"); Future cancel = invokeRequest("canceldate?stage=0", milis); Response response = getResponse(suspend); assertStatus(response, Status.SERVICE_UNAVAILABLE); assertString(cancel, Resource.TRUE); String header = response.getHeaderString(HttpHeaders.RETRY_AFTER); TimeZone timezone = findTimeZoneInDate(header); Date retry = null; try { retry = createDateFormat(timezone).parse(header); } catch (ParseException e) { throw new Exception(e); } assertEquals(new Date(milis), retry, "Unexpected", HttpHeaders.RETRY_AFTER, "header value received", retry.getTime(), "expected", milis); logMsg("Found expected", HttpHeaders.RETRY_AFTER, "=", header); } public static final TimeZone findTimeZoneInDate(String date){ StringBuilder sb = new StringBuilder(); StringBuilder dateBuilder = new StringBuilder(date.trim()).reverse(); int index = 0; char c; while ((c = dateBuilder.charAt(index++)) != ' '){ sb.append(c); } TimeZone timezone = TimeZone.getTimeZone(sb.reverse().toString()); return timezone; } public static final DateFormat createDateFormat(TimeZone timezone){ SimpleDateFormat sdf = new SimpleDateFormat( "EEE, dd MMM yyyy HH:mm:ss z", Locale.US); sdf.setTimeZone(timezone); return sdf; } @Test public void cancelDateOnResumedTest()throws Exception { suspendResumeTest(); Future cancel = invokeRequest("canceldate?stage=1", System.currentTimeMillis()); assertString(cancel, Resource.FALSE); } @Test public void cancelDateOnCanceledTest()throws Exception { cancelVoidTest(); Future cancel = invokeRequest("canceldate?stage=1", System.currentTimeMillis()); assertString(cancel, Resource.TRUE); } @Test public void resumeCanceledDateTest()throws Exception { cancelDateTest(); Future resumeResumed = invokeRequest("resume?stage=1", ""); assertString(resumeResumed, Resource.FALSE); } @Test public void isCanceledWhenCanceledTest()throws Exception { cancelVoidTest(); Future is = invokeRequest("iscanceled?stage=1"); assertString(is, Resource.TRUE); } @Test public void isCanceledWhenSuspendedTest()throws Exception { invokeClear(); invokeRequest("suspend"); Future is = invokeRequest("iscanceled?stage=0"); assertString(is, Resource.FALSE); } @Test public void isCanceledWhenResumedTest()throws Exception { suspendResumeTest(); Future is = invokeRequest("iscanceled?stage=1"); assertString(is, Resource.FALSE); } @Test public void isDoneWhenResumedTest()throws Exception { suspendResumeTest(); Future is = invokeRequest("isdone?stage=1"); assertString(is, Resource.TRUE); } @Test public void isDoneWhenSuspendedTest()throws Exception { invokeClear(); invokeRequest("suspend"); Future is = invokeRequest("isdone?stage=0"); assertString(is, Resource.FALSE); } @Test public void isDoneWhenCanceledTest()throws Exception { cancelVoidTest(); Future is = invokeRequest("isdone?stage=1"); assertString(is, Resource.TRUE); } @Test public void isDoneWhenTimedOutTest()throws Exception { setTimeoutTest(); Future is = invokeRequest("isdone?stage=1"); assertString(is, Resource.TRUE); } @Test public void isSuspendedWhenSuspendedTest()throws Exception { invokeClear(); invokeRequest("suspend"); Future is = invokeRequest("issuspended?stage=0"); assertString(is, Resource.TRUE); } @Test public void isSuspendedWhenCanceledTest()throws Exception { cancelVoidTest(); Future is = invokeRequest("issuspended?stage=1"); assertString(is, Resource.FALSE); } @Test public void isSuspendedWhenResumedTest()throws Exception { suspendResumeTest(); Future is = invokeRequest("issuspended?stage=1"); assertString(is, Resource.FALSE); } @Test public void suspendResumeTest()throws Exception { invokeClear(); String expectedResponse = "Expected response"; Future suspend = invokeRequest("suspend"); Future resume = invokeRequest("resume?stage=0", expectedResponse); assertString(resume, Resource.TRUE); assertString(suspend, expectedResponse); } @Test public void resumeAnyJavaObjectInputStreamTest()throws Exception { invokeClear(); String expectedResponse = "Expected response"; Future suspend = invokeRequest("suspend"); Future resume = invokeRequest("resume?stage=0", new ByteArrayInputStream(expectedResponse.getBytes())); assertString(resume, Resource.TRUE); assertString(suspend, expectedResponse); } @Test public void resumeResumedTest()throws Exception { suspendResumeTest(); // resume & store Future resumeResumed = invokeRequest("resume?stage=1", ""); assertString(resumeResumed, Resource.FALSE); } @Test public void resumeWithCheckedExceptionTest()throws Exception { invokeClear(); Future suspend = invokeRequest("suspend"); Future resume = invokeRequest("resumechecked?stage=0"); assertString(resume, Resource.TRUE); assertException(suspend, IOException.class); } @Test public void resumeWithRuntimeExceptionTest()throws Exception { invokeClear(); Future suspend = invokeRequest("suspend"); Future resume = invokeRequest("resumeruntime?stage=0"); assertString(resume, Resource.TRUE); assertException(suspend, RuntimeException.class); } @Test public void resumeWithExceptionReturnsFalseWhenResumedTest()throws Exception { suspendResumeTest(); Future resume = invokeRequest("resumechecked?stage=1"); assertString(resume, Resource.FALSE); } @Test public void setTimeoutTest()throws Exception { invokeClear(); logMsg("here 1"); Future suspend = invokeRequest("suspend"); logMsg("here 2"); Future setTimeout = invokeRequest("settimeout?stage=0", 200); logMsg("here 3"); assertStatus(getResponse(setTimeout), Status.NO_CONTENT); logMsg("here 4"); // WebApplication exception with 503 is caught by ServiceUnavailableExceptionMapper Response fromMapper = getResponse(suspend); logMsg("here 5"); assertStatus(fromMapper, Status.REQUEST_TIMEOUT); String entity = fromMapper.readEntity(String.class); assertContains(entity, 503); logMsg("Found expected status 503"); } @Test public void updateTimeoutTest()throws Exception { invokeClear(); Future suspend = invokeRequest("suspend"); Future setTimeout = invokeRequest("settimeout?stage=0", 600000); assertStatus(getResponse(setTimeout), Status.NO_CONTENT); assertFalse(suspend.isDone(), "Suspended AsyncResponse already received"); setTimeout = invokeRequest("settimeout?stage=1", 200); assertStatus(getResponse(setTimeout), Status.NO_CONTENT); // WebApplication exception with 503 is caught by ServiceUnavailableExceptionMapper Response fromMapper = getResponse(suspend); assertStatus(fromMapper, Status.REQUEST_TIMEOUT); String entity = fromMapper.readEntity(String.class); assertContains(entity, 503); logMsg("Found expected status 503"); } @Test public void handleTimeOutWaitsForeverTest()throws Exception { String responseMsg = "handleTimeOutWaitsForeverTest"; invokeClear(); Future suspend = invokeRequest("suspend"); Future setTimeout = invokeRequest("timeouthandler?stage=0", 1); Future resume = invokeRequest("resume?stage=1", responseMsg); assertStatus(getResponse(setTimeout), Status.NO_CONTENT); assertString(resume, Resource.TRUE); assertString(suspend, responseMsg); } @Test public void handleTimeoutCancelsTest()throws Exception { invokeClear(); Future suspend = invokeRequest("suspend"); Future setTimeout = invokeRequest("timeouthandler?stage=0", 2); assertStatus(getResponse(setTimeout), Status.NO_CONTENT); assertStatus(getResponse(suspend), Status.SERVICE_UNAVAILABLE); Future resume = invokeRequest("issuspended?stage=1"); assertString(resume, Resource.FALSE); } @Test public void handleTimeoutResumesTest()throws Exception { invokeClear(); Future suspend = invokeRequest("suspend"); Future setTimeout = invokeRequest("timeouthandler?stage=0", 3); assertStatus(getResponse(setTimeout), Status.NO_CONTENT); assertString(suspend, Resource.RESUMED); Future resume = invokeRequest("issuspended?stage=1"); assertString(resume, Resource.FALSE); } protected String getAbsoluteUrl() { return "http://localhost:8080/resource"; } private void invokeClear()throws Exception { Response response = client.target(getAbsoluteUrl()).path("clear").request().get(); Assert.assertEquals(204, response.getStatus()); } private Future invokeRequest(String resource) { AsyncInvoker async = createAsyncInvoker(resource); Future future = async.get(); return future; } private Future invokeRequest(String resource, T entity) { AsyncInvoker async = createAsyncInvoker(resource); Future future = async.post(Entity.entity(entity, MediaType.TEXT_PLAIN_TYPE)); return future; } private WebTarget createWebTarget(String resource) { Client client = ClientBuilder.newClient(); WebTarget target = client.target(getAbsoluteUrl() + "/" + resource); return target; } private AsyncInvoker createAsyncInvoker(String resource) { WebTarget target = createWebTarget(resource); AsyncInvoker async = target.request().async(); return async; } private static Response getResponse(Future future)throws Exception { Response response = future.get(); return response; } private static void assertStatus(Response response, Response.Status status) throws Exception { assertEquals(response.getStatus(), status.getStatusCode(), "Unexpected status code received", response.getStatus(), "expected was", status); logMsg("Found expected status", status); } private static void assertString(Future future, String check) throws Exception { Response response = getResponse(future); assertStatus(response, Status.OK); String content = response.readEntity(String.class); assertEquals(check, content, "Unexpected response content", content); logMsg("Found expected string", check); } private static void assertException(Future future, Class e)throws Exception { String clazz = e.getName(); Response response = getResponse(future); assertStatus(response, Response.Status.NOT_ACCEPTABLE); assertContains(response.readEntity(String.class), clazz, clazz, "not thrown"); logMsg(clazz, "has been thrown as expected"); } public static void assertContains(String string, String substring, Object... message)throws Exception { assertTrue(string.contains(substring), message); } public static void assertContains(T text, T subtext, Object... message) throws Exception { assertContains(text.toString(), subtext.toString(), message); } public static void assertTrue(boolean condition, Object... message) { if (!condition) Assert.fail(objectsToString(message)); } public static void // assertFalse(boolean condition, Object... message)throws Exception { assertTrue(!condition, message); } }JaxrsAsyncTest.java000077500000000000000000000107531225215345600426570ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/async-http-servlet-3.0/async-http-servlet-3.0-test/src/test/java/org/jboss/resteasy/test/asyncpackage org.jboss.resteasy.test.async; import org.junit.Assert; import org.junit.Test; import javax.ws.rs.ForbiddenException; import javax.ws.rs.NotFoundException; import javax.ws.rs.client.Client; import javax.ws.rs.client.ClientBuilder; import javax.ws.rs.core.Response; /** * @author Bill Burke * @version $Revision: 1 $ */ public class JaxrsAsyncTest { @Test public void testInjectionFailure() throws Exception { System.out.println("***INJECTION FAILURE***"); long start = System.currentTimeMillis(); Client client = ClientBuilder.newClient(); Response response = client.target("http://localhost:8080/jaxrs/injection-failure/abcd").request().get(); // exception mapper from another test overrides 503 Assert.assertEquals(Response.Status.NOT_ACCEPTABLE.getStatusCode(), response.getStatus()); Assert.assertTrue(response.readEntity(String.class).contains(NotFoundException.class.getName())); long end = System.currentTimeMillis() - start; Assert.assertTrue(end < 1000); // should take less than 1 second response.close(); client.close(); } @Test public void testMethodFailure() throws Exception { System.out.println("***method FAILURE***"); long start = System.currentTimeMillis(); Client client = ClientBuilder.newClient(); Response response = client.target("http://localhost:8080/jaxrs/method-failure").request().get(); // exception mapper from another test overrides 503 Assert.assertEquals(Response.Status.NOT_ACCEPTABLE.getStatusCode(), response.getStatus()); Assert.assertTrue(response.readEntity(String.class).contains(ForbiddenException.class.getName())); long end = System.currentTimeMillis() - start; Assert.assertTrue(end < 1000); // should take less than 1 second response.close(); client.close(); } @Test public void testAsync() throws Exception { Client client = ClientBuilder.newClient(); long start = System.currentTimeMillis(); Response response = client.target("http://localhost:8080/jaxrs").request().get(); long end = System.currentTimeMillis() - start; Assert.assertEquals(200, response.getStatus()); Assert.assertEquals("hello", response.readEntity(String.class)); Assert.assertTrue(end < 1000); // should take less than 1 second response.close(); client.close(); } @Test public void testTimeout() throws Exception { Client client = ClientBuilder.newClient(); Response response = client.target("http://localhost:8080/jaxrs/timeout").request().get(); Assert.assertEquals(408, response.getStatus()); // exception mapper from another test overrides 503 to 408 response.close(); client.close(); } @Test public void testCancel() throws Exception { Client client = ClientBuilder.newClient(); Response response = client.target("http://localhost:8080/jaxrs/cancel").request().get(); Assert.assertEquals(503, response.getStatus()); response.close(); response = client.target("http://localhost:8080/jaxrs/cancelled").request().get(); Assert.assertEquals(204, response.getStatus()); response.close(); client.close(); } @Test public void testResumeObject() throws Exception { Client client = ClientBuilder.newClient(); long start = System.currentTimeMillis(); Response response = client.target("http://localhost:8080/jaxrs/resume/object").request().get(); long end = System.currentTimeMillis() - start; Assert.assertEquals(200, response.getStatus()); Assert.assertEquals("bill", response.readEntity(XmlData.class).getName()); Assert.assertTrue(end < 1000); // should take less than 1 second response.close(); client.close(); } @Test public void testResumeObjectThread() throws Exception { Client client = ClientBuilder.newClient(); long start = System.currentTimeMillis(); Response response = client.target("http://localhost:8080/jaxrs/resume/object/thread").request().get(); long end = System.currentTimeMillis() - start; Assert.assertEquals(200, response.getStatus()); Assert.assertEquals("bill", response.readEntity(XmlData.class).getName()); Assert.assertTrue(end < 1000); // should take less than 1 second response.close(); client.close(); } } Resteasy-3.0.6.Final/jaxrs/async-http-servlet-3.0/async-http-servlet-3.0-test/src/test/resources/000077500000000000000000000000001225215345600323645ustar00rootroot00000000000000jndi.properties000066400000000000000000000002621225215345600353470ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/async-http-servlet-3.0/async-http-servlet-3.0-test/src/test/resourcesjava.naming.factory.initial=org.jnp.interfaces.NamingContextFactory java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces java.naming.provider.url=jnp://localhost:1099log4j.xml000066400000000000000000000047141225215345600340540ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/async-http-servlet-3.0/async-http-servlet-3.0-test/src/test/resources Resteasy-3.0.6.Final/jaxrs/async-http-servlet-3.0/async-http-servlet-3.0/000077500000000000000000000000001225215345600256275ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/async-http-servlet-3.0/async-http-servlet-3.0/pom.xml000077500000000000000000000030221225215345600271440ustar00rootroot00000000000000 4.0.0 org.jboss.resteasy resteasy-jaxrs-all 3.0.6.Final ../../pom.xml async-http-servlet-3.0 jar Async Http Servlet 3.0 org.jboss.resteasy resteasy-jaxrs ${project.version} provided org.jboss.spec.javax.servlet jboss-servlet-api_3.0_spec 1.0.1.Final provided org.apache.maven.plugins maven-compiler-plugin 1.6 1.6 Resteasy-3.0.6.Final/jaxrs/async-http-servlet-3.0/async-http-servlet-3.0/src/000077500000000000000000000000001225215345600264165ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/async-http-servlet-3.0/async-http-servlet-3.0/src/main/000077500000000000000000000000001225215345600273425ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/async-http-servlet-3.0/async-http-servlet-3.0/src/main/java/000077500000000000000000000000001225215345600302635ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/async-http-servlet-3.0/async-http-servlet-3.0/src/main/java/org/000077500000000000000000000000001225215345600310525ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/async-http-servlet-3.0/async-http-servlet-3.0/src/main/java/org/jboss/000077500000000000000000000000001225215345600321725ustar00rootroot00000000000000000077500000000000000000000000001225215345600337525ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/async-http-servlet-3.0/async-http-servlet-3.0/src/main/java/org/jboss/resteasy000077500000000000000000000000001225215345600354335ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/async-http-servlet-3.0/async-http-servlet-3.0/src/main/java/org/jboss/resteasy/plugins000077500000000000000000000000001225215345600367415ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/async-http-servlet-3.0/async-http-servlet-3.0/src/main/java/org/jboss/resteasy/plugins/server000077500000000000000000000000001225215345600404255ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/async-http-servlet-3.0/async-http-servlet-3.0/src/main/java/org/jboss/resteasy/plugins/server/servletFilter30Dispatcher.java000077500000000000000000000026551225215345600447020ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/async-http-servlet-3.0/async-http-servlet-3.0/src/main/java/org/jboss/resteasy/plugins/server/servletpackage org.jboss.resteasy.plugins.server.servlet; import org.jboss.resteasy.core.SynchronousDispatcher; import org.jboss.resteasy.specimpl.ResteasyHttpHeaders; import org.jboss.resteasy.spi.HttpRequest; import org.jboss.resteasy.spi.HttpResponse; import org.jboss.resteasy.spi.ResteasyUriInfo; import javax.servlet.annotation.WebFilter; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.util.concurrent.Executors; import java.util.concurrent.ScheduledExecutorService; /** * @author Bill Burke * @version $Revision: 1 $ */ @WebFilter(asyncSupported = true) public class Filter30Dispatcher extends FilterDispatcher { ScheduledExecutorService asyncCancelScheduler = Executors.newScheduledThreadPool(0); // this is to get around TCK tests that call setTimeout in a separate thread which is illegal. @Override public HttpRequest createResteasyHttpRequest(String httpMethod, HttpServletRequest httpServletRequest, ResteasyHttpHeaders httpHeaders, ResteasyUriInfo uriInfo, HttpResponse httpResponse, HttpServletResponse httpServletResponse) { Servlet3AsyncHttpRequest request = new Servlet3AsyncHttpRequest(httpServletRequest, httpServletResponse, servletContext, httpResponse, httpHeaders, uriInfo, httpMethod, (SynchronousDispatcher) getDispatcher()); request.asyncScheduler = asyncCancelScheduler; return request; } } HttpServlet30Dispatcher.java000077500000000000000000000026711225215345600457370ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/async-http-servlet-3.0/async-http-servlet-3.0/src/main/java/org/jboss/resteasy/plugins/server/servletpackage org.jboss.resteasy.plugins.server.servlet; import org.jboss.resteasy.core.SynchronousDispatcher; import org.jboss.resteasy.specimpl.ResteasyHttpHeaders; import org.jboss.resteasy.spi.HttpRequest; import org.jboss.resteasy.spi.HttpResponse; import org.jboss.resteasy.spi.ResteasyUriInfo; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.util.concurrent.Executors; import java.util.concurrent.ScheduledExecutorService; /** * @author Bill Burke * @version $Revision: 1 $ */ @WebServlet(asyncSupported = true) public class HttpServlet30Dispatcher extends HttpServletDispatcher { ScheduledExecutorService asyncCancelScheduler = Executors.newScheduledThreadPool(0); // this is to get around TCK tests that call setTimeout in a separate thread which is illegal. @Override protected HttpRequest createHttpRequest(String httpMethod, HttpServletRequest httpServletRequest, ResteasyHttpHeaders httpHeaders, ResteasyUriInfo uriInfo, HttpResponse httpResponse, HttpServletResponse httpServletResponse) { Servlet3AsyncHttpRequest request = new Servlet3AsyncHttpRequest(httpServletRequest, httpServletResponse, getServletContext(), httpResponse, httpHeaders, uriInfo, httpMethod, (SynchronousDispatcher) getDispatcher()); request.asyncScheduler = asyncCancelScheduler; return request; } } Servlet3AsyncHttpRequest.java000077500000000000000000000273351225215345600462230ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/async-http-servlet-3.0/async-http-servlet-3.0/src/main/java/org/jboss/resteasy/plugins/server/servletpackage org.jboss.resteasy.plugins.server.servlet; import org.jboss.resteasy.core.AbstractAsynchronousResponse; import org.jboss.resteasy.core.AbstractExecutionContext; import org.jboss.resteasy.core.SynchronousDispatcher; import org.jboss.resteasy.logging.Logger; import org.jboss.resteasy.specimpl.ResteasyHttpHeaders; import org.jboss.resteasy.spi.HttpResponse; import org.jboss.resteasy.spi.ResteasyAsynchronousContext; import org.jboss.resteasy.spi.ResteasyAsynchronousResponse; import org.jboss.resteasy.spi.ResteasyUriInfo; import org.jboss.resteasy.spi.UnhandledException; import javax.servlet.AsyncContext; import javax.servlet.AsyncEvent; import javax.servlet.AsyncListener; import javax.servlet.ServletContext; import javax.servlet.ServletRequest; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.ws.rs.ServiceUnavailableException; import javax.ws.rs.container.AsyncResponse; import javax.ws.rs.container.TimeoutHandler; import javax.ws.rs.core.HttpHeaders; import javax.ws.rs.core.Response; import java.io.IOException; import java.lang.ref.WeakReference; import java.util.Date; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.ScheduledFuture; import java.util.concurrent.TimeUnit; /** * @author Bill Burke * @version $Revision: 1 $ */ public class Servlet3AsyncHttpRequest extends HttpServletInputMessage { private final static Logger logger = Logger.getLogger(Servlet3AsyncHttpRequest.class); protected HttpServletResponse response; protected ResteasyAsynchronousContext asynchronousContext; protected ScheduledExecutorService asyncScheduler; // this is to get around TCK tests that call setTimeout in a separate thread which is illegal. public Servlet3AsyncHttpRequest(HttpServletRequest httpServletRequest, HttpServletResponse response, ServletContext servletContext, HttpResponse httpResponse, ResteasyHttpHeaders httpHeaders, ResteasyUriInfo uriInfo, String s, SynchronousDispatcher synchronousDispatcher) { super(httpServletRequest, response, servletContext, httpResponse, httpHeaders, uriInfo, s, synchronousDispatcher); this.response = response; asynchronousContext = new Servlet3ExecutionContext((ServletRequest) httpServletRequest); } @Override public ResteasyAsynchronousContext getAsyncContext() { return asynchronousContext; } private class Servlet3ExecutionContext extends AbstractExecutionContext { protected final ServletRequest servletRequest; protected volatile boolean done; protected volatile boolean cancelled; protected volatile boolean wasSuspended; protected Servle3AsychronousResponse asynchronousResponse; public Servlet3ExecutionContext(ServletRequest servletRequest) { super(Servlet3AsyncHttpRequest.this.dispatcher, Servlet3AsyncHttpRequest.this, Servlet3AsyncHttpRequest.this.httpResponse); this.servletRequest = servletRequest; } private class Servle3AsychronousResponse extends AbstractAsynchronousResponse implements AsyncListener { private Object responseLock = new Object(); protected WeakReference creatingThread = new WeakReference(Thread.currentThread()); protected ScheduledFuture timeoutFuture; // this is to get around TCK tests that call setTimeout in a separate thread which is illegal. private Servle3AsychronousResponse() { super(Servlet3ExecutionContext.this.dispatcher, Servlet3ExecutionContext.this.request, Servlet3ExecutionContext.this.response); } @Override public boolean resume(Object entity) { synchronized (responseLock) { if (done) return false; if (cancelled) return false; AsyncContext asyncContext = getAsyncContext(); try { return internalResume(entity); } finally { done = true; asyncContext.complete(); } } } @Override public boolean resume(Throwable exc) { synchronized (responseLock) { if (done) return false; if (cancelled) return false; AsyncContext asyncContext = getAsyncContext(); try { return internalResume(exc); } catch (UnhandledException unhandled) { return internalResume(Response.status(500).build()); } finally { done = true; asyncContext.complete(); } } } @Override public void initialRequestThreadFinished() { // done } @Override public boolean setTimeout(long time, TimeUnit unit) throws IllegalStateException { synchronized (responseLock) { if (done || cancelled) return false; Thread thread = creatingThread.get(); if (thread != null && thread != Thread.currentThread()) { // this is to get around TCK tests that call setTimeout in a separate thread which is illegal. if (timeoutFuture != null && !timeoutFuture.cancel(false)) { return false; } Runnable task = new Runnable() { @Override public void run() { logger.debug("scheduled timeout"); handleTimeout(); } }; logger.debug("scheduling timeout"); timeoutFuture = asyncScheduler.schedule(task, time, unit); } else { AsyncContext asyncContext = getAsyncContext(); long l = unit.toMillis(time); asyncContext.setTimeout(l); } } return true; } @Override public boolean cancel() { logger.debug("cancel()"); synchronized (responseLock) { if (cancelled) { logger.debug("-- already canceled"); return true; } if (done) { logger.debug("-- already done"); return false; } done = true; cancelled = true; AsyncContext asyncContext = getAsyncContext(); try { logger.debug("-- cancelling with 503"); return internalResume(Response.status(Response.Status.SERVICE_UNAVAILABLE).build()); } finally { asyncContext.complete(); } } } @Override public boolean cancel(int retryAfter) { synchronized (responseLock) { if (cancelled) return true; if (done) return false; done = true; cancelled = true; AsyncContext asyncContext = getAsyncContext(); try { return internalResume(Response.status(Response.Status.SERVICE_UNAVAILABLE).header(HttpHeaders.RETRY_AFTER, retryAfter).build()); } finally { asyncContext.complete(); } } } @Override public boolean cancel(Date retryAfter) { synchronized (responseLock) { if (cancelled) return true; if (done) return false; done = true; cancelled = true; AsyncContext asyncContext = getAsyncContext(); try { return internalResume(Response.status(Response.Status.SERVICE_UNAVAILABLE).header(HttpHeaders.RETRY_AFTER, retryAfter).build()); } finally { asyncContext.complete(); } } } @Override public boolean isCancelled() { return cancelled; } @Override public boolean isDone() { return done; } @Override public boolean isSuspended() { return !done && !cancelled; } @Override public void onComplete(AsyncEvent asyncEvent) throws IOException { logger.debug("onComplete"); synchronized (responseLock) { done = true; } } @Override public void onTimeout(AsyncEvent asyncEvent) throws IOException { logger.debug("onTimeout"); synchronized (responseLock) { if (done || cancelled) return; response.reset(); handleTimeout(); } } protected void handleTimeout() { if (timeoutHandler != null) { timeoutHandler.handleTimeout(this); } if (done) return; resume(new ServiceUnavailableException()); } @Override public void onError(AsyncEvent asyncEvent) throws IOException { synchronized (responseLock) { cancelled = true; done = true; } } @Override public void onStartAsync(AsyncEvent asyncEvent) throws IOException { } } @Override public ResteasyAsynchronousResponse getAsyncResponse() { return asynchronousResponse; } @Override public ResteasyAsynchronousResponse suspend() throws IllegalStateException { return suspend(-1); } @Override public ResteasyAsynchronousResponse suspend(long millis) throws IllegalStateException { return suspend(millis, TimeUnit.MILLISECONDS); } @Override public ResteasyAsynchronousResponse suspend(long time, TimeUnit unit) throws IllegalStateException { AsyncContext asyncContext = setupAsyncContext(); asyncContext.setTimeout(unit.toMillis(time)); return asynchronousResponse; } protected AsyncContext setupAsyncContext() { if (servletRequest.isAsyncStarted()) { throw new IllegalStateException("Already suspended"); } asynchronousResponse = new Servle3AsychronousResponse(); AsyncContext asyncContext = servletRequest.startAsync(); asyncContext.addListener(asynchronousResponse); wasSuspended = true; return asyncContext; } private AsyncContext getAsyncContext() { AsyncContext asyncContext = servletRequest.getAsyncContext(); if (asyncContext == null) { throw new IllegalStateException("Request not suspended"); } return asyncContext; } @Override public boolean isSuspended() { return wasSuspended; } } } Resteasy-3.0.6.Final/jaxrs/async-http-servlet-3.0/callback-test/000077500000000000000000000000001225215345600242665ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/async-http-servlet-3.0/callback-test/pom.xml000077500000000000000000000110311225215345600256020ustar00rootroot00000000000000 org.jboss.resteasy resteasy-jaxrs-all 3.0.6.Final ../../pom.xml 4.0.0 callback-tests war Callback Tests org.jboss.resteasy resteasy-jaxrs ${project.version} org.jboss.resteasy resteasy-client ${project.version} org.jboss.resteasy resteasy-jaxb-provider ${project.version} org.jboss.resteasy async-http-servlet-3.0 ${project.version} junit junit commons-httpclient commons-httpclient 3.1 test org.apache.maven.plugins maven-deploy-plugin true org.mortbay.jetty jetty-maven-plugin 8.1.11.v20130520 / 10 foo 9999 start-jetty pre-integration-test run 0 true stop-jetty post-integration-test stop org.apache.maven.plugins maven-surefire-plugin true surefire-it integration-test test false org.apache.maven.plugins maven-compiler-plugin 1.6 1.6 Resteasy-3.0.6.Final/jaxrs/async-http-servlet-3.0/callback-test/src/000077500000000000000000000000001225215345600250555ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/async-http-servlet-3.0/callback-test/src/main/000077500000000000000000000000001225215345600260015ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/async-http-servlet-3.0/callback-test/src/main/java/000077500000000000000000000000001225215345600267225ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/async-http-servlet-3.0/callback-test/src/main/java/org/000077500000000000000000000000001225215345600275115ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/async-http-servlet-3.0/callback-test/src/main/java/org/jboss/000077500000000000000000000000001225215345600306315ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/async-http-servlet-3.0/callback-test/src/main/java/org/jboss/resteasy/000077500000000000000000000000001225215345600324705ustar00rootroot00000000000000000077500000000000000000000000001225215345600333705ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/async-http-servlet-3.0/callback-test/src/main/java/org/jboss/resteasy/test000077500000000000000000000000001225215345600345055ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/async-http-servlet-3.0/callback-test/src/main/java/org/jboss/resteasy/test/async000077500000000000000000000000001225215345600362415ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/async-http-servlet-3.0/callback-test/src/main/java/org/jboss/resteasy/test/async/callbackAsyncResponseBlockingQueue.java000077500000000000000000000006171225215345600443650ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/async-http-servlet-3.0/callback-test/src/main/java/org/jboss/resteasy/test/async/callbackpackage org.jboss.resteasy.test.async.callback; import java.util.concurrent.ArrayBlockingQueue; import javax.ws.rs.container.AsyncResponse; public class AsyncResponseBlockingQueue extends ArrayBlockingQueue { private static final long serialVersionUID = -2445906740359075621L; public AsyncResponseBlockingQueue(int capacity) { super(capacity); } } CallbackResource.java000077500000000000000000000131141225215345600423130ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/async-http-servlet-3.0/callback-test/src/main/java/org/jboss/resteasy/test/async/callbackpackage org.jboss.resteasy.test.async.callback; import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.QueryParam; import javax.ws.rs.container.AsyncResponse; @Path("resource") public class CallbackResource extends Resource { @GET @Path("register") public String registerObject(@QueryParam("stage") String stage) { AsyncResponse async = takeAsyncResponse(stage); boolean b = async.register(new SettingCompletionCallback()).isEmpty(); addResponse(async, stage); return b ? TRUE : FALSE; } @GET @Path("registerclass") public String registerClass(@QueryParam("stage") String stage) { AsyncResponse async = takeAsyncResponse(stage); boolean b = async.register(SettingCompletionCallback.class).isEmpty(); addResponse(async, stage); return b ? TRUE : FALSE; } @GET @Path("registerobjects") public String registerObjectObject(@QueryParam("stage") String stage) { AsyncResponse async = takeAsyncResponse(stage); boolean b = async.register(new SettingCompletionCallback(), new SecondSettingCompletionCallback()).isEmpty(); addResponse(async, stage); return b ? TRUE : FALSE; } @GET @Path("registerclasses") public String registerClasses(@QueryParam("stage") String stage) { AsyncResponse async = takeAsyncResponse(stage); boolean b = async.register(SettingCompletionCallback.class, SecondSettingCompletionCallback.class).isEmpty(); addResponse(async, stage); return b ? TRUE : FALSE; } @GET @Path("registerthrows") public String registerObjectThrowsNpe(@QueryParam("stage") String stage) { AsyncResponse async = takeAsyncResponse(stage); try { SettingCompletionCallback callback = null; async.register(callback); } catch (NullPointerException e) { return TRUE; } catch (Exception e) { return "Threw " + e.getClass().getName(); } return FALSE; } @GET @Path("registerclassthrows") public String registerClassThrowsNpe(@QueryParam("stage") String stage) { AsyncResponse async = takeAsyncResponse(stage); try { Class callback = null; async.register(callback); } catch (NullPointerException e) { return TRUE; } catch (Exception e) { return "Threw " + e.getClass().getName(); } return FALSE; } @GET @Path("registerobjectsthrows1") public String registerObjectsThrowsNpe1(@QueryParam("stage") String stage) { AsyncResponse async = takeAsyncResponse(stage); try { SettingCompletionCallback callback = null; async.register(callback, new SecondSettingCompletionCallback()); } catch (NullPointerException e) { return TRUE; } catch (Exception e) { return "Threw " + e.getClass().getName(); } return FALSE; } @GET @Path("registerobjectsthrows2") public String registerObjectsThrowsNpe2(@QueryParam("stage") String stage) { AsyncResponse async = takeAsyncResponse(stage); try { SecondSettingCompletionCallback callback = null; async.register(new SettingCompletionCallback(), callback); } catch (NullPointerException e) { return TRUE; } catch (Exception e) { return "Threw " + e.getClass().getName(); } return FALSE; } @GET @Path("registerclassesthrows1") public String registerClassesThrowsNpe1(@QueryParam("stage") String stage) { AsyncResponse async = takeAsyncResponse(stage); try { Class callback = null; async.register(callback, SecondSettingCompletionCallback.class); } catch (NullPointerException e) { return TRUE; } catch (Exception e) { return "Threw " + e.getClass().getName(); } return FALSE; } @GET @Path("registerclassesthrows2") public String registerClassesThrowsNpe2(@QueryParam("stage") String stage) { AsyncResponse async = takeAsyncResponse(stage); try { Class callback = null; async.register(SettingCompletionCallback.class, callback); } catch (NullPointerException e) { return TRUE; } catch (Exception e) { return "Threw " + e.getClass().getName(); } return FALSE; } @GET @Path("exception") public String throwExceptionOnAsyncResponse( @QueryParam("stage") String stage) { System.out.println("********throwExceptionOnAsyncResponse"); AsyncResponse async = takeAsyncResponse(stage); System.out.println("*****async is not null: " + async); boolean b = async.resume(new ExceptionThrowingStringBean( "throw exception")); addResponse(async, stage); return b ? TRUE : FALSE; } @GET @Path("error") public String getErrorValue() { String name = SettingCompletionCallback.getLastThrowableName(); return name; } @GET @Path("seconderror") public String getSecondErrorValue() { String name = SecondSettingCompletionCallback.getLastThrowableName(); return name; } @GET @Path("reset") public void resetErrorValue() { SettingCompletionCallback.resetLastThrowableName(); SecondSettingCompletionCallback.resetLastThrowableName(); } // //////////////////////////////////////////////////////////////////////// } ExceptionThrowingStringBean.java000077500000000000000000000005351225215345600445470ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/async-http-servlet-3.0/callback-test/src/main/java/org/jboss/resteasy/test/async/callbackpackage org.jboss.resteasy.test.async.callback; import java.io.IOException; public class ExceptionThrowingStringBean extends StringBean { public ExceptionThrowingStringBean(String header) { super(header); } @Override public String get() { throw new RuntimeException(new IOException(super.get())); } } JaxrsUtil.java000077500000000000000000000061271225215345600410420ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/async-http-servlet-3.0/callback-test/src/main/java/org/jboss/resteasy/test/async/callbackpackage org.jboss.resteasy.test.async.callback; import java.io.BufferedReader; import java.io.File; import java.io.FileReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.Reader; import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Enumeration; import java.util.Iterator; import java.util.Locale; import java.util.TimeZone; public abstract class JaxrsUtil { public static final// String readFromStream(InputStream stream) throws IOException { InputStreamReader isr = new InputStreamReader(stream); return readFromReader(isr); } public static final// String readFromReader(Reader reader) throws IOException { BufferedReader br = new BufferedReader(reader); String entity = br.readLine(); br.close(); return entity; } public static final// String readFromFile(File file) throws IOException { FileReader reader = new FileReader(file); return readFromReader(reader); } public static final // String iterableToString(String separator, Iterable collection) { if (collection != null) return iterableToString(separator, collection.iterator()); return ""; } public static final // String iterableToString(String separator, Iterator iterator) { StringBuilder sb = new StringBuilder(); while (iterator.hasNext()) { T item = iterator.next(); if (item != null) { String appendable = item.toString(); sb.append(appendable); if (iterator.hasNext()) sb.append(separator); } } return sb.toString(); } public static final // String enumerationToString(String separator, Enumeration enumeration) { StringBuilder sb = new StringBuilder(); if (enumeration != null) while (enumeration.hasMoreElements()) { T item = enumeration.nextElement(); if (item != null) { String appendable = item.toString(); sb.append(appendable); if (enumeration.hasMoreElements()) sb.append(separator); } } return sb.toString(); } public static final // String iterableToString(String separator, T... collection) { StringBuilder sb = new StringBuilder(); if (collection != null) for (int i = 0; i != collection.length; i++) { T item = collection[i]; if (item != null) { String appendable = item.toString(); sb.append(appendable); if (i != collection.length - 1) sb.append(separator); } } return sb.toString(); } public static final TimeZone findTimeZoneInDate(String date){ StringBuilder sb = new StringBuilder(); StringBuilder dateBuilder = new StringBuilder(date.trim()).reverse(); int index = 0; char c; while ((c = dateBuilder.charAt(index++)) != ' '){ sb.append(c); } TimeZone timezone = TimeZone.getTimeZone(sb.reverse().toString()); return timezone; } public static final DateFormat createDateFormat(TimeZone timezone){ SimpleDateFormat sdf = new SimpleDateFormat( "EEE, dd MMM yyyy HH:mm:ss z", Locale.US); sdf.setTimeZone(timezone); return sdf; } } MyApp.java000077500000000000000000000006661225215345600401450ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/async-http-servlet-3.0/callback-test/src/main/java/org/jboss/resteasy/test/async/callbackpackage org.jboss.resteasy.test.async.callback; import javax.ws.rs.core.Application; import java.util.HashSet; import java.util.Set; public class MyApp extends Application { public java.util.Set> getClasses() { Set> resources = new HashSet>(); resources.add(CallbackResource.class); resources.add(StringBeanEntityProvider.class); return resources; } } MyTimeoutHandler.java000077500000000000000000000014041225215345600423400ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/async-http-servlet-3.0/callback-test/src/main/java/org/jboss/resteasy/test/async/callbackpackage org.jboss.resteasy.test.async.callback; import java.util.concurrent.TimeUnit; import javax.ws.rs.container.AsyncResponse; import javax.ws.rs.container.TimeoutHandler; public class MyTimeoutHandler implements TimeoutHandler { private int function = 0; public MyTimeoutHandler(int function) { super(); this.function = function; } @Override public void handleTimeout(AsyncResponse asyncResponse) { switch (function) { case 1: asyncResponse.setTimeout(200, TimeUnit.MILLISECONDS); break; case 2: asyncResponse.cancel(); break; case 3: asyncResponse.resume(Resource.RESUMED); break; } } } Resource.java000077500000000000000000000144221225215345600407010ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/async-http-servlet-3.0/callback-test/src/main/java/org/jboss/resteasy/test/async/callbackpackage org.jboss.resteasy.test.async.callback; import java.io.IOException; import java.util.Date; import java.util.concurrent.TimeUnit; import javax.ws.rs.GET; import javax.ws.rs.POST; import javax.ws.rs.Path; import javax.ws.rs.QueryParam; import javax.ws.rs.WebApplicationException; import javax.ws.rs.container.AsyncResponse; import javax.ws.rs.container.Suspended; import javax.ws.rs.core.Response; import javax.ws.rs.core.Response.ResponseBuilder; import javax.ws.rs.core.Response.Status; @Path("resource") public class Resource { public static final String RESUMED = "Response resumed"; public static final String ISE = "Illegal State Exception Thrown"; public static final String NOE = "No Exception Thrown"; public static final String FALSE = "A method returned false"; public static final String TRUE = "A method return true"; // private static final AsyncResponseBlockingQueue[] stage = { new AsyncResponseBlockingQueue(1), new AsyncResponseBlockingQueue(1), new AsyncResponseBlockingQueue(1)}; @GET @Path("suspend") public void suspend(@Suspended AsyncResponse asyncResponse) { stage[0].add(asyncResponse); } @GET @Path("clear") public void clear() { for (int i = 0; i != stage.length; i++) stage[i].clear(); } @GET @Path("cancelvoid") public String cancel(@QueryParam("stage") String stage) { AsyncResponse response = takeAsyncResponse(stage); boolean ret = response.cancel(); // Invoking a cancel(...) method multiple times to cancel request // processing has the same effect as canceling the request processing // only once. ret &= response.cancel(); addResponse(response, stage); return ret ? TRUE : FALSE; } @POST @Path("cancelretry") public String cancelretry(@QueryParam("stage") String stage, String sRetryAfter) { AsyncResponse response = takeAsyncResponse(stage); int retryAfter = Integer.parseInt(sRetryAfter); boolean b = response.cancel(retryAfter); // Invoking a cancel(...) method multiple times to cancel request // processing has the same effect as canceling the request processing // only once. b &= response.cancel(retryAfter * 2); addResponse(response, stage); return b ? TRUE : FALSE; } @POST @Path("canceldate") public String cancelDate(@QueryParam("stage") String stage, String sRetryAfter) { AsyncResponse response = takeAsyncResponse(stage); long retryAfter = Long.parseLong(sRetryAfter); boolean b = response.cancel(new Date(retryAfter)); b &= response.cancel(new Date(retryAfter + 20000)); addResponse(response, stage); return b ? TRUE : FALSE; } @GET @Path("iscanceled") public String isCanceled(@QueryParam("stage") String stage) { AsyncResponse response = takeAsyncResponse(stage); boolean is = response.isCancelled(); addResponse(response, stage); return is ? TRUE : FALSE; } @GET @Path("isdone") public String isDone(@QueryParam("stage") String stage) { AsyncResponse response = takeAsyncResponse(stage); boolean is = response.isDone(); addResponse(response, stage); return is ? TRUE : FALSE; } @GET @Path("issuspended") public String isSuspended(@QueryParam("stage") String stage) { AsyncResponse response = takeAsyncResponse(stage); boolean is = response.isSuspended(); addResponse(response, stage); return is ? TRUE : FALSE; } @POST @Path("resume") public String resume(@QueryParam("stage") String stage, String response) { AsyncResponse async = takeAsyncResponse(stage); boolean b = resume(async, response); addResponse(async, stage); return b ? TRUE : FALSE; } @GET @Path("resumechecked") public String resumeWithCheckedException(@QueryParam("stage") String stage) { AsyncResponse async = takeAsyncResponse(stage); boolean b = async.resume(new IOException(RESUMED)); addResponse(async, stage); return b ? TRUE : FALSE; } @GET @Path("resumeruntime") public String resumeWithRuntimeException(@QueryParam("stage") String stage) { AsyncResponse async = takeAsyncResponse(stage); boolean b = async.resume(new RuntimeException(RESUMED)); addResponse(async, stage); return b ? TRUE : FALSE; } @POST @Path("settimeout") public void setTimeOut(@QueryParam("stage") String stage, String milis) { AsyncResponse async = takeAsyncResponse(stage); async.setTimeout(Long.parseLong(milis), TimeUnit.MILLISECONDS); addResponse(async, stage); } @POST @Path("timeouthandler") public void setTimeoutHandler(@QueryParam("stage") String stage, int handlerValue){ MyTimeoutHandler handler = new MyTimeoutHandler(handlerValue); AsyncResponse async = takeAsyncResponse(stage); async.setTimeoutHandler(handler); async.setTimeout(200L, TimeUnit.MILLISECONDS); addResponse(async, stage); } // //////////////////////////////////////////////////////////////////////// protected static AsyncResponse takeAsyncResponse(String stageId) { return takeAsyncResponse(Integer.parseInt(stageId)); } protected static AsyncResponse takeAsyncResponse(int stageId) { final ResponseBuilder error = createErrorResponseBuilder(); AsyncResponse asyncResponse = null; try { asyncResponse = stage[stageId].take(); } catch (InterruptedException e) { throw new WebApplicationException(error.entity( "ArrayBlockingQueue#take").build()); } return asyncResponse; } protected static final void addResponse(AsyncResponse response, String stageId) { int id = Integer.parseInt(stageId) + 1; if (id != stage.length) stage[id].add(response); } protected static boolean resume(AsyncResponse takenResponse, Object response) { return takenResponse.resume(response); } protected static ResponseBuilder createErrorResponseBuilder() { return Response.status(Status.EXPECTATION_FAILED); } } SecondSettingCompletionCallback.java000077500000000000000000000016441225215345600453340ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/async-http-servlet-3.0/callback-test/src/main/java/org/jboss/resteasy/test/async/callbackpackage org.jboss.resteasy.test.async.callback; import javax.ws.rs.container.CompletionCallback; public class SecondSettingCompletionCallback implements CompletionCallback { private static String throwableName; public static final String NULL = "NULL"; public static final String OUTOFORDER = "SecondSettingCompletionCallback is not second"; public static final String NONAME = "No name has been set yet"; @Override public void onComplete(Throwable throwable) { throwableName = throwable == null ? NULL : throwable.getClass() .getName(); if (!SettingCompletionCallback.getLastThrowableName().equals(throwableName)) throwableName = throwableName + OUTOFORDER; } public static final String getLastThrowableName() { return throwableName; } public static final void resetLastThrowableName() { throwableName = NONAME; } } SettingCompletionCallback.java000077500000000000000000000012671225215345600442010ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/async-http-servlet-3.0/callback-test/src/main/java/org/jboss/resteasy/test/async/callbackpackage org.jboss.resteasy.test.async.callback; import javax.ws.rs.container.CompletionCallback; public class SettingCompletionCallback implements CompletionCallback { private static String throwableName; public static final String NULL = "NULL"; public static final String NONAME = "No name has been set yet"; @Override public void onComplete(Throwable throwable) { throwableName = throwable == null ? NULL : throwable.getClass() .getName(); } public static final String getLastThrowableName() { return throwableName; } public static final void resetLastThrowableName() { throwableName = NONAME; } } StringBean.java000077500000000000000000000007061225215345600411460ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/async-http-servlet-3.0/callback-test/src/main/java/org/jboss/resteasy/test/async/callbackpackage org.jboss.resteasy.test.async.callback; public class StringBean { private String header; public String get() { return header; } public void set(String header) { this.header = header; } @Override public String toString() { return "StringBean. To get a value, use rather #get() method."; } public StringBean(String header) { super(); this.header = header; } } StringBeanEntityProvider.java000077500000000000000000000040651225215345600440600ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/async-http-servlet-3.0/callback-test/src/main/java/org/jboss/resteasy/test/async/callbackpackage org.jboss.resteasy.test.async.callback; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.lang.annotation.Annotation; import java.lang.reflect.Type; import javax.ws.rs.WebApplicationException; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.MultivaluedMap; import javax.ws.rs.ext.MessageBodyReader; import javax.ws.rs.ext.MessageBodyWriter; import javax.ws.rs.ext.Provider; @Provider public class StringBeanEntityProvider implements MessageBodyReader, MessageBodyWriter { @Override public boolean isWriteable(Class type, Type genericType, Annotation[] annotations, MediaType mediaType) { return StringBean.class.isAssignableFrom(type); } @Override public long getSize(StringBean t, Class type, Type genericType, Annotation[] annotations, MediaType mediaType) { return t.get().length(); } @Override public void writeTo(StringBean t, Class type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap httpHeaders, OutputStream entityStream) throws IOException, WebApplicationException { entityStream.write(t.get().getBytes()); } @Override public boolean isReadable(Class type, Type genericType, Annotation[] annotations, MediaType mediaType) { return isWriteable(type, genericType, annotations, mediaType); } @Override public StringBean readFrom(Class type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap httpHeaders, InputStream entityStream) throws IOException, WebApplicationException { String stream = JaxrsUtil.readFromStream(entityStream); StringBean bean = new StringBean(stream); return bean; } } Resteasy-3.0.6.Final/jaxrs/async-http-servlet-3.0/callback-test/src/main/webapp/000077500000000000000000000000001225215345600272575ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/async-http-servlet-3.0/callback-test/src/main/webapp/WEB-INF/000077500000000000000000000000001225215345600303065ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/async-http-servlet-3.0/callback-test/src/main/webapp/WEB-INF/web.xml000077500000000000000000000015151225215345600316120ustar00rootroot00000000000000 Resteasy org.jboss.resteasy.plugins.server.servlet.HttpServlet30Dispatcher javax.ws.rs.Application org.jboss.resteasy.test.async.callback.MyApp true Resteasy /* Resteasy-3.0.6.Final/jaxrs/async-http-servlet-3.0/callback-test/src/test/000077500000000000000000000000001225215345600260345ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/async-http-servlet-3.0/callback-test/src/test/java/000077500000000000000000000000001225215345600267555ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/async-http-servlet-3.0/callback-test/src/test/java/org/000077500000000000000000000000001225215345600275445ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/async-http-servlet-3.0/callback-test/src/test/java/org/jboss/000077500000000000000000000000001225215345600306645ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/async-http-servlet-3.0/callback-test/src/test/java/org/jboss/resteasy/000077500000000000000000000000001225215345600325235ustar00rootroot00000000000000000077500000000000000000000000001225215345600334235ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/async-http-servlet-3.0/callback-test/src/test/java/org/jboss/resteasy/test000077500000000000000000000000001225215345600345405ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/async-http-servlet-3.0/callback-test/src/test/java/org/jboss/resteasy/test/asyncCallbackTest.java000077500000000000000000000115411225215345600377440ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/async-http-servlet-3.0/callback-test/src/test/java/org/jboss/resteasy/test/asyncpackage org.jboss.resteasy.test.async; import org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder; import org.jboss.resteasy.test.async.callback.Resource; import org.junit.AfterClass; import org.junit.Assert; import org.junit.BeforeClass; import org.junit.Test; import javax.ws.rs.ForbiddenException; import javax.ws.rs.NotFoundException; import javax.ws.rs.client.Client; import javax.ws.rs.client.ClientBuilder; import javax.ws.rs.core.Response; import java.io.IOException; import java.util.concurrent.Future; /** * @author Bill Burke * @version $Revision: 1 $ */ public class CallbackTest { public static Client client; @BeforeClass public static void initClient() { client = new ResteasyClientBuilder().connectionPoolSize(10).build(); } @AfterClass public static void closeClient() { client.close(); } protected void invokeClear() { Response response = client.target("http://localhost:8080/resource/clear").request().get(); Assert.assertEquals(204, response.getStatus()); response.close(); } protected void invokeReset() { Response response = client.target("http://localhost:8080/resource/reset").request().get(); Assert.assertEquals(204, response.getStatus()); response.close(); } protected void assertString(Future future, String check) throws Exception { Response response = future.get(); Assert.assertEquals(200, response.getStatus()); String entity = response.readEntity(String.class); Assert.assertEquals(entity, check); } @Test public void argumentContainsExceptionInTwoCallbackClassesTest() throws Exception { invokeClear(); invokeReset(); Future suspend = client.target("http://localhost:8080/resource/suspend").request().async().get(); Future register = client.target("http://localhost:8080/resource/registerclasses?stage=0").request().async().get(); assertString(register, Resource.FALSE); Future exception = client.target("http://localhost:8080/resource/exception?stage=1").request().async().get(); Response response = exception.get(); Response suspendResponse = suspend.get(); Assert.assertEquals(suspendResponse.getStatusInfo(), Response.Status.INTERNAL_SERVER_ERROR); suspendResponse.close(); Future error = client.target("http://localhost:8080/resource/error").request().async().get(); assertString(error, RuntimeException.class.getName()); error = client.target("http://localhost:8080/resource/seconderror").request().async().get(); assertString(error, RuntimeException.class.getName()); } @Test public void argumentContainsExceptionInTwoCallbackInstancesTest() throws Exception { invokeClear(); invokeReset(); Future suspend = client.target("http://localhost:8080/resource/suspend").request().async().get(); Future register = client.target("http://localhost:8080/resource/registerobjects?stage=0").request().async().get(); assertString(register, Resource.FALSE); Future exception = client.target("http://localhost:8080/resource/exception?stage=1").request().async().get(); Response response = exception.get(); Response suspendResponse = suspend.get(); Assert.assertEquals(suspendResponse.getStatusInfo(), Response.Status.INTERNAL_SERVER_ERROR); suspendResponse.close(); Future error = client.target("http://localhost:8080/resource/error").request().async().get(); assertString(error, RuntimeException.class.getName()); error = client.target("http://localhost:8080/resource/seconderror").request().async().get(); assertString(error, RuntimeException.class.getName()); } @Test public void argumentContainsExceptionWhenSendingIoExceptionTest() throws Exception { invokeClear(); invokeReset(); Future suspend = client.target("http://localhost:8080/resource/suspend").request().async().get(); Future register = client.target("http://localhost:8080/resource/register?stage=0").request().async().get(); assertString(register, Resource.FALSE); Future exception = client.target("http://localhost:8080/resource/resumechecked?stage=1").request().async().get(); Response response = exception.get(); Response suspendResponse = suspend.get(); Assert.assertEquals(suspendResponse.getStatusInfo(), Response.Status.INTERNAL_SERVER_ERROR); suspendResponse.close(); Future error = client.target("http://localhost:8080/resource/error").request().async().get(); assertString(error, IOException.class.getName()); } } Resteasy-3.0.6.Final/jaxrs/async-http-servlet-3.0/callback-test/src/test/resources/000077500000000000000000000000001225215345600300465ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/async-http-servlet-3.0/callback-test/src/test/resources/jndi.properties000066400000000000000000000002621225215345600331100ustar00rootroot00000000000000java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces java.naming.provider.url=jnp://localhost:1099Resteasy-3.0.6.Final/jaxrs/async-http-servlet-3.0/callback-test/src/test/resources/log4j.xml000066400000000000000000000047141225215345600316150ustar00rootroot00000000000000 Resteasy-3.0.6.Final/jaxrs/async-http-servlet-3.0/pom.xml000077500000000000000000000014431225215345600230770ustar00rootroot00000000000000 org.jboss.resteasy resteasy-jaxrs-all 3.0.6.Final Async Http JBossWeb 4.0.0 org.jboss.resteasy asynch-http-servlet-3.0-pom pom async-http-servlet-3.0 async-http-servlet-3.0-test callback-test Resteasy-3.0.6.Final/jaxrs/config/000077500000000000000000000000001225215345600167505ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/config/eclipse/000077500000000000000000000000001225215345600203745ustar00rootroot00000000000000Resteasy-3.0.6.Final/jaxrs/config/eclipse/jboss-format.xml000066400000000000000000000454171225215345600235370ustar00rootroot00000000000000 Resteasy-3.0.6.Final/jaxrs/config/eclipse/jboss-template.xml000066400000000000000000000065521225215345600240570ustar00rootroot00000000000000