[
  {
    "path": ".github/workflows/auto-pr.yml",
    "content": "on: [push, pull_request, release]\n\nname: MeterSphere pull request handler\n\njobs:\n  generic_handler:\n    name: Generic handler for MeterSphere Repos\n    runs-on: ubuntu-latest\n    steps:\n      - name: Add labels\n        uses: jumpserver/action-generic-handler@master\n        env:\n          GITHUB_TOKEN: ${{ secrets.GITHUBTOKEN }}\n      - uses: actions/checkout@v2\n      - uses: actions-ecosystem/action-add-labels@v1\n        with:\n          labels: ${{ github.base_ref }}"
  },
  {
    "path": ".gitignore",
    "content": "# Created by .ignore support plugin (hsz.mobi)\n.DS_Store\nnode_modules\nnode/\n/dist\n\n# local env files\n.env.local\n.env.*.local\n\n# Log files\nnpm-debug.log*\nyarn-debug.log*\nyarn-error.log*\n\n# Editor directories and files\n.idea\n*.iml\n.vscode\n*.suo\n*.ntvs*\n*.njsproj\n*.sln\n*.sw?\n\n\nsrc/test/\ntarget/\n.settings\n.project\n.classpath\n.factorypath\nwork/\n.mvn\n!.mvn/maven-wrapper.properties"
  },
  {
    "path": "Jenkinsfile",
    "content": "pipeline {\n    agent {\n        node {\n            label 'master'\n        }\n    }\n    options { quietPeriod(2400) }\n    environment {\n        JAVA_HOME = '/opt/jdk-11'\n    }\n    stages {\n        stage('Build/Test') {\n            steps {\n                configFileProvider([configFile(fileId: 'metersphere-maven', targetLocation: 'settings.xml')]) {\n                    sh \"\"\"#!/bin/bash -e\n                    export JAVA_HOME=/opt/jdk-11\n                    export CLASSPATH=$JAVA_HOME/lib:$CLASSPATH\n                    export PATH=$JAVA_HOME/bin:$PATH\n                    java -version\n                    ./mvnw clean package --settings ./settings.xml\n                    \"\"\"\n                }\n            }\n        }\n        stage('Archive') {\n            steps {\n                archiveArtifacts artifacts: 'target/*.hpi', followSymlinks: false\n            }\n        }\n        stage('Release') {\n            when { tag pattern: \"^v.*\", comparator: \"REGEXP\" }\n            steps {\n                withCredentials([string(credentialsId: 'gitrelease', variable: 'TOKEN')]) {\n                    withEnv([\"TOKEN=$TOKEN\"]) {\n                        sh script: '''\n                            release=$(curl -XPOST -H \"Authorization:token $TOKEN\" --data \"{\\\\\"tag_name\\\\\": \\\\\"${TAG_NAME}\\\\\", \\\\\"name\\\\\": \\\\\"${TAG_NAME}\\\\\", \\\\\"body\\\\\": \\\\\"\\\\\", \\\\\"draft\\\\\": false, \\\\\"prerelease\\\\\": true}\" https://api.github.com/repos/metersphere/jenkins-plugin/releases)\n                            id=$(echo \"$release\" | sed -n -e \\'s/\"id\":\\\\ \\\\([0-9]\\\\+\\\\),/\\\\1/p\\' | head -n 1 | sed \\'s/[[:blank:]]//g\\')\n                            cd target\n                            curl -XPOST -H \"Authorization:token $TOKEN\" -H \"Content-Type:application/octet-stream\" --data-binary @metersphere-v3-jenkins-plugin.hpi https://uploads.github.com/repos/metersphere/jenkins-plugin/releases/${id}/assets?name=metersphere-jenkins-plugin-${TAG_NAME}.hpi\n                        '''\n                    }\n                }\n            }\n        }\n    }\n    post('Notification') {\n        always {\n            sh \"echo \\$WEBHOOK\\n\"\n            withCredentials([string(credentialsId: 'wechat-bot-webhook', variable: 'WEBHOOK')]) {\n                qyWechatNotification failNotify: true, mentionedId: '', mentionedMobile: '', webhookUrl: \"$WEBHOOK\"\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "LICENSE",
    "content": "                    GNU GENERAL PUBLIC LICENSE\n                       Version 3, 29 June 2007\n\n Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>\n Everyone is permitted to copy and distribute verbatim copies\n of this license document, but changing it is not allowed.\n\n                            Preamble\n\n  The GNU General Public License is a free, copyleft license for\nsoftware and other kinds of works.\n\n  The licenses for most software and other practical works are designed\nto take away your freedom to share and change the works.  By contrast,\nthe GNU General Public License is intended to guarantee your freedom to\nshare and change all versions of a program--to make sure it remains free\nsoftware for all its users.  We, the Free Software Foundation, use the\nGNU General Public License for most of our software; it applies also to\nany other work released this way by its authors.  You can apply it to\nyour programs, too.\n\n  When we speak of free software, we are referring to freedom, not\nprice.  Our General Public Licenses are designed to make sure that you\nhave the freedom to distribute copies of free software (and charge for\nthem if you wish), that you receive source code or can get it if you\nwant it, that you can change the software or use pieces of it in new\nfree programs, and that you know you can do these things.\n\n  To protect your rights, we need to prevent others from denying you\nthese rights or asking you to surrender the rights.  Therefore, you have\ncertain responsibilities if you distribute copies of the software, or if\nyou modify it: responsibilities to respect the freedom of others.\n\n  For example, if you distribute copies of such a program, whether\ngratis or for a fee, you must pass on to the recipients the same\nfreedoms that you received.  You must make sure that they, too, receive\nor can get the source code.  And you must show them these terms so they\nknow their rights.\n\n  Developers that use the GNU GPL protect your rights with two steps:\n(1) assert copyright on the software, and (2) offer you this License\ngiving you legal permission to copy, distribute and/or modify it.\n\n  For the developers' and authors' protection, the GPL clearly explains\nthat there is no warranty for this free software.  For both users' and\nauthors' sake, the GPL requires that modified versions be marked as\nchanged, so that their problems will not be attributed erroneously to\nauthors of previous versions.\n\n  Some devices are designed to deny users access to install or run\nmodified versions of the software inside them, although the manufacturer\ncan do so.  This is fundamentally incompatible with the aim of\nprotecting users' freedom to change the software.  The systematic\npattern of such abuse occurs in the area of products for individuals to\nuse, which is precisely where it is most unacceptable.  Therefore, we\nhave designed this version of the GPL to prohibit the practice for those\nproducts.  If such problems arise substantially in other domains, we\nstand ready to extend this provision to those domains in future versions\nof the GPL, as needed to protect the freedom of users.\n\n  Finally, every program is threatened constantly by software patents.\nStates should not allow patents to restrict development and use of\nsoftware on general-purpose computers, but in those that do, we wish to\navoid the special danger that patents applied to a free program could\nmake it effectively proprietary.  To prevent this, the GPL assures that\npatents cannot be used to render the program non-free.\n\n  The precise terms and conditions for copying, distribution and\nmodification follow.\n\n                       TERMS AND CONDITIONS\n\n  0. Definitions.\n\n  \"This License\" refers to version 3 of the GNU General Public License.\n\n  \"Copyright\" also means copyright-like laws that apply to other kinds of\nworks, such as semiconductor masks.\n\n  \"The Program\" refers to any copyrightable work licensed under this\nLicense.  Each licensee is addressed as \"you\".  \"Licensees\" and\n\"recipients\" may be individuals or organizations.\n\n  To \"modify\" a work means to copy from or adapt all or part of the work\nin a fashion requiring copyright permission, other than the making of an\nexact copy.  The resulting work is called a \"modified version\" of the\nearlier work or a work \"based on\" the earlier work.\n\n  A \"covered work\" means either the unmodified Program or a work based\non the Program.\n\n  To \"propagate\" a work means to do anything with it that, without\npermission, would make you directly or secondarily liable for\ninfringement under applicable copyright law, except executing it on a\ncomputer or modifying a private copy.  Propagation includes copying,\ndistribution (with or without modification), making available to the\npublic, and in some countries other activities as well.\n\n  To \"convey\" a work means any kind of propagation that enables other\nparties to make or receive copies.  Mere interaction with a user through\na computer network, with no transfer of a copy, is not conveying.\n\n  An interactive user interface displays \"Appropriate Legal Notices\"\nto the extent that it includes a convenient and prominently visible\nfeature that (1) displays an appropriate copyright notice, and (2)\ntells the user that there is no warranty for the work (except to the\nextent that warranties are provided), that licensees may convey the\nwork under this License, and how to view a copy of this License.  If\nthe interface presents a list of user commands or options, such as a\nmenu, a prominent item in the list meets this criterion.\n\n  1. Source Code.\n\n  The \"source code\" for a work means the preferred form of the work\nfor making modifications to it.  \"Object code\" means any non-source\nform of a work.\n\n  A \"Standard Interface\" means an interface that either is an official\nstandard defined by a recognized standards body, or, in the case of\ninterfaces specified for a particular programming language, one that\nis widely used among developers working in that language.\n\n  The \"System Libraries\" of an executable work include anything, other\nthan the work as a whole, that (a) is included in the normal form of\npackaging a Major Component, but which is not part of that Major\nComponent, and (b) serves only to enable use of the work with that\nMajor Component, or to implement a Standard Interface for which an\nimplementation is available to the public in source code form.  A\n\"Major Component\", in this context, means a major essential component\n(kernel, window system, and so on) of the specific operating system\n(if any) on which the executable work runs, or a compiler used to\nproduce the work, or an object code interpreter used to run it.\n\n  The \"Corresponding Source\" for a work in object code form means all\nthe source code needed to generate, install, and (for an executable\nwork) run the object code and to modify the work, including scripts to\ncontrol those activities.  However, it does not include the work's\nSystem Libraries, or general-purpose tools or generally available free\nprograms which are used unmodified in performing those activities but\nwhich are not part of the work.  For example, Corresponding Source\nincludes interface definition files associated with source files for\nthe work, and the source code for shared libraries and dynamically\nlinked subprograms that the work is specifically designed to require,\nsuch as by intimate data communication or control flow between those\nsubprograms and other parts of the work.\n\n  The Corresponding Source need not include anything that users\ncan regenerate automatically from other parts of the Corresponding\nSource.\n\n  The Corresponding Source for a work in source code form is that\nsame work.\n\n  2. Basic Permissions.\n\n  All rights granted under this License are granted for the term of\ncopyright on the Program, and are irrevocable provided the stated\nconditions are met.  This License explicitly affirms your unlimited\npermission to run the unmodified Program.  The output from running a\ncovered work is covered by this License only if the output, given its\ncontent, constitutes a covered work.  This License acknowledges your\nrights of fair use or other equivalent, as provided by copyright law.\n\n  You may make, run and propagate covered works that you do not\nconvey, without conditions so long as your license otherwise remains\nin force.  You may convey covered works to others for the sole purpose\nof having them make modifications exclusively for you, or provide you\nwith facilities for running those works, provided that you comply with\nthe terms of this License in conveying all material for which you do\nnot control copyright.  Those thus making or running the covered works\nfor you must do so exclusively on your behalf, under your direction\nand control, on terms that prohibit them from making any copies of\nyour copyrighted material outside their relationship with you.\n\n  Conveying under any other circumstances is permitted solely under\nthe conditions stated below.  Sublicensing is not allowed; section 10\nmakes it unnecessary.\n\n  3. Protecting Users' Legal Rights From Anti-Circumvention Law.\n\n  No covered work shall be deemed part of an effective technological\nmeasure under any applicable law fulfilling obligations under article\n11 of the WIPO copyright treaty adopted on 20 December 1996, or\nsimilar laws prohibiting or restricting circumvention of such\nmeasures.\n\n  When you convey a covered work, you waive any legal power to forbid\ncircumvention of technological measures to the extent such circumvention\nis effected by exercising rights under this License with respect to\nthe covered work, and you disclaim any intention to limit operation or\nmodification of the work as a means of enforcing, against the work's\nusers, your or third parties' legal rights to forbid circumvention of\ntechnological measures.\n\n  4. Conveying Verbatim Copies.\n\n  You may convey verbatim copies of the Program's source code as you\nreceive it, in any medium, provided that you conspicuously and\nappropriately publish on each copy an appropriate copyright notice;\nkeep intact all notices stating that this License and any\nnon-permissive terms added in accord with section 7 apply to the code;\nkeep intact all notices of the absence of any warranty; and give all\nrecipients a copy of this License along with the Program.\n\n  You may charge any price or no price for each copy that you convey,\nand you may offer support or warranty protection for a fee.\n\n  5. Conveying Modified Source Versions.\n\n  You may convey a work based on the Program, or the modifications to\nproduce it from the Program, in the form of source code under the\nterms of section 4, provided that you also meet all of these conditions:\n\n    a) The work must carry prominent notices stating that you modified\n    it, and giving a relevant date.\n\n    b) The work must carry prominent notices stating that it is\n    released under this License and any conditions added under section\n    7.  This requirement modifies the requirement in section 4 to\n    \"keep intact all notices\".\n\n    c) You must license the entire work, as a whole, under this\n    License to anyone who comes into possession of a copy.  This\n    License will therefore apply, along with any applicable section 7\n    additional terms, to the whole of the work, and all its parts,\n    regardless of how they are packaged.  This License gives no\n    permission to license the work in any other way, but it does not\n    invalidate such permission if you have separately received it.\n\n    d) If the work has interactive user interfaces, each must display\n    Appropriate Legal Notices; however, if the Program has interactive\n    interfaces that do not display Appropriate Legal Notices, your\n    work need not make them do so.\n\n  A compilation of a covered work with other separate and independent\nworks, which are not by their nature extensions of the covered work,\nand which are not combined with it such as to form a larger program,\nin or on a volume of a storage or distribution medium, is called an\n\"aggregate\" if the compilation and its resulting copyright are not\nused to limit the access or legal rights of the compilation's users\nbeyond what the individual works permit.  Inclusion of a covered work\nin an aggregate does not cause this License to apply to the other\nparts of the aggregate.\n\n  6. Conveying Non-Source Forms.\n\n  You may convey a covered work in object code form under the terms\nof sections 4 and 5, provided that you also convey the\nmachine-readable Corresponding Source under the terms of this License,\nin one of these ways:\n\n    a) Convey the object code in, or embodied in, a physical product\n    (including a physical distribution medium), accompanied by the\n    Corresponding Source fixed on a durable physical medium\n    customarily used for software interchange.\n\n    b) Convey the object code in, or embodied in, a physical product\n    (including a physical distribution medium), accompanied by a\n    written offer, valid for at least three years and valid for as\n    long as you offer spare parts or customer support for that product\n    model, to give anyone who possesses the object code either (1) a\n    copy of the Corresponding Source for all the software in the\n    product that is covered by this License, on a durable physical\n    medium customarily used for software interchange, for a price no\n    more than your reasonable cost of physically performing this\n    conveying of source, or (2) access to copy the\n    Corresponding Source from a network server at no charge.\n\n    c) Convey individual copies of the object code with a copy of the\n    written offer to provide the Corresponding Source.  This\n    alternative is allowed only occasionally and noncommercially, and\n    only if you received the object code with such an offer, in accord\n    with subsection 6b.\n\n    d) Convey the object code by offering access from a designated\n    place (gratis or for a charge), and offer equivalent access to the\n    Corresponding Source in the same way through the same place at no\n    further charge.  You need not require recipients to copy the\n    Corresponding Source along with the object code.  If the place to\n    copy the object code is a network server, the Corresponding Source\n    may be on a different server (operated by you or a third party)\n    that supports equivalent copying facilities, provided you maintain\n    clear directions next to the object code saying where to find the\n    Corresponding Source.  Regardless of what server hosts the\n    Corresponding Source, you remain obligated to ensure that it is\n    available for as long as needed to satisfy these requirements.\n\n    e) Convey the object code using peer-to-peer transmission, provided\n    you inform other peers where the object code and Corresponding\n    Source of the work are being offered to the general public at no\n    charge under subsection 6d.\n\n  A separable portion of the object code, whose source code is excluded\nfrom the Corresponding Source as a System Library, need not be\nincluded in conveying the object code work.\n\n  A \"User Product\" is either (1) a \"consumer product\", which means any\ntangible personal property which is normally used for personal, family,\nor household purposes, or (2) anything designed or sold for incorporation\ninto a dwelling.  In determining whether a product is a consumer product,\ndoubtful cases shall be resolved in favor of coverage.  For a particular\nproduct received by a particular user, \"normally used\" refers to a\ntypical or common use of that class of product, regardless of the status\nof the particular user or of the way in which the particular user\nactually uses, or expects or is expected to use, the product.  A product\nis a consumer product regardless of whether the product has substantial\ncommercial, industrial or non-consumer uses, unless such uses represent\nthe only significant mode of use of the product.\n\n  \"Installation Information\" for a User Product means any methods,\nprocedures, authorization keys, or other information required to install\nand execute modified versions of a covered work in that User Product from\na modified version of its Corresponding Source.  The information must\nsuffice to ensure that the continued functioning of the modified object\ncode is in no case prevented or interfered with solely because\nmodification has been made.\n\n  If you convey an object code work under this section in, or with, or\nspecifically for use in, a User Product, and the conveying occurs as\npart of a transaction in which the right of possession and use of the\nUser Product is transferred to the recipient in perpetuity or for a\nfixed term (regardless of how the transaction is characterized), the\nCorresponding Source conveyed under this section must be accompanied\nby the Installation Information.  But this requirement does not apply\nif neither you nor any third party retains the ability to install\nmodified object code on the User Product (for example, the work has\nbeen installed in ROM).\n\n  The requirement to provide Installation Information does not include a\nrequirement to continue to provide support service, warranty, or updates\nfor a work that has been modified or installed by the recipient, or for\nthe User Product in which it has been modified or installed.  Access to a\nnetwork may be denied when the modification itself materially and\nadversely affects the operation of the network or violates the rules and\nprotocols for communication across the network.\n\n  Corresponding Source conveyed, and Installation Information provided,\nin accord with this section must be in a format that is publicly\ndocumented (and with an implementation available to the public in\nsource code form), and must require no special password or key for\nunpacking, reading or copying.\n\n  7. Additional Terms.\n\n  \"Additional permissions\" are terms that supplement the terms of this\nLicense by making exceptions from one or more of its conditions.\nAdditional permissions that are applicable to the entire Program shall\nbe treated as though they were included in this License, to the extent\nthat they are valid under applicable law.  If additional permissions\napply only to part of the Program, that part may be used separately\nunder those permissions, but the entire Program remains governed by\nthis License without regard to the additional permissions.\n\n  When you convey a copy of a covered work, you may at your option\nremove any additional permissions from that copy, or from any part of\nit.  (Additional permissions may be written to require their own\nremoval in certain cases when you modify the work.)  You may place\nadditional permissions on material, added by you to a covered work,\nfor which you have or can give appropriate copyright permission.\n\n  Notwithstanding any other provision of this License, for material you\nadd to a covered work, you may (if authorized by the copyright holders of\nthat material) supplement the terms of this License with terms:\n\n    a) Disclaiming warranty or limiting liability differently from the\n    terms of sections 15 and 16 of this License; or\n\n    b) Requiring preservation of specified reasonable legal notices or\n    author attributions in that material or in the Appropriate Legal\n    Notices displayed by works containing it; or\n\n    c) Prohibiting misrepresentation of the origin of that material, or\n    requiring that modified versions of such material be marked in\n    reasonable ways as different from the original version; or\n\n    d) Limiting the use for publicity purposes of names of licensors or\n    authors of the material; or\n\n    e) Declining to grant rights under trademark law for use of some\n    trade names, trademarks, or service marks; or\n\n    f) Requiring indemnification of licensors and authors of that\n    material by anyone who conveys the material (or modified versions of\n    it) with contractual assumptions of liability to the recipient, for\n    any liability that these contractual assumptions directly impose on\n    those licensors and authors.\n\n  All other non-permissive additional terms are considered \"further\nrestrictions\" within the meaning of section 10.  If the Program as you\nreceived it, or any part of it, contains a notice stating that it is\ngoverned by this License along with a term that is a further\nrestriction, you may remove that term.  If a license document contains\na further restriction but permits relicensing or conveying under this\nLicense, you may add to a covered work material governed by the terms\nof that license document, provided that the further restriction does\nnot survive such relicensing or conveying.\n\n  If you add terms to a covered work in accord with this section, you\nmust place, in the relevant source files, a statement of the\nadditional terms that apply to those files, or a notice indicating\nwhere to find the applicable terms.\n\n  Additional terms, permissive or non-permissive, may be stated in the\nform of a separately written license, or stated as exceptions;\nthe above requirements apply either way.\n\n  8. Termination.\n\n  You may not propagate or modify a covered work except as expressly\nprovided under this License.  Any attempt otherwise to propagate or\nmodify it is void, and will automatically terminate your rights under\nthis License (including any patent licenses granted under the third\nparagraph of section 11).\n\n  However, if you cease all violation of this License, then your\nlicense from a particular copyright holder is reinstated (a)\nprovisionally, unless and until the copyright holder explicitly and\nfinally terminates your license, and (b) permanently, if the copyright\nholder fails to notify you of the violation by some reasonable means\nprior to 60 days after the cessation.\n\n  Moreover, your license from a particular copyright holder is\nreinstated permanently if the copyright holder notifies you of the\nviolation by some reasonable means, this is the first time you have\nreceived notice of violation of this License (for any work) from that\ncopyright holder, and you cure the violation prior to 30 days after\nyour receipt of the notice.\n\n  Termination of your rights under this section does not terminate the\nlicenses of parties who have received copies or rights from you under\nthis License.  If your rights have been terminated and not permanently\nreinstated, you do not qualify to receive new licenses for the same\nmaterial under section 10.\n\n  9. Acceptance Not Required for Having Copies.\n\n  You are not required to accept this License in order to receive or\nrun a copy of the Program.  Ancillary propagation of a covered work\noccurring solely as a consequence of using peer-to-peer transmission\nto receive a copy likewise does not require acceptance.  However,\nnothing other than this License grants you permission to propagate or\nmodify any covered work.  These actions infringe copyright if you do\nnot accept this License.  Therefore, by modifying or propagating a\ncovered work, you indicate your acceptance of this License to do so.\n\n  10. Automatic Licensing of Downstream Recipients.\n\n  Each time you convey a covered work, the recipient automatically\nreceives a license from the original licensors, to run, modify and\npropagate that work, subject to this License.  You are not responsible\nfor enforcing compliance by third parties with this License.\n\n  An \"entity transaction\" is a transaction transferring control of an\norganization, or substantially all assets of one, or subdividing an\norganization, or merging organizations.  If propagation of a covered\nwork results from an entity transaction, each party to that\ntransaction who receives a copy of the work also receives whatever\nlicenses to the work the party's predecessor in interest had or could\ngive under the previous paragraph, plus a right to possession of the\nCorresponding Source of the work from the predecessor in interest, if\nthe predecessor has it or can get it with reasonable efforts.\n\n  You may not impose any further restrictions on the exercise of the\nrights granted or affirmed under this License.  For example, you may\nnot impose a license fee, royalty, or other charge for exercise of\nrights granted under this License, and you may not initiate litigation\n(including a cross-claim or counterclaim in a lawsuit) alleging that\nany patent claim is infringed by making, using, selling, offering for\nsale, or importing the Program or any portion of it.\n\n  11. Patents.\n\n  A \"contributor\" is a copyright holder who authorizes use under this\nLicense of the Program or a work on which the Program is based.  The\nwork thus licensed is called the contributor's \"contributor version\".\n\n  A contributor's \"essential patent claims\" are all patent claims\nowned or controlled by the contributor, whether already acquired or\nhereafter acquired, that would be infringed by some manner, permitted\nby this License, of making, using, or selling its contributor version,\nbut do not include claims that would be infringed only as a\nconsequence of further modification of the contributor version.  For\npurposes of this definition, \"control\" includes the right to grant\npatent sublicenses in a manner consistent with the requirements of\nthis License.\n\n  Each contributor grants you a non-exclusive, worldwide, royalty-free\npatent license under the contributor's essential patent claims, to\nmake, use, sell, offer for sale, import and otherwise run, modify and\npropagate the contents of its contributor version.\n\n  In the following three paragraphs, a \"patent license\" is any express\nagreement or commitment, however denominated, not to enforce a patent\n(such as an express permission to practice a patent or covenant not to\nsue for patent infringement).  To \"grant\" such a patent license to a\nparty means to make such an agreement or commitment not to enforce a\npatent against the party.\n\n  If you convey a covered work, knowingly relying on a patent license,\nand the Corresponding Source of the work is not available for anyone\nto copy, free of charge and under the terms of this License, through a\npublicly available network server or other readily accessible means,\nthen you must either (1) cause the Corresponding Source to be so\navailable, or (2) arrange to deprive yourself of the benefit of the\npatent license for this particular work, or (3) arrange, in a manner\nconsistent with the requirements of this License, to extend the patent\nlicense to downstream recipients.  \"Knowingly relying\" means you have\nactual knowledge that, but for the patent license, your conveying the\ncovered work in a country, or your recipient's use of the covered work\nin a country, would infringe one or more identifiable patents in that\ncountry that you have reason to believe are valid.\n\n  If, pursuant to or in connection with a single transaction or\narrangement, you convey, or propagate by procuring conveyance of, a\ncovered work, and grant a patent license to some of the parties\nreceiving the covered work authorizing them to use, propagate, modify\nor convey a specific copy of the covered work, then the patent license\nyou grant is automatically extended to all recipients of the covered\nwork and works based on it.\n\n  A patent license is \"discriminatory\" if it does not include within\nthe scope of its coverage, prohibits the exercise of, or is\nconditioned on the non-exercise of one or more of the rights that are\nspecifically granted under this License.  You may not convey a covered\nwork if you are a party to an arrangement with a third party that is\nin the business of distributing software, under which you make payment\nto the third party based on the extent of your activity of conveying\nthe work, and under which the third party grants, to any of the\nparties who would receive the covered work from you, a discriminatory\npatent license (a) in connection with copies of the covered work\nconveyed by you (or copies made from those copies), or (b) primarily\nfor and in connection with specific products or compilations that\ncontain the covered work, unless you entered into that arrangement,\nor that patent license was granted, prior to 28 March 2007.\n\n  Nothing in this License shall be construed as excluding or limiting\nany implied license or other defenses to infringement that may\notherwise be available to you under applicable patent law.\n\n  12. No Surrender of Others' Freedom.\n\n  If conditions are imposed on you (whether by court order, agreement or\notherwise) that contradict the conditions of this License, they do not\nexcuse you from the conditions of this License.  If you cannot convey a\ncovered work so as to satisfy simultaneously your obligations under this\nLicense and any other pertinent obligations, then as a consequence you may\nnot convey it at all.  For example, if you agree to terms that obligate you\nto collect a royalty for further conveying from those to whom you convey\nthe Program, the only way you could satisfy both those terms and this\nLicense would be to refrain entirely from conveying the Program.\n\n  13. Use with the GNU Affero General Public License.\n\n  Notwithstanding any other provision of this License, you have\npermission to link or combine any covered work with a work licensed\nunder version 3 of the GNU Affero General Public License into a single\ncombined work, and to convey the resulting work.  The terms of this\nLicense will continue to apply to the part which is the covered work,\nbut the special requirements of the GNU Affero General Public License,\nsection 13, concerning interaction through a network will apply to the\ncombination as such.\n\n  14. Revised Versions of this License.\n\n  The Free Software Foundation may publish revised and/or new versions of\nthe GNU General Public License from time to time.  Such new versions will\nbe similar in spirit to the present version, but may differ in detail to\naddress new problems or concerns.\n\n  Each version is given a distinguishing version number.  If the\nProgram specifies that a certain numbered version of the GNU General\nPublic License \"or any later version\" applies to it, you have the\noption of following the terms and conditions either of that numbered\nversion or of any later version published by the Free Software\nFoundation.  If the Program does not specify a version number of the\nGNU General Public License, you may choose any version ever published\nby the Free Software Foundation.\n\n  If the Program specifies that a proxy can decide which future\nversions of the GNU General Public License can be used, that proxy's\npublic statement of acceptance of a version permanently authorizes you\nto choose that version for the Program.\n\n  Later license versions may give you additional or different\npermissions.  However, no additional obligations are imposed on any\nauthor or copyright holder as a result of your choosing to follow a\nlater version.\n\n  15. Disclaimer of Warranty.\n\n  THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY\nAPPLICABLE LAW.  EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT\nHOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM \"AS IS\" WITHOUT WARRANTY\nOF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,\nTHE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\nPURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM\nIS WITH YOU.  SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF\nALL NECESSARY SERVICING, REPAIR OR CORRECTION.\n\n  16. Limitation of Liability.\n\n  IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING\nWILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS\nTHE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY\nGENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE\nUSE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF\nDATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD\nPARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),\nEVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF\nSUCH DAMAGES.\n\n  17. Interpretation of Sections 15 and 16.\n\n  If the disclaimer of warranty and limitation of liability provided\nabove cannot be given local legal effect according to their terms,\nreviewing courts shall apply local law that most closely approximates\nan absolute waiver of all civil liability in connection with the\nProgram, unless a warranty or assumption of liability accompanies a\ncopy of the Program in return for a fee.\n\n                     END OF TERMS AND CONDITIONS\n\n            How to Apply These Terms to Your New Programs\n\n  If you develop a new program, and you want it to be of the greatest\npossible use to the public, the best way to achieve this is to make it\nfree software which everyone can redistribute and change under these terms.\n\n  To do so, attach the following notices to the program.  It is safest\nto attach them to the start of each source file to most effectively\nstate the exclusion of warranty; and each file should have at least\nthe \"copyright\" line and a pointer to where the full notice is found.\n\n    <one line to give the program's name and a brief idea of what it does.>\n    Copyright (C) <year>  <name of author>\n\n    This program is free software: you can redistribute it and/or modify\n    it under the terms of the GNU General Public License as published by\n    the Free Software Foundation, either version 3 of the License, or\n    (at your option) any later version.\n\n    This program is distributed in the hope that it will be useful,\n    but WITHOUT ANY WARRANTY; without even the implied warranty of\n    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n    GNU General Public License for more details.\n\n    You should have received a copy of the GNU General Public License\n    along with this program.  If not, see <https://www.gnu.org/licenses/>.\n\nAlso add information on how to contact you by electronic and paper mail.\n\n  If the program does terminal interaction, make it output a short\nnotice like this when it starts in an interactive mode:\n\n    <program>  Copyright (C) <year>  <name of author>\n    This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.\n    This is free software, and you are welcome to redistribute it\n    under certain conditions; type `show c' for details.\n\nThe hypothetical commands `show w' and `show c' should show the appropriate\nparts of the General Public License.  Of course, your program's commands\nmight be different; for a GUI interface, you would use an \"about box\".\n\n  You should also get your employer (if you work as a programmer) or school,\nif any, to sign a \"copyright disclaimer\" for the program, if necessary.\nFor more information on this, and how to apply and follow the GNU GPL, see\n<https://www.gnu.org/licenses/>.\n\n  The GNU General Public License does not permit incorporating your program\ninto proprietary programs.  If your program is a subroutine library, you\nmay consider it more useful to permit linking proprietary applications with\nthe library.  If this is what you want to do, use the GNU Lesser General\nPublic License instead of this License.  But first, please read\n<https://www.gnu.org/licenses/why-not-lgpl.html>.\n"
  },
  {
    "path": "README.md",
    "content": "MeterSphere Jenkins 插件\n=============================\n[MeterSphere](https://github.com/metersphere/metersphere) 是新一代的测试管理和接口测试工具，让测试工作更简单、更高效，不再成为持续交付的瓶颈。\n\n-   **测试管理**: 从测试用例管理，到测试计划执行、缺陷管理、测试报告生成，具有远超禅道和 TestLink 的使用体验；\n-   **接口测试**: 集 Postman 的易用与 JMeter 的灵活于一体，接口定义、接口调试、接口 Mock、场景自动化、接口报告，你想要的都有；\n-   **团队协作**: 摆脱单机测试工具的束缚，支持团队协作并对接 DevOps 工具链，将测试融入持续交付体系。\n\n该项目为 MeterSphere 配套的 Jenkins 插件，在 Jenkins 中安装该插件后可将 Jenkins 任务中添加 MeterSphere 构建环节，用户在该构建环节中配置 MeterSphere 平台的认证信息后，可选择指定项目下的测试计划触发执行。\n\n## 安装使用\n\n### 下载插件\n  1. 在该项目的 [release](https://github.com/metersphere/jenkins-plugin/releases) 页面下载最新版本的 hpi 包\n  2. 在 Jenkins 的插件管理页面，上传并安装下载好的 hpi 插件包\n\n### 使用指导\n\n插件安装后，在指定的 Jenkins 构建任务中，添加「MeterSphere」类型的构建步骤\n\n<img width=\"1365\" alt=\"image\" src=\"https://github.com/metersphere/jenkins-plugin/assets/23045261/d8522e36-4cce-4226-9bdd-f4017f22ac3a\">\n\n\n根据图示配置，填写认证信息并选择需要触发执行的用例\n\n<img width=\"1333\" alt=\"image\" src=\"https://github.com/metersphere/jenkins-plugin/assets/23045261/43ffa7d7-6d71-442d-8c9e-ec10a2333662\">\n\n\n## 问题反馈\n\n如果您在使用过程中遇到什么问题，或有进一步的需求需要反馈，请提交 GitHub Issue 到 [MeterSphere 项目的主仓库](https://github.com/metersphere/metersphere/issues)\n  \n## 微信群\n\n![wechat-group](https://metersphere.oss-cn-hangzhou.aliyuncs.com/img/wechat-group.png)\n\n## License & Copyright\n\nCopyright (c) 2014-2026 飞致云 FIT2CLOUD, All rights reserved.\n\nLicensed under The GNU General Public License version 3 (GPLv3)  (the \"License\"); you may not use this file except in compliance with the License. You may obtain a copy of the License at\n\nhttps://www.gnu.org/licenses/gpl-3.0.html\n\nUnless 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.\n"
  },
  {
    "path": "mvnw",
    "content": "#!/bin/sh\n# ----------------------------------------------------------------------------\n# Licensed to the Apache Software Foundation (ASF) under one\n# or more contributor license agreements.  See the NOTICE file\n# distributed with this work for additional information\n# regarding copyright ownership.  The ASF licenses this file\n# to you under the Apache License, Version 2.0 (the\n# \"License\"); you may not use this file except in compliance\n# with the License.  You may obtain a copy of the License at\n#\n#    https://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing,\n# software distributed under the License is distributed on an\n# \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n# KIND, either express or implied.  See the License for the\n# specific language governing permissions and limitations\n# under the License.\n# ----------------------------------------------------------------------------\n\n# ----------------------------------------------------------------------------\n# Maven Start Up Batch script\n#\n# Required ENV vars:\n# ------------------\n#   JAVA_HOME - location of a JDK home dir\n#\n# Optional ENV vars\n# -----------------\n#   M2_HOME - location of maven2's installed home dir\n#   MAVEN_OPTS - parameters passed to the Java VM when running Maven\n#     e.g. to debug Maven itself, use\n#       set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000\n#   MAVEN_SKIP_RC - flag to disable loading of mavenrc files\n# ----------------------------------------------------------------------------\n\nif [ -z \"$MAVEN_SKIP_RC\" ] ; then\n\n  if [ -f /etc/mavenrc ] ; then\n    . /etc/mavenrc\n  fi\n\n  if [ -f \"$HOME/.mavenrc\" ] ; then\n    . \"$HOME/.mavenrc\"\n  fi\n\nfi\n\n# OS specific support.  $var _must_ be set to either true or false.\ncygwin=false;\ndarwin=false;\nmingw=false\ncase \"`uname`\" in\n  CYGWIN*) cygwin=true ;;\n  MINGW*) mingw=true;;\n  Darwin*) darwin=true\n    # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home\n    # See https://developer.apple.com/library/mac/qa/qa1170/_index.html\n    if [ -z \"$JAVA_HOME\" ]; then\n      if [ -x \"/usr/libexec/java_home\" ]; then\n        export JAVA_HOME=\"`/usr/libexec/java_home`\"\n      else\n        export JAVA_HOME=\"/Library/Java/Home\"\n      fi\n    fi\n    ;;\nesac\n\nif [ -z \"$JAVA_HOME\" ] ; then\n  if [ -r /etc/gentoo-release ] ; then\n    JAVA_HOME=`java-config --jre-home`\n  fi\nfi\n\nif [ -z \"$M2_HOME\" ] ; then\n  ## resolve links - $0 may be a link to maven's home\n  PRG=\"$0\"\n\n  # need this for relative symlinks\n  while [ -h \"$PRG\" ] ; do\n    ls=`ls -ld \"$PRG\"`\n    link=`expr \"$ls\" : '.*-> \\(.*\\)$'`\n    if expr \"$link\" : '/.*' > /dev/null; then\n      PRG=\"$link\"\n    else\n      PRG=\"`dirname \"$PRG\"`/$link\"\n    fi\n  done\n\n  saveddir=`pwd`\n\n  M2_HOME=`dirname \"$PRG\"`/..\n\n  # make it fully qualified\n  M2_HOME=`cd \"$M2_HOME\" && pwd`\n\n  cd \"$saveddir\"\n  # echo Using m2 at $M2_HOME\nfi\n\n# For Cygwin, ensure paths are in UNIX format before anything is touched\nif $cygwin ; then\n  [ -n \"$M2_HOME\" ] &&\n    M2_HOME=`cygpath --unix \"$M2_HOME\"`\n  [ -n \"$JAVA_HOME\" ] &&\n    JAVA_HOME=`cygpath --unix \"$JAVA_HOME\"`\n  [ -n \"$CLASSPATH\" ] &&\n    CLASSPATH=`cygpath --path --unix \"$CLASSPATH\"`\nfi\n\n# For Mingw, ensure paths are in UNIX format before anything is touched\nif $mingw ; then\n  [ -n \"$M2_HOME\" ] &&\n    M2_HOME=\"`(cd \"$M2_HOME\"; pwd)`\"\n  [ -n \"$JAVA_HOME\" ] &&\n    JAVA_HOME=\"`(cd \"$JAVA_HOME\"; pwd)`\"\nfi\n\nif [ -z \"$JAVA_HOME\" ]; then\n  javaExecutable=\"`which javac`\"\n  if [ -n \"$javaExecutable\" ] && ! [ \"`expr \\\"$javaExecutable\\\" : '\\([^ ]*\\)'`\" = \"no\" ]; then\n    # readlink(1) is not available as standard on Solaris 10.\n    readLink=`which readlink`\n    if [ ! `expr \"$readLink\" : '\\([^ ]*\\)'` = \"no\" ]; then\n      if $darwin ; then\n        javaHome=\"`dirname \\\"$javaExecutable\\\"`\"\n        javaExecutable=\"`cd \\\"$javaHome\\\" && pwd -P`/javac\"\n      else\n        javaExecutable=\"`readlink -f \\\"$javaExecutable\\\"`\"\n      fi\n      javaHome=\"`dirname \\\"$javaExecutable\\\"`\"\n      javaHome=`expr \"$javaHome\" : '\\(.*\\)/bin'`\n      JAVA_HOME=\"$javaHome\"\n      export JAVA_HOME\n    fi\n  fi\nfi\n\nif [ -z \"$JAVACMD\" ] ; then\n  if [ -n \"$JAVA_HOME\"  ] ; then\n    if [ -x \"$JAVA_HOME/jre/sh/java\" ] ; then\n      # IBM's JDK on AIX uses strange locations for the executables\n      JAVACMD=\"$JAVA_HOME/jre/sh/java\"\n    else\n      JAVACMD=\"$JAVA_HOME/bin/java\"\n    fi\n  else\n    JAVACMD=\"`which java`\"\n  fi\nfi\n\nif [ ! -x \"$JAVACMD\" ] ; then\n  echo \"Error: JAVA_HOME is not defined correctly.\" >&2\n  echo \"  We cannot execute $JAVACMD\" >&2\n  exit 1\nfi\n\nif [ -z \"$JAVA_HOME\" ] ; then\n  echo \"Warning: JAVA_HOME environment variable is not set.\"\nfi\n\nCLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher\n\n# traverses directory structure from process work directory to filesystem root\n# first directory with .mvn subdirectory is considered project base directory\nfind_maven_basedir() {\n\n  if [ -z \"$1\" ]\n  then\n    echo \"Path not specified to find_maven_basedir\"\n    return 1\n  fi\n\n  basedir=\"$1\"\n  wdir=\"$1\"\n  while [ \"$wdir\" != '/' ] ; do\n    if [ -d \"$wdir\"/.mvn ] ; then\n      basedir=$wdir\n      break\n    fi\n    # workaround for JBEAP-8937 (on Solaris 10/Sparc)\n    if [ -d \"${wdir}\" ]; then\n      wdir=`cd \"$wdir/..\"; pwd`\n    fi\n    # end of workaround\n  done\n  echo \"${basedir}\"\n}\n\n# concatenates all lines of a file\nconcat_lines() {\n  if [ -f \"$1\" ]; then\n    echo \"$(tr -s '\\n' ' ' < \"$1\")\"\n  fi\n}\n\nBASE_DIR=`find_maven_basedir \"$(pwd)\"`\nif [ -z \"$BASE_DIR\" ]; then\n  exit 1;\nfi\n\n##########################################################################################\n# Extension to allow automatically downloading the maven-wrapper.jar from Maven-central\n# This allows using the maven wrapper in projects that prohibit checking in binary data.\n##########################################################################################\nif [ -r \"$BASE_DIR/.mvn/wrapper/maven-wrapper.jar\" ]; then\n    if [ \"$MVNW_VERBOSE\" = true ]; then\n      echo \"Found .mvn/wrapper/maven-wrapper.jar\"\n    fi\nelse\n    if [ \"$MVNW_VERBOSE\" = true ]; then\n      echo \"Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ...\"\n    fi\n    if [ -n \"$MVNW_REPOURL\" ]; then\n      jarUrl=\"$MVNW_REPOURL/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar\"\n    else\n      jarUrl=\"https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar\"\n    fi\n    while IFS=\"=\" read key value; do\n      case \"$key\" in (wrapperUrl) jarUrl=\"$value\"; break ;;\n      esac\n    done < \"$BASE_DIR/.mvn/wrapper/maven-wrapper.properties\"\n    if [ \"$MVNW_VERBOSE\" = true ]; then\n      echo \"Downloading from: $jarUrl\"\n    fi\n    wrapperJarPath=\"$BASE_DIR/.mvn/wrapper/maven-wrapper.jar\"\n    if $cygwin; then\n      wrapperJarPath=`cygpath --path --windows \"$wrapperJarPath\"`\n    fi\n\n    if command -v wget > /dev/null; then\n        if [ \"$MVNW_VERBOSE\" = true ]; then\n          echo \"Found wget ... using wget\"\n        fi\n        if [ -z \"$MVNW_USERNAME\" ] || [ -z \"$MVNW_PASSWORD\" ]; then\n            wget \"$jarUrl\" -O \"$wrapperJarPath\"\n        else\n            wget --http-user=$MVNW_USERNAME --http-password=$MVNW_PASSWORD \"$jarUrl\" -O \"$wrapperJarPath\"\n        fi\n    elif command -v curl > /dev/null; then\n        if [ \"$MVNW_VERBOSE\" = true ]; then\n          echo \"Found curl ... using curl\"\n        fi\n        if [ -z \"$MVNW_USERNAME\" ] || [ -z \"$MVNW_PASSWORD\" ]; then\n            curl -o \"$wrapperJarPath\" \"$jarUrl\" -f\n        else\n            curl --user $MVNW_USERNAME:$MVNW_PASSWORD -o \"$wrapperJarPath\" \"$jarUrl\" -f\n        fi\n\n    else\n        if [ \"$MVNW_VERBOSE\" = true ]; then\n          echo \"Falling back to using Java to download\"\n        fi\n        javaClass=\"$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java\"\n        # For Cygwin, switch paths to Windows format before running javac\n        if $cygwin; then\n          javaClass=`cygpath --path --windows \"$javaClass\"`\n        fi\n        if [ -e \"$javaClass\" ]; then\n            if [ ! -e \"$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class\" ]; then\n                if [ \"$MVNW_VERBOSE\" = true ]; then\n                  echo \" - Compiling MavenWrapperDownloader.java ...\"\n                fi\n                # Compiling the Java class\n                (\"$JAVA_HOME/bin/javac\" \"$javaClass\")\n            fi\n            if [ -e \"$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class\" ]; then\n                # Running the downloader\n                if [ \"$MVNW_VERBOSE\" = true ]; then\n                  echo \" - Running MavenWrapperDownloader.java ...\"\n                fi\n                (\"$JAVA_HOME/bin/java\" -cp .mvn/wrapper MavenWrapperDownloader \"$MAVEN_PROJECTBASEDIR\")\n            fi\n        fi\n    fi\nfi\n##########################################################################################\n# End of extension\n##########################################################################################\n\nexport MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-\"$BASE_DIR\"}\nif [ \"$MVNW_VERBOSE\" = true ]; then\n  echo $MAVEN_PROJECTBASEDIR\nfi\nMAVEN_OPTS=\"$(concat_lines \"$MAVEN_PROJECTBASEDIR/.mvn/jvm.config\") $MAVEN_OPTS\"\n\n# For Cygwin, switch paths to Windows format before running java\nif $cygwin; then\n  [ -n \"$M2_HOME\" ] &&\n    M2_HOME=`cygpath --path --windows \"$M2_HOME\"`\n  [ -n \"$JAVA_HOME\" ] &&\n    JAVA_HOME=`cygpath --path --windows \"$JAVA_HOME\"`\n  [ -n \"$CLASSPATH\" ] &&\n    CLASSPATH=`cygpath --path --windows \"$CLASSPATH\"`\n  [ -n \"$MAVEN_PROJECTBASEDIR\" ] &&\n    MAVEN_PROJECTBASEDIR=`cygpath --path --windows \"$MAVEN_PROJECTBASEDIR\"`\nfi\n\n# Provide a \"standardized\" way to retrieve the CLI args that will\n# work with both Windows and non-Windows executions.\nMAVEN_CMD_LINE_ARGS=\"$MAVEN_CONFIG $@\"\nexport MAVEN_CMD_LINE_ARGS\n\nWRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain\n\nexec \"$JAVACMD\" \\\n  $MAVEN_OPTS \\\n  -classpath \"$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar\" \\\n  \"-Dmaven.home=${M2_HOME}\" \"-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}\" \\\n  ${WRAPPER_LAUNCHER} $MAVEN_CONFIG \"$@\"\n"
  },
  {
    "path": "mvnw.cmd",
    "content": "@REM ----------------------------------------------------------------------------\n@REM Licensed to the Apache Software Foundation (ASF) under one\n@REM or more contributor license agreements.  See the NOTICE file\n@REM distributed with this work for additional information\n@REM regarding copyright ownership.  The ASF licenses this file\n@REM to you under the Apache License, Version 2.0 (the\n@REM \"License\"); you may not use this file except in compliance\n@REM with the License.  You may obtain a copy of the License at\n@REM\n@REM    https://www.apache.org/licenses/LICENSE-2.0\n@REM\n@REM Unless required by applicable law or agreed to in writing,\n@REM software distributed under the License is distributed on an\n@REM \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n@REM KIND, either express or implied.  See the License for the\n@REM specific language governing permissions and limitations\n@REM under the License.\n@REM ----------------------------------------------------------------------------\n\n@REM ----------------------------------------------------------------------------\n@REM Maven Start Up Batch script\n@REM\n@REM Required ENV vars:\n@REM JAVA_HOME - location of a JDK home dir\n@REM\n@REM Optional ENV vars\n@REM M2_HOME - location of maven2's installed home dir\n@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands\n@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a keystroke before ending\n@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven\n@REM     e.g. to debug Maven itself, use\n@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000\n@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files\n@REM ----------------------------------------------------------------------------\n\n@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on'\n@echo off\n@REM set title of command window\ntitle %0\n@REM enable echoing by setting MAVEN_BATCH_ECHO to 'on'\n@if \"%MAVEN_BATCH_ECHO%\" == \"on\"  echo %MAVEN_BATCH_ECHO%\n\n@REM set %HOME% to equivalent of $HOME\nif \"%HOME%\" == \"\" (set \"HOME=%HOMEDRIVE%%HOMEPATH%\")\n\n@REM Execute a user defined script before this one\nif not \"%MAVEN_SKIP_RC%\" == \"\" goto skipRcPre\n@REM check for pre script, once with legacy .bat ending and once with .cmd ending\nif exist \"%HOME%\\mavenrc_pre.bat\" call \"%HOME%\\mavenrc_pre.bat\"\nif exist \"%HOME%\\mavenrc_pre.cmd\" call \"%HOME%\\mavenrc_pre.cmd\"\n:skipRcPre\n\n@setlocal\n\nset ERROR_CODE=0\n\n@REM To isolate internal variables from possible post scripts, we use another setlocal\n@setlocal\n\n@REM ==== START VALIDATION ====\nif not \"%JAVA_HOME%\" == \"\" goto OkJHome\n\necho.\necho Error: JAVA_HOME not found in your environment. >&2\necho Please set the JAVA_HOME variable in your environment to match the >&2\necho location of your Java installation. >&2\necho.\ngoto error\n\n:OkJHome\nif exist \"%JAVA_HOME%\\bin\\java.exe\" goto init\n\necho.\necho Error: JAVA_HOME is set to an invalid directory. >&2\necho JAVA_HOME = \"%JAVA_HOME%\" >&2\necho Please set the JAVA_HOME variable in your environment to match the >&2\necho location of your Java installation. >&2\necho.\ngoto error\n\n@REM ==== END VALIDATION ====\n\n:init\n\n@REM Find the project base dir, i.e. the directory that contains the folder \".mvn\".\n@REM Fallback to current working directory if not found.\n\nset MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR%\nIF NOT \"%MAVEN_PROJECTBASEDIR%\"==\"\" goto endDetectBaseDir\n\nset EXEC_DIR=%CD%\nset WDIR=%EXEC_DIR%\n:findBaseDir\nIF EXIST \"%WDIR%\"\\.mvn goto baseDirFound\ncd ..\nIF \"%WDIR%\"==\"%CD%\" goto baseDirNotFound\nset WDIR=%CD%\ngoto findBaseDir\n\n:baseDirFound\nset MAVEN_PROJECTBASEDIR=%WDIR%\ncd \"%EXEC_DIR%\"\ngoto endDetectBaseDir\n\n:baseDirNotFound\nset MAVEN_PROJECTBASEDIR=%EXEC_DIR%\ncd \"%EXEC_DIR%\"\n\n:endDetectBaseDir\n\nIF NOT EXIST \"%MAVEN_PROJECTBASEDIR%\\.mvn\\jvm.config\" goto endReadAdditionalConfig\n\n@setlocal EnableExtensions EnableDelayedExpansion\nfor /F \"usebackq delims=\" %%a in (\"%MAVEN_PROJECTBASEDIR%\\.mvn\\jvm.config\") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a\n@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS%\n\n:endReadAdditionalConfig\n\nSET MAVEN_JAVA_EXE=\"%JAVA_HOME%\\bin\\java.exe\"\nset WRAPPER_JAR=\"%MAVEN_PROJECTBASEDIR%\\.mvn\\wrapper\\maven-wrapper.jar\"\nset WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain\n\nset DOWNLOAD_URL=\"https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar\"\n\nFOR /F \"tokens=1,2 delims==\" %%A IN (\"%MAVEN_PROJECTBASEDIR%\\.mvn\\wrapper\\maven-wrapper.properties\") DO (\n    IF \"%%A\"==\"wrapperUrl\" SET DOWNLOAD_URL=%%B\n)\n\n@REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central\n@REM This allows using the maven wrapper in projects that prohibit checking in binary data.\nif exist %WRAPPER_JAR% (\n    if \"%MVNW_VERBOSE%\" == \"true\" (\n        echo Found %WRAPPER_JAR%\n    )\n) else (\n    if not \"%MVNW_REPOURL%\" == \"\" (\n        SET DOWNLOAD_URL=\"%MVNW_REPOURL%/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar\"\n    )\n    if \"%MVNW_VERBOSE%\" == \"true\" (\n        echo Couldn't find %WRAPPER_JAR%, downloading it ...\n        echo Downloading from: %DOWNLOAD_URL%\n    )\n\n    powershell -Command \"&{\"^\n\t\t\"$webclient = new-object System.Net.WebClient;\"^\n\t\t\"if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {\"^\n\t\t\"$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');\"^\n\t\t\"}\"^\n\t\t\"[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')\"^\n\t\t\"}\"\n    if \"%MVNW_VERBOSE%\" == \"true\" (\n        echo Finished downloading %WRAPPER_JAR%\n    )\n)\n@REM End of extension\n\n@REM Provide a \"standardized\" way to retrieve the CLI args that will\n@REM work with both Windows and non-Windows executions.\nset MAVEN_CMD_LINE_ARGS=%*\n\n%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% \"-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%\" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %*\nif ERRORLEVEL 1 goto error\ngoto end\n\n:error\nset ERROR_CODE=1\n\n:end\n@endlocal & set ERROR_CODE=%ERROR_CODE%\n\nif not \"%MAVEN_SKIP_RC%\" == \"\" goto skipRcPost\n@REM check for post script, once with legacy .bat ending and once with .cmd ending\nif exist \"%HOME%\\mavenrc_post.bat\" call \"%HOME%\\mavenrc_post.bat\"\nif exist \"%HOME%\\mavenrc_post.cmd\" call \"%HOME%\\mavenrc_post.cmd\"\n:skipRcPost\n\n@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on'\nif \"%MAVEN_BATCH_PAUSE%\" == \"on\" pause\n\nif \"%MAVEN_TERMINATE_CMD%\" == \"on\" exit %ERROR_CODE%\n\nexit /B %ERROR_CODE%\n"
  },
  {
    "path": "pom.xml",
    "content": "<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n    <modelVersion>4.0.0</modelVersion>\n    <parent>\n        <groupId>org.jenkins-ci.plugins</groupId>\n        <artifactId>plugin</artifactId>\n        <version>4.58</version>\n    </parent>\n\n    <artifactId>metersphere-v3-jenkins-plugin</artifactId>\n    <version>3.1</version>\n    <packaging>hpi</packaging>\n    <groupId>io.metersphere</groupId>\n\n    <description>Adds a post-build step to integrate Jenkins with MeterSphere</description>\n    <url>https://wiki.jenkins-ci.org/display/JENKINS/MeterSphere</url>\n\n\n    <licenses>\n        <license>\n            <name>Apache License, Version 2.0</name>\n            <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>\n            <distribution>repo</distribution>\n        </license>\n    </licenses>\n\n    <repositories>\n        <repository>\n            <id>repo.jenkins-ci.org</id>\n            <url>https://repo.jenkins-ci.org/public/</url>\n        </repository>\n    </repositories>\n\n    <properties>\n        <!-- Baseline Jenkins version you use to build the plugin. Users must have this version or newer to run. -->\n        <jenkins.version>2.361.1</jenkins.version>\n        <java.level>8</java.level>\n        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>\n    </properties>\n\n    <dependencyManagement>\n        <dependencies>\n            <dependency>\n                <!-- Pick up common dependencies for the selected LTS line: https://github.com/jenkinsci/bom#usage -->\n                <groupId>io.jenkins.tools.bom</groupId>\n                <artifactId>bom-2.303.x</artifactId>\n                <version>1210.vcd41f6657f03</version>\n                <type>pom</type>\n                <scope>import</scope>\n            </dependency>\n        </dependencies>\n    </dependencyManagement>\n    <dependencies>\n\n\n        <dependency>\n            <groupId>com.alibaba</groupId>\n            <artifactId>fastjson</artifactId>\n            <version>1.2.83</version>\n        </dependency>\n        <dependency>\n            <groupId>org.jenkins-ci.plugins</groupId>\n            <artifactId>structs</artifactId>\n        </dependency>\n        <dependency>\n            <groupId>org.jenkins-ci.plugins.workflow</groupId>\n            <artifactId>workflow-cps</artifactId>\n            <optional>true</optional>\n        </dependency>\n        <dependency>\n            <groupId>org.jenkins-ci.plugins.workflow</groupId>\n            <artifactId>workflow-job</artifactId>\n            <optional>true</optional>\n        </dependency>\n        <dependency>\n            <groupId>org.jenkins-ci.plugins.workflow</groupId>\n            <artifactId>workflow-basic-steps</artifactId>\n            <optional>true</optional>\n        </dependency>\n        <dependency>\n            <groupId>org.jenkins-ci.plugins.workflow</groupId>\n            <artifactId>workflow-durable-task-step</artifactId>\n            <optional>true</optional>\n        </dependency>\n    </dependencies>\n\n    <pluginRepositories>\n        <pluginRepository>\n            <id>repo.jenkins-ci.org</id>\n            <url>https://repo.jenkins-ci.org/artifactory/public/</url>\n        </pluginRepository>\n    </pluginRepositories>\n\n    <build>\n        <plugins>\n            <plugin>\n                <artifactId>maven-release-plugin</artifactId>\n            </plugin>\n            <plugin>\n                <groupId>org.apache.maven.plugins</groupId>\n                <artifactId>maven-surefire-plugin</artifactId>\n                <configuration>\n                    <argLine>-XX:-UseSplitVerifier</argLine>\n                    <skip>true</skip>\n                </configuration>\n            </plugin>\n        </plugins>\n    </build>\n\n\n</project>\n"
  },
  {
    "path": "src/main/java/io/metersphere/v3/MeterSphereBuilder.java",
    "content": "package io.metersphere.v3;\n\nimport hudson.*;\nimport hudson.model.*;\nimport hudson.tasks.BuildStepDescriptor;\nimport hudson.tasks.BuildStepMonitor;\nimport hudson.tasks.Builder;\nimport hudson.util.FormValidation;\nimport hudson.util.ListBoxModel;\nimport io.metersphere.v3.client.MeterSphereClient;\nimport io.metersphere.v3.commons.model.OrganizationDTO;\nimport io.metersphere.v3.commons.model.ProjectDTO;\nimport io.metersphere.v3.commons.model.TestPlanDTO;\nimport io.metersphere.v3.commons.utils.LogUtil;\nimport io.metersphere.v3.commons.utils.MeterSphereUtils;\nimport jenkins.tasks.SimpleBuildStep;\nimport net.sf.json.JSONObject;\nimport org.apache.commons.lang.StringUtils;\nimport org.jenkinsci.Symbol;\nimport org.kohsuke.stapler.DataBoundConstructor;\nimport org.kohsuke.stapler.DataBoundSetter;\nimport org.kohsuke.stapler.QueryParameter;\nimport org.kohsuke.stapler.StaplerRequest;\n\nimport javax.annotation.Nonnull;\nimport java.io.IOException;\nimport java.io.Serializable;\nimport java.util.ArrayList;\nimport java.util.List;\nimport java.util.Optional;\n\npublic class MeterSphereBuilder extends Builder implements SimpleBuildStep, Serializable {\n\n    private static final String LOG_PREFIX = \"[MeterSphere] \";\n    private MeterSphereUtils meterSphereUtils;\n\n    private final String msEndpoint;\n    private final String msAccessKey;\n    private final String msSecretKey;\n\n    private String organizationId;\n    private String projectName;\n    private String testPlanName;\n    private String result;\n\n    @DataBoundConstructor\n    public MeterSphereBuilder(String msEndpoint, String msAccessKey, String msSecretKey) {\n        this.msEndpoint = msEndpoint;\n        this.msAccessKey = msAccessKey;\n        this.msSecretKey = msSecretKey;\n    }\n\n    @Override\n    public void perform(@Nonnull Run<?, ?> run, @Nonnull FilePath workspace, @Nonnull Launcher launcher,\n                        @Nonnull TaskListener listener) throws InterruptedException, IOException {\n        this.meterSphereUtils = new MeterSphereUtils(listener.getLogger());\n        listener.getLogger().println(\"workspace=\" + workspace);\n        listener.getLogger().println(\"number=\" + run.getNumber());\n        listener.getLogger().println(\"url=\" + run.getUrl());\n        final MeterSphereClient client = new MeterSphereClient(this.msAccessKey, this.msSecretKey, this.msEndpoint);\n\n        try {\n            EnvVars environment = run.getEnvironment(listener);\n\n            // 找到实际的project\n            String realProjectId = \"\";\n            realProjectId = Util.replaceMacro(this.projectName, environment);\n            if (StringUtils.isNotBlank(realProjectId)) {\n                List<ProjectDTO> projectIds = client.getProjectIds(organizationId);\n                String finalRealProjectId = realProjectId;\n                Optional<ProjectDTO> project = projectIds.stream()\n                        .filter(projectDTO -> projectDTO.getName().equals(finalRealProjectId) || projectDTO.getId().equals(finalRealProjectId))\n                        .findFirst();\n                if (project.isPresent()) {\n                    realProjectId = project.get().getId();\n                }\n            }\n\n            boolean result = false;\n            String testPlanName = Util.replaceMacro(this.testPlanName, environment);\n\n            List<TestPlanDTO> testPlans = client.getTestPlanIds(realProjectId);\n            Optional<TestPlanDTO> first = testPlans.stream()\n                    .filter(plan -> StringUtils.equals(testPlanName, meterSphereUtils.handleTestPlanName(plan.getId(), plan.getNum()))\n                            || StringUtils.equals(testPlanName, meterSphereUtils.handleTestPlanName(plan.getName(), plan.getNum())))\n                    .findFirst();\n\n            if (!first.isPresent()) {\n                log(\"测试计划不存在\");\n                run.setResult(Result.FAILURE);\n                return;\n            }\n            result = meterSphereUtils.runTestPlan(run, client, first.get(), organizationId, realProjectId, msEndpoint);\n            // 使用case的结果\n            run.setResult(result ? Result.SUCCESS : Result.FAILURE);\n        } catch (Exception e) {\n            run.setResult(Result.FAILURE);\n            log(\"该测试请求未能通过，登录MeterSphere网站查看该报告结果\");\n        }\n\n    }\n\n    public BuildStepMonitor getRequiredMonitorService() {\n        return BuildStepMonitor.STEP;\n    }\n\n    @Symbol(\"MeterSphereV3\")\n    @Extension // This indicates to Jenkins that this is an implementation of an extension point.\n    public static final class DescriptorImpl extends BuildStepDescriptor<Builder> {\n        private String msAccessKey;\n        private String msSecretKey;\n        private String msEndpoint;\n\n        private List<TestPlanDTO> testPlanList = new ArrayList<>();\n        private List<ProjectDTO> projectList = new ArrayList<>();\n\n\n        public FormValidation doCheckAccount(\n                @QueryParameter String msAccessKey,\n                @QueryParameter String msSecretKey,\n                @QueryParameter String msEndpoint) throws IOException {\n            if (StringUtils.isEmpty(msAccessKey)) {\n                return FormValidation.error(\"MeterSphere ConsumerKey不能为空！\");\n            }\n            if (StringUtils.isEmpty(msSecretKey)) {\n                return FormValidation.error(\"MeterSphere SecretKey不能为空！\");\n            }\n            if (StringUtils.isEmpty(msEndpoint)) {\n                return FormValidation.error(\"MeterSphere EndPoint不能为空！\");\n            }\n            this.msAccessKey = msAccessKey;\n            this.msSecretKey = msSecretKey;\n            this.msEndpoint = msEndpoint;\n            try {\n                MeterSphereClient meterSphereClient = new MeterSphereClient(msAccessKey, msSecretKey, msEndpoint);\n                meterSphereClient.checkUser();\n            } catch (Exception e) {\n                LogUtil.error(e.getMessage(), e);\n                return FormValidation.error(\"验证MeterSphere帐号失败！\" + e + \",\" + e.getMessage());\n            }\n            return FormValidation.ok(\"验证MeterSphere帐号成功！\");\n        }\n\n        //用户所属组织\n        public ListBoxModel doFillOrganizationIdItems(@QueryParameter String msAccessKey,\n                                                      @QueryParameter String msSecretKey,\n                                                      @QueryParameter String msEndpoint\n        ) {\n            ListBoxModel items = new ListBoxModel();\n            items.add(\"请选择组织\", \"\");\n            if (StringUtils.isEmpty(msAccessKey) || StringUtils.isEmpty(msSecretKey) || StringUtils.isEmpty(msEndpoint)) {\n                return items;\n            }\n            this.msAccessKey = msAccessKey;\n            this.msSecretKey = msSecretKey;\n            this.msEndpoint = msEndpoint;\n\n            try {\n                MeterSphereClient meterSphereClient = new MeterSphereClient(msAccessKey, msSecretKey, msEndpoint);\n                List<OrganizationDTO> list;\n                list = meterSphereClient.getOrganization();\n                if (list != null && list.size() > 0) {\n                    for (OrganizationDTO c : list) {\n                        items.add(c.getName(), c.getId());\n                    }\n                }\n            } catch (Exception e) {\n                LogUtil.error(e.getMessage(), e);\n            }\n            return items;\n\n        }\n\n        public AutoCompletionCandidates doAutoCompleteProjectName(@QueryParameter String value) {\n            AutoCompletionCandidates c = new AutoCompletionCandidates();\n            if (StringUtils.isBlank(value)) {\n                projectList.stream().map(ProjectDTO::getName).forEach(c::add);\n            } else {\n                projectList.stream().map(ProjectDTO::getName).forEach(v -> {\n                    if (v.toLowerCase().contains(value.toLowerCase())) {\n                        c.add(v);\n                    }\n                });\n            }\n            return c;\n        }\n\n\n        public AutoCompletionCandidates doAutoCompleteTestPlanName(@QueryParameter String value) {\n\n            AutoCompletionCandidates c = new AutoCompletionCandidates();\n\n            if (StringUtils.isBlank(value)) {\n                testPlanList.stream().map(model -> \"[\" + model.getNum() + \"] \" + model.getName()).forEach(c::add);\n            } else {\n                testPlanList.stream().map(model -> \"[\" + model.getNum() + \"] \" + model.getName()).forEach(v -> {\n                    if (v.toLowerCase().contains(value.toLowerCase())) {\n                        c.add(v);\n                    }\n                });\n            }\n\n            return c;\n        }\n\n\n        @Override\n        public boolean configure(StaplerRequest req, JSONObject formData) throws FormException {\n            req.bindParameters(this);\n            save();\n            return super.configure(req, formData);\n        }\n\n        public boolean isApplicable(Class<? extends AbstractProject> aClass) {\n            return true;\n        }\n\n        public String getDisplayName() {\n            return \"MeterSphere V3\";\n        }\n\n        public void doCheckSelectOrganizationOption(@QueryParameter String value) {\n            if (StringUtils.isBlank(value)) {\n                return;\n            }\n            MeterSphereClient meterSphereClient = new MeterSphereClient(msAccessKey, msSecretKey, msEndpoint);\n            projectList = meterSphereClient.getProjectIds(value);\n        }\n\n        public void doCheckSelectProjectOption(@QueryParameter String value) {\n            Optional<ProjectDTO> first = projectList.stream().filter(project -> StringUtils.equals(project.getName(), value)).findFirst();\n            if (first.isPresent()) {\n                ProjectDTO projectDTO = first.get();\n                MeterSphereClient meterSphereClient = new MeterSphereClient(msAccessKey, msSecretKey, msEndpoint);\n                testPlanList = meterSphereClient.getTestPlanIds(projectDTO.getId());\n            }\n        }\n    }\n\n    @Override\n    public DescriptorImpl getDescriptor() {\n        return (DescriptorImpl) super.getDescriptor();\n    }\n\n\n    private void log(String msg) {\n        meterSphereUtils.log(LOG_PREFIX + msg);\n    }\n\n    @DataBoundSetter\n    public void setOrganizationId(String organizationId) {\n        this.organizationId = organizationId;\n    }\n\n\n    @DataBoundSetter\n    public void setProjectName(String projectName) {\n        this.projectName = projectName;\n    }\n\n\n    @DataBoundSetter\n    public void setTestPlanName(String testPlanName) {\n        this.testPlanName = testPlanName;\n    }\n\n\n    @DataBoundSetter\n    public void setResult(String result) {\n        this.result = result;\n    }\n\n    public String getMsEndpoint() {\n        return msEndpoint;\n    }\n\n    public String getMsAccessKey() {\n        return msAccessKey;\n    }\n\n    public String getMsSecretKey() {\n        return msSecretKey;\n    }\n\n    public String getOrganizationId() {\n        return organizationId;\n    }\n\n    public String getProjectName() {\n        return projectName;\n    }\n\n    public String getTestPlanName() {\n        return testPlanName;\n    }\n\n\n    public String getResult() {\n        return result;\n    }\n\n}\n"
  },
  {
    "path": "src/main/java/io/metersphere/v3/ResultHolder.java",
    "content": "package io.metersphere.v3;\n\nimport org.apache.commons.lang.builder.ReflectionToStringBuilder;\nimport org.apache.commons.lang.builder.ToStringStyle;\n\npublic class ResultHolder {\n    public ResultHolder() {\n        this.success = true;\n    }\n\n    private ResultHolder(Object data) {\n        this.data = data;\n        this.success = true;\n    }\n\n    private ResultHolder(boolean success, String msg) {\n        this.success = success;\n        this.message = msg;\n    }\n\n    private ResultHolder(boolean success, String msg, Object data) {\n        this.success = success;\n        this.message = msg;\n        this.data = data;\n    }\n\n    // 请求是否成功\n    private boolean success = false;\n    // 描述信息\n    private String message;\n    // 返回数据\n    private Object data = \"\";\n\n    public boolean isSuccess() {\n        return this.success;\n    }\n\n    public void setSuccess(boolean success) {\n        this.success = success;\n    }\n\n    public String getMessage() {\n        return message;\n    }\n\n    public void setMessage(String message) {\n        this.message = message;\n    }\n\n    public Object getData() {\n        return data;\n    }\n\n    public void setData(Object data) {\n        this.data = data;\n    }\n\n    public static ResultHolder success(Object obj) {\n        return new ResultHolder(obj);\n    }\n\n    public static ResultHolder error(String message) {\n        return new ResultHolder(false, message, null);\n    }\n\n    public static ResultHolder error(String message, Object object) {\n        return new ResultHolder(false, message, object);\n    }\n\n    public String toString() {\n        return ReflectionToStringBuilder.toString(this, ToStringStyle.SHORT_PREFIX_STYLE);\n    }\n}\n"
  },
  {
    "path": "src/main/java/io/metersphere/v3/client/MeterSphereClient.java",
    "content": "package io.metersphere.v3.client;\n\nimport com.alibaba.fastjson.JSON;\nimport com.alibaba.fastjson.JSONObject;\nimport io.metersphere.v3.ResultHolder;\nimport io.metersphere.v3.commons.constants.ApiUrlConstants;\nimport io.metersphere.v3.commons.constants.RequestMethod;\nimport io.metersphere.v3.commons.exception.MeterSphereException;\nimport io.metersphere.v3.commons.model.EnvironmentPoolDTO;\nimport io.metersphere.v3.commons.model.OrganizationDTO;\nimport io.metersphere.v3.commons.model.ProjectDTO;\nimport io.metersphere.v3.commons.model.TestPlanDTO;\nimport io.metersphere.v3.commons.utils.HttpClientConfig;\nimport io.metersphere.v3.commons.utils.HttpClientUtil;\nimport io.metersphere.v3.commons.utils.LogUtil;\nimport org.apache.commons.codec.binary.Base64;\nimport org.apache.commons.lang.StringUtils;\n\nimport javax.crypto.Cipher;\nimport javax.crypto.spec.IvParameterSpec;\nimport javax.crypto.spec.SecretKeySpec;\nimport java.nio.charset.StandardCharsets;\nimport java.util.HashMap;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.UUID;\nimport java.util.concurrent.ExecutorService;\nimport java.util.concurrent.Executors;\n\npublic class MeterSphereClient {\n\n\n    private static final String ACCEPT = \"application/json;charset=UTF-8\";\n\n    private final String accessKey;\n    private final String secretKey;\n    private final String endpoint;\n\n    private final static ExecutorService executorService = Executors.newFixedThreadPool(5);\n\n    public MeterSphereClient(String accessKey, String secretKey, String endpoint) {\n\n        this.accessKey = accessKey;\n        this.secretKey = secretKey;\n        this.endpoint = endpoint;\n    }\n\n    /*校验账号*/\n    public String checkUser() {\n        ResultHolder getUserResult = call(ApiUrlConstants.USER_INFO);\n        if (!getUserResult.isSuccess()) {\n            throw new MeterSphereException(getUserResult.getMessage());\n        }\n        return getUserResult.getData().toString();\n    }\n\n    /*获取组织下组织*/\n    public List<OrganizationDTO> getOrganization() {\n        if (this.checkLicense()) {\n            String url = ApiUrlConstants.LIST_USER_ORGANIZATION;\n            ResultHolder result = call(url);\n            String list = JSON.toJSONString(result.getData());\n            LogUtil.info(\"用户所属组织: \" + list);\n            return JSON.parseArray(list, OrganizationDTO.class);\n        } else {\n            String url = ApiUrlConstants.LIST_DEFAULT_ORGANIZATION;\n            ResultHolder result = call(url);\n            String list = JSON.toJSONString(result.getData());\n            LogUtil.info(\"用户所属组织: \" + list);\n            return JSON.parseArray(\"[\" + list + \"]\", OrganizationDTO.class);\n        }\n    }\n\n    /*获取组织下项目列表*/\n    public List<ProjectDTO> getProjectIds(String organizationId) {\n        ResultHolder result = call(ApiUrlConstants.PROJECT_LIST_ALL + \"/\" + organizationId);\n        String listJson = JSON.toJSONString(result.getData());\n        LogUtil.info(\"用户所属项目: \" + listJson);\n        return JSON.parseArray(listJson, ProjectDTO.class);\n\n    }\n\n    /*查询该项目下所有测试计划*/\n    public List<TestPlanDTO> getTestPlanIds(String projectId) {\n        Map<String, String> params = new HashMap<>();\n        params.put(\"projectId\", projectId);\n        params.put(\"pageSize\", \"500\");\n        params.put(\"current\", \"1\");\n        params.put(\"type\", \"ALL\");\n        ResultHolder result = call(ApiUrlConstants.PLAN_LIST_ALL, RequestMethod.POST, params);\n        String listJson = JSON.toJSONString(result.getData());\n        LogUtil.info(\"该项目下的所有的测试计划: \" + listJson);\n        return JSON.parseArray(JSON.parseObject(listJson).getJSONArray(\"list\").toJSONString(), TestPlanDTO.class);\n    }\n\n    /*资源池列表*/\n    public List<EnvironmentPoolDTO> getPoolEnvironmentIds() {\n        ResultHolder result = call(ApiUrlConstants.TEST_POOL);\n        String listJson = JSON.toJSONString(result.getData());\n        LogUtil.debug(\"该项目下的资源池列表\" + listJson);\n        return JSON.parseArray(listJson, EnvironmentPoolDTO.class);\n    }\n\n    /*执行测试计划*/\n    public String exeTestPlan(String testPlanId) {\n        HashMap<String, Object> params = new HashMap<>();\n        params.put(\"executeId\", testPlanId);\n        params.put(\"executionSource\", \"API\");\n\n        ResultHolder result = call(ApiUrlConstants.TEST_PLAN_EXECUTE, RequestMethod.POST, params);\n        if (result.getData() instanceof String) {\n            return (String) result.getData();\n        }\n        return JSON.toJSONString(result.getData());\n    }\n\n    /*查询测试计划报告状态*/\n    public String getStatus(String reportId) {\n        ResultHolder result = call(ApiUrlConstants.TEST_PLAN_STATUS + \"/\" + reportId);\n        JSONObject jsonObject = JSON.parseObject(JSON.toJSONString(result.getData()));\n        if (jsonObject == null) {\n            return null;\n        }\n        return jsonObject.getString(\"resultStatus\");\n    }\n\n\n    public void changeState(String id, String status) {\n        HashMap<String, Object> params = new HashMap<>();\n        params.put(\"id\", id);\n        params.put(\"status\", status);\n        call(ApiUrlConstants.CHANGE_STATE, RequestMethod.POST, params);\n    }\n\n    private ResultHolder call(String url) {\n        return call(url, RequestMethod.GET, null);\n    }\n\n    private ResultHolder call(String url, RequestMethod requestMethod, Object params) {\n        url = this.endpoint + url;\n        String responseJson;\n\n        HttpClientConfig config = auth();\n        if (requestMethod.equals(RequestMethod.GET)) {\n            responseJson = HttpClientUtil.get(url, config);\n        } else {\n            responseJson = HttpClientUtil.post(url, JSON.toJSONString(params), config);\n        }\n\n        ResultHolder result = JSON.parseObject(responseJson, ResultHolder.class);\n        if (!result.isSuccess()) {\n            throw new MeterSphereException(result.getMessage());\n        }\n        return JSON.parseObject(responseJson, ResultHolder.class);\n    }\n\n    private HttpClientConfig auth() {\n        HttpClientConfig httpClientConfig = new HttpClientConfig();\n        httpClientConfig.addHeader(\"Accept\", ACCEPT);\n        httpClientConfig.addHeader(\"accessKey\", accessKey);\n        httpClientConfig.addHeader(\"Content-type\", \"application/json\");\n        String signature;\n        try {\n            signature = aesEncrypt(accessKey + \"|\" + UUID.randomUUID() + \"|\" + System.currentTimeMillis(), secretKey, accessKey);\n        } catch (Exception e) {\n            LogUtil.error(e.getMessage(), e);\n            throw new MeterSphereException(\"签名失败: \" + e.getMessage());\n        }\n        httpClientConfig.addHeader(\"signature\", signature);\n        return httpClientConfig;\n    }\n\n    private static String aesEncrypt(String src, String secretKey, String iv) throws Exception {\n        byte[] raw = secretKey.getBytes(StandardCharsets.UTF_8);\n        SecretKeySpec secretKeySpec = new SecretKeySpec(raw, \"AES\");\n        Cipher cipher = Cipher.getInstance(\"AES/CBC/PKCS5Padding\");\n        IvParameterSpec iv1 = new IvParameterSpec(iv.getBytes());\n        cipher.init(Cipher.ENCRYPT_MODE, secretKeySpec, iv1);\n        byte[] encrypted = cipher.doFinal(src.getBytes(StandardCharsets.UTF_8));\n        return Base64.encodeBase64String(encrypted);\n    }\n\n\n    public boolean checkLicense() {\n        ResultHolder result = call(ApiUrlConstants.LICENSE_VALIDATE);\n        JSONObject jsonObject = JSONObject.parseObject(JSONObject.toJSONString(result.getData()));\n        return StringUtils.equals(\"valid\", jsonObject.getString(\"status\"));\n    }\n\n    public String getShareInfo(Map<String, String> params) {\n        ResultHolder result = call(ApiUrlConstants.TEST_PLAN_REPORT_SHARE, RequestMethod.POST, params);\n        JSONObject jsonObject = JSONObject.parseObject(JSONObject.toJSONString(result.getData()));\n        return jsonObject.getString(\"shareUrl\");\n    }\n}\n\n"
  },
  {
    "path": "src/main/java/io/metersphere/v3/commons/constants/ApiUrlConstants.java",
    "content": "package io.metersphere.v3.commons.constants;\n\npublic class ApiUrlConstants {\n    public static final String USER_INFO = \"/user/api/key/validate\";//身份验证\n    public static final String LIST_USER_ORGANIZATION = \"/system/organization/switch-option\";//所属组织\n    public static final String LIST_DEFAULT_ORGANIZATION = \"/system/organization/default\";//所属组织\n    public static final String PROJECT_LIST_ALL = \"/project/list/options\";//项目列表\n    public static final String PLAN_LIST_ALL = \"/test-plan/page\";//测试计划项目下\n    public static final String CHANGE_STATE = \"/track/test/plan/case/edit\";//更新测试计划用例的结果\n    public static final String LICENSE_VALIDATE = \"/license/validate\";//查询LICENSE\n    public static final String TEST_POOL = \"/setting/testresourcepool/list/quota/valid\";\n    public static final String TEST_PLAN_EXECUTE = \"/test-plan-execute/single\";//测试计划执行\n    public static final String TEST_PLAN_STATUS = \"/test-plan/report/get\";//测试计划执行\n    public static final String TEST_PLAN_REPORT_SHARE = \"/test-plan/report/share/gen\";//测试计划执行\n\n}\n"
  },
  {
    "path": "src/main/java/io/metersphere/v3/commons/constants/Method.java",
    "content": "package io.metersphere.v3.commons.constants;\n\npublic class Method {\n    public static final String TEST_PLAN = \"testPlan\";\n    public static final String TEST_PLAN_NAME = \"testPlanName\";\n    public static final String SINGLE = \"single\";\n    public static final String SINGLE_NAME = \"singleName\";\n}\n"
  },
  {
    "path": "src/main/java/io/metersphere/v3/commons/constants/RequestMethod.java",
    "content": "package io.metersphere.v3.commons.constants;\n\npublic enum RequestMethod {\n    GET, POST\n}\n"
  },
  {
    "path": "src/main/java/io/metersphere/v3/commons/constants/Results.java",
    "content": "package io.metersphere.v3.commons.constants;\n\npublic class Results {\n    public static final String COMPLETED = \"Completed\";\n    public static final String FAILURE = \"Failure\";\n    public static final String SUCCESS = \"Success\";\n    public static final String API = \"api\";\n    public static final String STOPPED = \"STOPPED\";\n    public static final String ERROR = \"ERROR\";\n}\n"
  },
  {
    "path": "src/main/java/io/metersphere/v3/commons/exception/MeterSphereException.java",
    "content": "package io.metersphere.v3.commons.exception;\n\npublic class MeterSphereException extends RuntimeException {\n    private static final long serialVersionUID = -649559784594858788L;\n\n    public MeterSphereException() {\n    }\n\n    public MeterSphereException(String message, Throwable cause) {\n        super(message, cause);\n    }\n\n    public MeterSphereException(String message) {\n        super(message);\n    }\n\n    public MeterSphereException(Throwable cause) {\n        super(cause);\n    }\n}\n"
  },
  {
    "path": "src/main/java/io/metersphere/v3/commons/model/ApiTestEnvironmentDTO.java",
    "content": "package io.metersphere.v3.commons.model;\n\npublic class ApiTestEnvironmentDTO {\n    private String id;\n    private String name;\n    private String config;\n\n    public String getId() {\n        return id;\n    }\n\n    public void setId(String id) {\n        this.id = id;\n    }\n\n    public String getName() {\n        return name;\n    }\n\n    public void setName(String name) {\n        this.name = name;\n    }\n\n    public String getConfig() {\n        return config;\n    }\n\n    public void setConfig(String config) {\n        this.config = config;\n    }\n}\n"
  },
  {
    "path": "src/main/java/io/metersphere/v3/commons/model/BaseSystemConfigDTO.java",
    "content": "package io.metersphere.v3.commons.model;\n\npublic class BaseSystemConfigDTO {\n   private String url;\n}\n"
  },
  {
    "path": "src/main/java/io/metersphere/v3/commons/model/EnvironmentPoolDTO.java",
    "content": "package io.metersphere.v3.commons.model;\n\n\npublic class EnvironmentPoolDTO {\n\n    private String id;\n\n    private String name;\n\n    private String type;\n\n    private String status;\n\n    public String getId() {\n        return id;\n    }\n\n    public void setId(String id) {\n        this.id = id;\n    }\n\n    public String getName() {\n        return name;\n    }\n\n    public void setName(String name) {\n        this.name = name;\n    }\n\n    public String getType() {\n        return type;\n    }\n\n    public void setType(String type) {\n        this.type = type;\n    }\n\n    public String getStatus() {\n        return status;\n    }\n\n    public void setStatus(String status) {\n        this.status = status;\n    }\n}\n"
  },
  {
    "path": "src/main/java/io/metersphere/v3/commons/model/MsExecResponseDTO.java",
    "content": "package io.metersphere.v3.commons.model;\n\npublic class MsExecResponseDTO {\n\n    private String testId;\n\n    private String reportId;\n\n    private String runMode;\n\n    public MsExecResponseDTO() {\n\n    }\n\n    public MsExecResponseDTO(String testId, String reportId, String runMode) {\n        this.testId = testId;\n        this.reportId = reportId;\n        this.runMode = runMode;\n    }\n\n    public String getTestId() {\n        return testId;\n    }\n\n    public void setTestId(String testId) {\n        this.testId = testId;\n    }\n\n    public String getReportId() {\n        return reportId;\n    }\n\n    public void setReportId(String reportId) {\n        this.reportId = reportId;\n    }\n\n    public String getRunMode() {\n        return runMode;\n    }\n\n    public void setRunMode(String runMode) {\n        this.runMode = runMode;\n    }\n}\n"
  },
  {
    "path": "src/main/java/io/metersphere/v3/commons/model/OrgDTO.java",
    "content": "package io.metersphere.v3.commons.model;\n\npublic class OrgDTO {\n    private String id;\n    private String name;\n\n    public String getId() {\n        return id;\n    }\n\n    public void setId(String id) {\n        this.id = id;\n    }\n\n    public String getName() {\n        return name;\n    }\n\n    public void setName(String name) {\n        this.name = name;\n    }\n}\n"
  },
  {
    "path": "src/main/java/io/metersphere/v3/commons/model/OrganizationDTO.java",
    "content": "package io.metersphere.v3.commons.model;\n\nimport java.io.Serializable;\n\npublic class OrganizationDTO implements Serializable {\n    private String id;\n\n    private String organizationId;\n\n    private String name;\n\n    private String description;\n\n    private Long createTime;\n\n    /**\n     * This field was generated by MyBatis Generator.\n     * This field corresponds to the database table workspace\n     *\n     *\n     */\n    private static final long serialVersionUID = 1L;\n\n    /**\n     * This method was generated by MyBatis Generator.\n     * This method returns the value of the database column workspace.id\n     *\n     * @return the value of workspace.id\n     *\n     */\n    public String getId() {\n        return id;\n    }\n\n    /**\n     * This method was generated by MyBatis Generator.\n     * This method sets the value of the database column workspace.id\n     *\n     * @param id the value for workspace.id\n     *\n     */\n    public void setId(String id) {\n        this.id = id == null ? null : id.trim();\n    }\n\n    /**\n     * This method was generated by MyBatis Generator.\n     * This method returns the value of the database column workspace.organization_id\n     *\n     * @return the value of workspace.organization_id\n     *\n     */\n    public String getOrganizationId() {\n        return organizationId;\n    }\n\n    /**\n     * This method was generated by MyBatis Generator.\n     * This method sets the value of the database column workspace.organization_id\n     *\n     * @param organizationId the value for workspace.organization_id\n     *\n     */\n    public void setOrganizationId(String organizationId) {\n        this.organizationId = organizationId == null ? null : organizationId.trim();\n    }\n\n    /**\n     * This method was generated by MyBatis Generator.\n     * This method returns the value of the database column workspace.name\n     *\n     * @return the value of workspace.name\n     *\n     */\n    public String getName() {\n        return name;\n    }\n\n    /**\n     * This method was generated by MyBatis Generator.\n     * This method sets the value of the database column workspace.name\n     *\n     * @param name the value for workspace.name\n     *\n     */\n    public void setName(String name) {\n        this.name = name == null ? null : name.trim();\n    }\n\n    /**\n     * This method was generated by MyBatis Generator.\n     * This method returns the value of the database column workspace.description\n     *\n     * @return the value of workspace.description\n     *\n     */\n    public String getDescription() {\n        return description;\n    }\n\n    /**\n     * This method was generated by MyBatis Generator.\n     * This method sets the value of the database column workspace.description\n     *\n     * @param description the value for workspace.description\n     *\n     */\n    public void setDescription(String description) {\n        this.description = description == null ? null : description.trim();\n    }\n\n    /**\n     * This method was generated by MyBatis Generator.\n     * This method returns the value of the database column workspace.create_time\n     *\n     * @return the value of workspace.create_time\n     *\n     */\n    public Long getCreateTime() {\n        return createTime;\n    }\n\n    /**\n     * This method was generated by MyBatis Generator.\n     * This method sets the value of the database column workspace.create_time\n     *\n     * @param createTime the value for workspace.create_time\n     *\n     */\n    public void setCreateTime(Long createTime) {\n        this.createTime = createTime;\n    }\n}\n"
  },
  {
    "path": "src/main/java/io/metersphere/v3/commons/model/ProjectDTO.java",
    "content": "package io.metersphere.v3.commons.model;\n\n\n\npublic class ProjectDTO {\n    private String id;\n    private String name;\n    private String organizationId;\n    private String organizationName;\n    private String description;\n    private Long createTime;\n    private Long updateTime;\n\n    public String getId() {\n        return id;\n    }\n\n    public String getName() {\n        return name;\n    }\n\n    public String getOrganizationId() {\n        return organizationId;\n    }\n\n    public String getOrganizationName() {\n        return organizationName;\n    }\n\n    public String getDescription() {\n        return description;\n    }\n\n    public Long getCreateTime() {\n        return createTime;\n    }\n\n    public Long getUpdateTime() {\n        return updateTime;\n    }\n\n    public void setId(String id) {\n        this.id = id;\n    }\n\n    public void setName(String name) {\n        this.name = name;\n    }\n\n    public void setOrganizationId(String organizationId) {\n        this.organizationId = organizationId;\n    }\n\n    public void setOrganizationName(String organizationName) {\n        this.organizationName = organizationName;\n    }\n\n    public void setDescription(String description) {\n        this.description = description;\n    }\n\n    public void setCreateTime(Long createTime) {\n        this.createTime = createTime;\n    }\n\n    public void setUpdateTime(Long updateTime) {\n        this.updateTime = updateTime;\n    }\n}\n"
  },
  {
    "path": "src/main/java/io/metersphere/v3/commons/model/RunModeConfig.java",
    "content": "package io.metersphere.v3.commons.model;\n\npublic class RunModeConfig {\n    private String mode;\n    private String reportType;\n    private String reportName;\n    private String reportId;\n    private boolean onSampleError;\n    private String resourcePoolId;\n\n    public String getMode() {\n        return mode;\n    }\n\n    public void setMode(String mode) {\n        this.mode = mode;\n    }\n\n    public String getReportType() {\n        return reportType;\n    }\n\n    public void setReportType(String reportType) {\n        this.reportType = reportType;\n    }\n\n    public String getReportName() {\n        return reportName;\n    }\n\n    public void setReportName(String reportName) {\n        this.reportName = reportName;\n    }\n\n    public String getReportId() {\n        return reportId;\n    }\n\n    public void setReportId(String reportId) {\n        this.reportId = reportId;\n    }\n\n    public boolean isOnSampleError() {\n        return onSampleError;\n    }\n\n    public void setOnSampleError(boolean onSampleError) {\n        this.onSampleError = onSampleError;\n    }\n\n    public String getResourcePoolId() {\n        return resourcePoolId;\n    }\n\n    public void setResourcePoolId(String resourcePoolId) {\n        this.resourcePoolId = resourcePoolId;\n    }\n}\n"
  },
  {
    "path": "src/main/java/io/metersphere/v3/commons/model/TestDTO.java",
    "content": "package io.metersphere.v3.commons.model;\n\npublic class TestDTO {\n    private String id;\n    private String name;\n    private String status;\n    private String project_id;\n    private String type;\n\n    public String getId() {\n        return id;\n    }\n\n    public void setId(String id) {\n        this.id = id;\n    }\n\n    public String getName() {\n        return name;\n    }\n\n    public void setName(String name) {\n        this.name = name;\n    }\n\n    public String getStatus() {\n        return status;\n    }\n\n    public void setStatus(String status) {\n        this.status = status;\n    }\n\n    public String getProject_id() {\n        return project_id;\n    }\n\n    public void setProject_id(String project_id) {\n        this.project_id = project_id;\n    }\n\n    public String getType() {\n        return type;\n    }\n\n    public void setType(String type) {\n        this.type = type;\n    }\n}\n"
  },
  {
    "path": "src/main/java/io/metersphere/v3/commons/model/TestPlanDTO.java",
    "content": "package io.metersphere.v3.commons.model;\n\npublic class TestPlanDTO {\n    private String projectName;\n\n    private String id;\n\n    private String projectId;\n\n    private String workspaceId;\n\n    private String reportId;\n\n    private String name;\n\n    private String num;\n\n    private String description;\n\n    private String status;\n\n    private String stage;\n\n    private String principal;\n\n    private String testCaseMatchRule;\n\n    private String executorMatchRule;\n\n    private Long createTime;\n\n    private Long updateTime;\n\n    private String tags;\n\n    private String type;\n\n    private static final long serialVersionUID = 1L;\n\n    public String getProjectName() {\n        return projectName;\n    }\n\n    public void setProjectName(String projectName) {\n        this.projectName = projectName;\n    }\n\n    public String getId() {\n        return id;\n    }\n\n    public void setId(String id) {\n        this.id = id;\n    }\n\n    public String getProjectId() {\n        return projectId;\n    }\n\n    public void setProjectId(String projectId) {\n        this.projectId = projectId;\n    }\n\n    public String getWorkspaceId() {\n        return workspaceId;\n    }\n\n    public void setWorkspaceId(String workspaceId) {\n        this.workspaceId = workspaceId;\n    }\n\n    public String getReportId() {\n        return reportId;\n    }\n\n    public void setReportId(String reportId) {\n        this.reportId = reportId;\n    }\n\n    public String getName() {\n        return name;\n    }\n\n    public void setName(String name) {\n        this.name = name;\n    }\n\n    public String getDescription() {\n        return description;\n    }\n\n    public void setDescription(String description) {\n        this.description = description;\n    }\n\n    public String getStatus() {\n        return status;\n    }\n\n    public void setStatus(String status) {\n        this.status = status;\n    }\n\n    public String getStage() {\n        return stage;\n    }\n\n    public void setStage(String stage) {\n        this.stage = stage;\n    }\n\n    public String getPrincipal() {\n        return principal;\n    }\n\n    public void setPrincipal(String principal) {\n        this.principal = principal;\n    }\n\n    public String getTestCaseMatchRule() {\n        return testCaseMatchRule;\n    }\n\n    public void setTestCaseMatchRule(String testCaseMatchRule) {\n        this.testCaseMatchRule = testCaseMatchRule;\n    }\n\n    public String getExecutorMatchRule() {\n        return executorMatchRule;\n    }\n\n    public void setExecutorMatchRule(String executorMatchRule) {\n        this.executorMatchRule = executorMatchRule;\n    }\n\n    public Long getCreateTime() {\n        return createTime;\n    }\n\n    public void setCreateTime(Long createTime) {\n        this.createTime = createTime;\n    }\n\n    public Long getUpdateTime() {\n        return updateTime;\n    }\n\n    public void setUpdateTime(Long updateTime) {\n        this.updateTime = updateTime;\n    }\n\n    public String getTags() {\n        return tags;\n    }\n\n    public void setTags(String tags) {\n        this.tags = tags;\n    }\n\n    public String getNum() {\n        return num;\n    }\n\n    public void setNum(String num) {\n        this.num = num;\n    }\n\n    public String getType() {\n        return type;\n    }\n\n    public void setType(String type) {\n        this.type = type;\n    }\n}\n"
  },
  {
    "path": "src/main/java/io/metersphere/v3/commons/utils/HttpClientConfig.java",
    "content": "package io.metersphere.v3.commons.utils;\n\nimport org.apache.http.client.config.RequestConfig;\nimport org.apache.http.client.config.RequestConfig.Builder;\n\nimport java.util.HashMap;\nimport java.util.Map;\n\npublic class HttpClientConfig {\n\n    // 字符集\n    private String charset = \"UTF-8\";\n\n    // 请求头\n    private Map<String, String> header = new HashMap<>();\n\n    // 设置连接超时时间，单位毫秒\n    private int connectTimeout = 5000;\n    // 设置从connect Manager获取Connection 超时时间，单位毫秒。这个属性是新加的属性，因为目前版本是可以共享连接池的\n    private int connectionRequestTimeout = 5000;\n    // 请求获取数据的超时时间，单位毫秒。 如果访问一个接口，多少时间内无法返回数据，就直接放弃此次调用\n    private int cocketTimeout = 60000;\n\n    public RequestConfig buildRequestConfig() {\n        Builder builder = RequestConfig.custom();\n        builder.setConnectTimeout(connectTimeout);\n        builder.setConnectionRequestTimeout(connectionRequestTimeout);\n        builder.setSocketTimeout(cocketTimeout);\n        return builder.build();\n    }\n\n    public String getCharset() {\n        return charset;\n    }\n\n    public void setCharset(String charset) {\n        this.charset = charset;\n    }\n\n    public Map<String, String> getHeader() {\n        return header;\n    }\n\n    public void addHeader(String key, String value) {\n        header.put(key, value);\n    }\n\n    public int getConnectTimeout() {\n        return connectTimeout;\n    }\n\n    public void setConnectTimeout(int connectTimeout) {\n        this.connectTimeout = connectTimeout;\n    }\n\n    public int getConnectionRequestTimeout() {\n        return connectionRequestTimeout;\n    }\n\n    public void setConnectionRequestTimeout(int connectionRequestTimeout) {\n        this.connectionRequestTimeout = connectionRequestTimeout;\n    }\n\n    public int getCocketTimeout() {\n        return cocketTimeout;\n    }\n\n    public void setCocketTimeout(int cocketTimeout) {\n        this.cocketTimeout = cocketTimeout;\n    }\n\n}\n"
  },
  {
    "path": "src/main/java/io/metersphere/v3/commons/utils/HttpClientUtil.java",
    "content": "package io.metersphere.v3.commons.utils;\n\nimport org.apache.http.HttpEntity;\nimport org.apache.http.HttpResponse;\nimport org.apache.http.NameValuePair;\nimport org.apache.http.client.entity.EntityBuilder;\nimport org.apache.http.client.entity.UrlEncodedFormEntity;\nimport org.apache.http.client.methods.HttpGet;\nimport org.apache.http.client.methods.HttpPost;\nimport org.apache.http.conn.ssl.NoopHostnameVerifier;\nimport org.apache.http.conn.ssl.TrustSelfSignedStrategy;\nimport org.apache.http.conn.ssl.TrustStrategy;\nimport org.apache.http.entity.ContentType;\nimport org.apache.http.impl.client.CloseableHttpClient;\nimport org.apache.http.impl.client.HttpClientBuilder;\nimport org.apache.http.impl.client.HttpClients;\nimport org.apache.http.message.BasicNameValuePair;\nimport org.apache.http.protocol.HTTP;\nimport org.apache.http.ssl.SSLContexts;\nimport org.apache.http.util.EntityUtils;\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\n\nimport javax.net.ssl.HostnameVerifier;\nimport javax.net.ssl.SSLContext;\nimport java.util.ArrayList;\nimport java.util.List;\nimport java.util.Map;\n\npublic class HttpClientUtil {\n\n    private static Logger logger = LoggerFactory.getLogger(HttpClientUtil.class);\n\n    private static final String HTTPS = \"https\";\n\n    /**\n     * 根据url构建HttpClient（区分http和https）\n     *\n     * @param url 请求地址\n     * @return CloseableHttpClient实例\n     */\n    private static CloseableHttpClient buildHttpClient(String url) {\n        try {\n            if (url.startsWith(HTTPS)) {\n                // https 增加信任设置\n                TrustStrategy trustStrategy = new TrustSelfSignedStrategy();\n                SSLContext sslContext = SSLContexts.custom().loadTrustMaterial(trustStrategy).build();\n                HostnameVerifier hostnameVerifier = NoopHostnameVerifier.INSTANCE;\n                return HttpClients.custom().setSSLContext(sslContext).setSSLHostnameVerifier(hostnameVerifier).build();\n            } else {\n                // http\n                return HttpClientBuilder.create().build();\n            }\n        } catch (Exception e) {\n            throw new RuntimeException(\"HttpClient构建失败\", e);\n        }\n    }\n\n    /**\n     * Get http请求\n     *\n     * @param url    请求地址\n     * @param config 配置项，如果null则使用默认配置\n     * @return 响应结果字符串\n     */\n    public static String get(String url, HttpClientConfig config) {\n        CloseableHttpClient httpClient = buildHttpClient(url);\n        HttpGet httpGet = new HttpGet(url);\n\n        if (config == null) {\n            config = new HttpClientConfig();\n        }\n        try {\n            httpGet.setConfig(config.buildRequestConfig());\n\n            Map<String, String> header = config.getHeader();\n            for (String key : header.keySet()) {\n                httpGet.addHeader(key, header.get(key));\n            }\n\n            httpGet.addHeader(HTTP.CONTENT_ENCODING, config.getCharset());\n\n            HttpResponse response = httpClient.execute(httpGet);\n            HttpEntity entity = response.getEntity();\n            return EntityUtils.toString(entity, config.getCharset());\n        } catch (Exception e) {\n            logger.error(\"HttpClient查询失败\", e);\n            throw new RuntimeException(\"HttpClient查询失败\", e);\n        } finally {\n            try {\n                httpClient.close();\n            } catch (Exception e) {\n                logger.error(\"HttpClient关闭连接失败\", e);\n            }\n        }\n    }\n\n    /**\n     * Post请求，请求内容必须为JSON格式的字符串\n     *\n     * @param url    请求地址\n     * @param config 配置项，如果null则使用默认配置\n     * @param json   JSON格式的字符串\n     * @return 响应结果字符串\n     */\n    public static String post(String url, String json, HttpClientConfig config) {\n        CloseableHttpClient httpClient = buildHttpClient(url);\n        HttpPost httpPost = new HttpPost(url);\n        if (config == null) {\n            config = new HttpClientConfig();\n        }\n        try {\n            httpPost.setConfig(config.buildRequestConfig());\n\n            Map<String, String> header = config.getHeader();\n            for (String key : header.keySet()) {\n                httpPost.addHeader(key, header.get(key));\n            }\n            httpPost.addHeader(HTTP.CONTENT_TYPE, \"application/json\");\n            httpPost.addHeader(HTTP.CONTENT_ENCODING, config.getCharset());\n\n            EntityBuilder entityBuilder = EntityBuilder.create();\n            entityBuilder.setText(json);\n            entityBuilder.setContentType(ContentType.APPLICATION_JSON);\n            entityBuilder.setContentEncoding(config.getCharset());\n            HttpEntity requestEntity = entityBuilder.build();\n            httpPost.setEntity(requestEntity);\n\n            HttpResponse response = httpClient.execute(httpPost);\n            HttpEntity entity = response.getEntity();\n            return EntityUtils.toString(entity, config.getCharset());\n        } catch (Exception e) {\n            logger.error(\"HttpClient查询失败\", e);\n            throw new RuntimeException(\"HttpClient查询失败\", e);\n        } finally {\n            try {\n                httpClient.close();\n            } catch (Exception e) {\n                logger.error(\"HttpClient关闭连接失败\", e);\n            }\n        }\n    }\n\n    /**\n     * Post请求，请求内容必须为JSON格式的字符串\n     *\n     * @param url  请求地址\n     * @param json JSON格式的字符串\n     * @return 响应结果字符串\n     */\n    public static String post(String url, String json) {\n        return HttpClientUtil.post(url, json, null);\n    }\n\n    /**\n     * Post请求，请求内容必须为键值对参数\n     *\n     * @param url    请求地址\n     * @param config 配置项，如果null则使用默认配置\n     * @param body   请求内容键值对参数\n     * @return 响应结果字符串\n     */\n    public static String post(String url, Map<String, String> body, HttpClientConfig config) {\n        CloseableHttpClient httpClient = buildHttpClient(url);\n        HttpPost httpPost = new HttpPost(url);\n        if (config == null) {\n            config = new HttpClientConfig();\n        }\n        try {\n            httpPost.setConfig(config.buildRequestConfig());\n\n            Map<String, String> header = config.getHeader();\n            for (String key : header.keySet()) {\n                httpPost.addHeader(key, header.get(key));\n            }\n            httpPost.addHeader(HTTP.CONTENT_ENCODING, config.getCharset());\n\n            if (body != null && body.size() > 0) {\n                List<NameValuePair> nvps = new ArrayList<>();\n                for (String key : body.keySet()) {\n                    nvps.add(new BasicNameValuePair(key, body.get(key)));\n                }\n                try {\n                    httpPost.setEntity(new UrlEncodedFormEntity(nvps, config.getCharset()));\n                } catch (Exception e) {\n                    logger.error(\"HttpClient转换编码错误\", e);\n                    throw new RuntimeException(\"HttpClient转换编码错误\", e);\n                }\n            }\n\n            HttpResponse response = httpClient.execute(httpPost);\n            HttpEntity entity = response.getEntity();\n            return EntityUtils.toString(entity, config.getCharset());\n        } catch (Exception e) {\n            logger.error(\"HttpClient查询失败\", e);\n            throw new RuntimeException(\"HttpClient查询失败\", e);\n        } finally {\n            try {\n                httpClient.close();\n            } catch (Exception e) {\n                logger.error(\"HttpClient关闭连接失败\", e);\n            }\n        }\n    }\n\n\n}\n"
  },
  {
    "path": "src/main/java/io/metersphere/v3/commons/utils/LogUtil.java",
    "content": "package io.metersphere.v3.commons.utils;\n\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\n\nimport java.io.IOException;\nimport java.io.PrintWriter;\nimport java.io.StringWriter;\n\npublic class LogUtil {\n    //日志工具类\n//\tpublic static final Log Logger = LogFactory.getLog(LogUtil.class);\n\n    private static final String DEBUG = \"DEBUG\";\n    private static final String INFO = \"INFO\";\n    private static final String WARN = \"WARN\";\n    private static final String ERROR = \"ERROR\";\n\n    /**\n     * 初始化日志\n     *\n     * @return\n     */\n    public static Logger getLogger() {\n        return LoggerFactory.getLogger(LogUtil.getLogClass());\n    }\n\n    public static void writeLog(Object msg, String level) {\n        Logger logger = LogUtil.getLogger();\n\n        if (DEBUG.equals(level)) {\n            if (logger != null && logger.isDebugEnabled()) {\n                logger.debug(LogUtil.getMsg(msg));\n            }\n        } else if (INFO.equals(level)) {\n            if (logger != null && logger.isInfoEnabled()) {\n                logger.info(LogUtil.getMsg(msg));\n            }\n        } else if (WARN.equals(level)) {\n            if (logger != null && logger.isWarnEnabled()) {\n                logger.warn(LogUtil.getMsg(msg));\n            }\n        } else if (ERROR.equals(level)) {\n            if (logger != null && logger.isErrorEnabled()) {\n                logger.error(LogUtil.getMsg(msg));\n            }\n        } else {\n            if (logger != null && logger.isErrorEnabled()) {\n                logger.error(\"\");\n            }\n        }\n    }\n\n    public static void info(Object msg) {\n        Logger logger = LogUtil.getLogger();\n        if (logger != null && logger.isInfoEnabled()) {\n            logger.info(LogUtil.getMsg(msg));\n        }\n    }\n\n    public static void info(Object msg, Object o1) {\n        Logger logger = LogUtil.getLogger();\n        if (logger != null && logger.isInfoEnabled()) {\n            logger.info(LogUtil.getMsg(msg), o1);\n        }\n    }\n\n    public static void info(Object msg, Object o1, Object o2) {\n        Logger logger = LogUtil.getLogger();\n        if (logger != null && logger.isInfoEnabled()) {\n            logger.info(LogUtil.getMsg(msg), o1, o2);\n        }\n    }\n\n    public static void info(Object msg, Object[] obj) {\n        Logger logger = LogUtil.getLogger();\n        if (logger != null && logger.isInfoEnabled()) {\n            logger.info(LogUtil.getMsg(msg), obj);\n        }\n    }\n\n    public static void debug(Object msg) {\n        Logger logger = LogUtil.getLogger();\n        if (logger != null && logger.isDebugEnabled()) {\n            logger.debug(LogUtil.getMsg(msg));\n        }\n    }\n\n    public static void debug(Object msg, Object o) {\n        Logger logger = LogUtil.getLogger();\n        if (logger != null && logger.isDebugEnabled()) {\n            logger.debug(LogUtil.getMsg(msg), o);\n        }\n    }\n\n    public static void debug(Object msg, Object o1, Object o2) {\n        Logger logger = LogUtil.getLogger();\n        if (logger != null && logger.isDebugEnabled()) {\n            logger.debug(LogUtil.getMsg(msg), o1, o2);\n        }\n    }\n\n    public static void debug(Object msg, Object[] obj) {\n        Logger logger = LogUtil.getLogger();\n        if (logger != null && logger.isDebugEnabled()) {\n            logger.debug(LogUtil.getMsg(msg), obj);\n        }\n    }\n\n    public static void warn(Object msg) {\n        Logger logger = LogUtil.getLogger();\n        if (logger != null && logger.isWarnEnabled()) {\n            logger.warn(LogUtil.getMsg(msg));\n        }\n    }\n\n    public static void warn(Object msg, Object o) {\n        Logger logger = LogUtil.getLogger();\n        if (logger != null && logger.isWarnEnabled()) {\n            logger.warn(LogUtil.getMsg(msg), o);\n        }\n    }\n\n    public static void warn(Object msg, Object o1, Object o2) {\n        Logger logger = LogUtil.getLogger();\n        if (logger != null && logger.isWarnEnabled()) {\n            logger.warn(LogUtil.getMsg(msg), o1, o2);\n        }\n    }\n\n    public static void warn(Object msg, Object[] obj) {\n        Logger logger = LogUtil.getLogger();\n        if (logger != null && logger.isWarnEnabled()) {\n            logger.warn(LogUtil.getMsg(msg), obj);\n        }\n    }\n\n    public static void error(Object msg) {\n        Logger logger = LogUtil.getLogger();\n        if (logger != null && logger.isErrorEnabled()) {\n            logger.error(LogUtil.getMsg(msg));// 并追加方法名称\n        }\n    }\n\n    public static void error(Object msg, Object o) {\n        Logger logger = LogUtil.getLogger();\n        if (logger != null && logger.isErrorEnabled()) {\n            logger.error(LogUtil.getMsg(msg), o);\n        }\n    }\n\n    public static void error(Object msg, Object o1, Object o2) {\n        Logger logger = LogUtil.getLogger();\n        if (logger != null && logger.isErrorEnabled()) {\n            logger.error(LogUtil.getMsg(msg), o1, o2);\n        }\n    }\n\n    public static void error(Object msg, Object[] obj) {\n        Logger logger = LogUtil.getLogger();\n        if (logger != null && logger.isErrorEnabled()) {\n            logger.error(LogUtil.getMsg(msg), obj);\n        }\n    }\n\n    public static void error(Object msg, Throwable ex) {\n        Logger logger = LogUtil.getLogger();\n        if (logger != null && logger.isErrorEnabled()) {\n            logger.error(LogUtil.getMsg(msg), ex);\n        }\n    }\n\n    public static String getMsg(Object msg, Throwable ex) {\n        String str = \"\";\n\n        if (msg != null) {\n            str = LogUtil.getLogMethod() + \"[\" + msg.toString() + \"]\";\n        } else {\n            str = LogUtil.getLogMethod() + \"[null]\";\n        }\n        if (ex != null) {\n            str += \"[\" + ex.getMessage() + \"]\";\n        }\n\n        return str;\n    }\n\n    public static String getMsg(Object msg) {\n        return LogUtil.getMsg(msg, null);\n    }\n\n    /**\n     * 得到调用类名称\n     *\n     * @return\n     */\n    private static String getLogClass() {\n        String str = \"\";\n\n        StackTraceElement[] stack = (new Throwable()).getStackTrace();\n        if (stack.length > 3) {\n            StackTraceElement ste = stack[3];\n            str = ste.getClassName();// 类名称\n        }\n\n        return str;\n    }\n\n    /**\n     * 得到调用方法名称\n     *\n     * @return\n     */\n    private static String getLogMethod() {\n        String str = \"\";\n\n        StackTraceElement[] stack = (new Throwable()).getStackTrace();\n        if (stack.length > 4) {\n            StackTraceElement ste = stack[4];\n            str = \"Method[\" + ste.getMethodName() + \"]\";// 方法名称\n        }\n\n        return str;\n    }\n\n    public static String toString(Throwable e) {\n        StringWriter sw = null;\n        PrintWriter pw = null;\n        try {\n            sw = new StringWriter();\n            pw = new PrintWriter(sw);\n            //将出错的栈信息输出到printWriter中\n            e.printStackTrace(pw);\n            pw.flush();\n            sw.flush();\n        } finally {\n            if (sw != null) {\n                try {\n                    sw.close();\n                } catch (IOException e1) {\n                    e1.printStackTrace();\n                }\n            }\n            if (pw != null) {\n                pw.close();\n            }\n        }\n        return sw.toString();\n    }\n\n    public static String getExceptionDetailsToStr(Exception e) {\n        StringBuilder sb = new StringBuilder(e.toString());\n        StackTraceElement[] stackElements = e.getStackTrace();\n        for (StackTraceElement stackTraceElement : stackElements) {\n            sb.append(stackTraceElement.toString());\n            sb.append(\"\\n\");\n        }\n        sb.append(\"\\n\");\n        return sb.toString();\n    }\n}"
  },
  {
    "path": "src/main/java/io/metersphere/v3/commons/utils/MeterSphereUtils.java",
    "content": "package io.metersphere.v3.commons.utils;\n\nimport hudson.model.Run;\nimport io.metersphere.v3.client.MeterSphereClient;\nimport io.metersphere.v3.commons.constants.Results;\nimport io.metersphere.v3.commons.model.TestPlanDTO;\nimport org.apache.commons.lang.StringUtils;\n\nimport java.io.PrintStream;\nimport java.util.HashMap;\nimport java.util.Map;\n\npublic class MeterSphereUtils {\n    public PrintStream logger;\n    private static final String LOG_PREFIX = \"[MeterSphere，代码测试]\";\n\n    public MeterSphereUtils(PrintStream logger) {\n        this.logger = logger;\n    }\n\n    public void log(String msg) {\n        logger.println(LOG_PREFIX + msg);\n    }\n\n\n    public boolean runTestPlan(Run<?, ?> run, MeterSphereClient meterSphereClient, TestPlanDTO testPlan, String organizationId, String projectId, String endpoint) throws InterruptedException {\n        log(\"测试计划开始执行\");\n        String id = meterSphereClient.exeTestPlan(testPlan.getId());\n        log(\"生成测试报告id: \" + id + \"，测试计划: \" + testPlan.getName() + \"，类型: \" + testPlan.getType());\n        boolean flag = true;\n        boolean state = true;\n        while (state) {\n            // 避免报告还没入库\n            Thread.sleep(5000);\n\n            String status = meterSphereClient.getStatus(id);\n            if (Results.STOPPED.equalsIgnoreCase(status)) {\n                flag = false;\n                state = false;\n                log(\"该测试计划已停止\");\n            } else if (Results.COMPLETED.equalsIgnoreCase(status)) {\n                state = false;\n                log(\"该测试计划已完成\");\n            } else if (Results.SUCCESS.equalsIgnoreCase(status)) {\n                state = false;\n                log(\"该测试计划已完成\");\n            } else if (Results.ERROR.equalsIgnoreCase(status)) {\n                flag = false;\n                state = false;\n                log(\"该测试计划已完成\");\n            }\n        }\n\n        String openMode = \"anon\";\n        if (!meterSphereClient.checkLicense()) {\n            openMode = \"auth\";\n        }\n        String reportView = String.format(\"/#/test-plan/testPlanReportDetail?id=%s&type=%s&pId=%s&orgId=%s\", id, testPlan.getType(), projectId, organizationId);\n        if (StringUtils.equals(openMode, \"anon\")) {\n            Map<String, String> params = new HashMap<>();\n            params.put(\"projectId\", projectId);\n            params.put(\"reportId\", id);\n            String shareUrl = meterSphereClient.getShareInfo(params);\n            reportView = String.format(\"/#/share/shareReportTestPlan%s&type=%s&pId=%s&orgId=%s\", shareUrl, testPlan.getType(), projectId, organizationId);\n        }\n        log(\"点击链接进入测试计划报告页面:\" + StringUtils.stripEnd(endpoint, \"/\") + reportView);\n        return flag;\n    }\n\n\n    public String handleTestPlanName(String name, String num) {\n        return \"[\" + num + \"] \" + name;\n    }\n\n}\n"
  },
  {
    "path": "src/main/resources/application.properties",
    "content": "spring.application.name=metersphere-jenkins-plugin\nlogging.file.path=/opt/fit2cloud/logs/${spring.application.name}\n\n\n"
  },
  {
    "path": "src/main/resources/index.jelly",
    "content": "<div>\n This plugin integrates <a href=\"https://www.metersphere.com\">MeterSphere</a> - the cloud load testing service to Jenkins.</div>\n"
  },
  {
    "path": "src/main/resources/io/metersphere/v3/MeterSphereBuilder/config.jelly",
    "content": "<?jelly escape-by-default='true'?>\n<j:jelly xmlns:j=\"jelly:core\" xmlns:f=\"/lib/form\">\n    <f:entry title=\"MeterSphere 站点\" field=\"msEndpoint\">\n        <f:textbox/>\n    </f:entry>\n    <f:entry title=\"MeterSphere AccessKey\" field=\"msAccessKey\">\n        <f:textbox/>\n    </f:entry>\n    <f:entry title=\"MeterSphere SecretKey\" field=\"msSecretKey\">\n        <f:textbox onblur=\"handleSelectOrganizationChange()\"/>\n    </f:entry>\n    <f:validateButton\n            title=\"验证账户\" progress=\"验证中...\"\n            method=\"checkAccount\" with=\"msAccessKey,msSecretKey,msEndpoint\"/>\n\n    <f:entry title=\"组织名称\" field=\"organizationId\">\n        <f:select id=\"selectOrganizationOption\" onchange=\"handleSelectOrganizationChange()\" />\n    </f:entry>\n    <f:entry title=\"输入项目名称\" field=\"projectName\">\n         <f:textbox id=\"selectProjectOption\" onblur=\"handleSelectProjectChange()\"/>\n    </f:entry>\n    <f:entry title=\"输入测试计划(组)名称\" field=\"testPlanName\">\n        <f:textbox id=\"selectTestPlanOption\"/>\n    </f:entry>\n    <script>\n        function handleSelectOrganizationChange() {\n            const crumbValue = document.querySelector('head').getAttribute('data-crumb-value')\n\n            const selectElement = document.querySelector(\"[id='selectOrganizationOption']\");\n            const selectedValue = selectElement.value;\n            const url = '${rootURL}/descriptorByName/io.metersphere.v3.MeterSphereBuilder/checkSelectOrganizationOption';\n            fetch(url, {\n                method: 'POST',\n                headers: {\n                    'Content-Type': 'application/x-www-form-urlencoded',\n                    'Jenkins-Crumb': crumbValue\n                },\n                body: 'value=' + encodeURIComponent(selectedValue)\n            }).then((res)=> {\n                console.log(res);\n            })\n\n            const selectProjectElement = document.querySelector(\"[id='selectProjectOption']\");\n            selectProjectElement.addEventListener('focus', function () {\n                if (!this.value || this.value.trim() === '') {\n                    this.value = ' ';\n                    // Trigger the autocomplete without user input\n                    var evt = document.createEvent('HTMLEvents');\n                    evt.initEvent('keyup', false, true);\n                    this.dispatchEvent(evt);\n                    this.value = '';\n                }\n            });\n        }\n\n\n        function handleSelectProjectChange() {\n            const crumbValue = document.querySelector('head').getAttribute('data-crumb-value')\n            const selectElement = document.querySelector(\"[id='selectProjectOption']\");\n            const selectedValue = selectElement.value;\n            console.log(selectedValue);\n            const url = '${rootURL}/descriptorByName/io.metersphere.v3.MeterSphereBuilder/checkSelectProjectOption';\n            fetch(url, {\n                method: 'POST',\n                headers: {\n                    'Content-Type': 'application/x-www-form-urlencoded',\n                    'Jenkins-Crumb': crumbValue\n                },\n                body: 'value=' + encodeURIComponent(selectedValue)\n            }).then((res)=> {\n                console.log(res);\n            })\n\n            const selectTestPlanElement = document.querySelector(\"[id='selectTestPlanOption']\");\n            selectTestPlanElement.addEventListener('focus', function () {\n                if (!this.value || this.value.trim() === '') {\n                    this.value = ' ';\n                    // Trigger the autocomplete without user input\n                    var evt = document.createEvent('HTMLEvents');\n                    evt.initEvent('keyup', false, true);\n                    this.dispatchEvent(evt);\n                    this.value = '';\n                }\n            });\n        }\n\n        setTimeout(() => {\n            handleSelectOrganizationChange();\n            handleSelectProjectChange();\n        }, 2000);\n    </script>\n</j:jelly>\n"
  },
  {
    "path": "src/main/resources/io/metersphere/v3/MeterSphereBuilder/help-msAccessKey.html",
    "content": "<div>\n  填入您的Access Key ID，如果没有，可以移步到https://rdmetersphere.fit2cloud.com/网站自动生成\n</div>"
  },
  {
    "path": "src/main/resources/io/metersphere/v3/MeterSphereBuilder/help-msEndpoint.html",
    "content": "<div>\n    您可以提供MeterSphere服务器实例的主机名，格式为https://rdmetersphere.fit2cloud.com/\n</div>\n"
  },
  {
    "path": "src/main/resources/io/metersphere/v3/MeterSphereBuilder/help-msSecretKey.html",
    "content": "<div>\n    填入您的Access Key Secret，如果没有，可以移步到https://rdmetersphere.fit2cloud.com/网站自动生成\n\n</div>\n"
  },
  {
    "path": "src/main/resources/io/metersphere/v3/MeterSphereBuilder/help-nodePaths.html",
    "content": "<div>\n   1：单独查询某个模块下的测试用例\n   以这样的格式手动输入您所选的模块： /一级模块1/二级模块1，/一级模块1/二级模块2 表明你要运行的模块\n   2：如果要查某个模块下所有的测试用例：\n   以这样的格式手动输入您所选的模块： /一级模块1/*，/一级模块1/* 表明你要运行的模块\n   （注意：模块以系统中用例的所属模块为主，默认以第二级模块开始输入，第一级模块是所属项目）\n</div>\n"
  },
  {
    "path": "src/main/resources/io/metersphere/v3/MeterSphereBuilder/help-projectId.html",
    "content": "<div>\n选择您要测试的项目\n</div>\n"
  },
  {
    "path": "src/main/resources/io/metersphere/v3/MeterSphereBuilder/help-testPlanId.html",
    "content": "<div>\n选择您所要的测试计划\n</div>\n"
  },
  {
    "path": "src/main/resources/io/metersphere/v3/MeterSphereBuilder/help-workspaceId.html",
    "content": "<div>\n选择您的组织\n</div>\n"
  },
  {
    "path": "src/main/resources/logback.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<configuration debug=\"true\">\n    <property resource=\"application.properties\"/>\n    <appender name=\"console\" class=\"ch.qos.logback.core.ConsoleAppender\">\n        <encoder>\n            <pattern>%d %5p %40.40c:%4L - %m%n</pattern>\n        </encoder>\n    </appender>\n\n    <appender name=\"debugAppender\"\n              class=\"ch.qos.logback.core.rolling.RollingFileAppender\">\n        <filter class=\"ch.qos.logback.classic.filter.LevelFilter\">\n            <level>DEBUG</level>\n            <onMatch>ACCEPT</onMatch>\n            <onMismatch>DENY</onMismatch>\n        </filter>\n        <File>${logging.file.path}/debug.log</File>\n        <rollingPolicy class=\"ch.qos.logback.core.rolling.TimeBasedRollingPolicy\">\n            <FileNamePattern>${logging.file.path}/history/debug.%d{yyyyMMdd}-%i.log\n            </FileNamePattern>\n            <maxHistory>30</maxHistory>\n            <TimeBasedFileNamingAndTriggeringPolicy\n                    class=\"ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP\">\n                <maxFileSize>50MB</maxFileSize>\n            </TimeBasedFileNamingAndTriggeringPolicy>\n        </rollingPolicy>\n        <encoder>\n            <charset>UTF-8</charset>\n            <Pattern>%d [%thread] %-5level %logger{36} %line - %msg%n</Pattern>\n        </encoder>\n    </appender>\n\n    <appender name=\"infoAppender\"\n              class=\"ch.qos.logback.core.rolling.RollingFileAppender\">\n        <filter class=\"ch.qos.logback.classic.filter.ThresholdFilter\">\n            <level>INFO</level>\n        </filter>\n        <File>${logging.file.path}/info.log</File>\n        <rollingPolicy class=\"ch.qos.logback.core.rolling.TimeBasedRollingPolicy\">\n            <FileNamePattern>${logging.file.path}/history/info.%d{yyyyMMdd}-%i.log\n            </FileNamePattern>\n            <maxHistory>30</maxHistory>\n            <TimeBasedFileNamingAndTriggeringPolicy\n                    class=\"ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP\">\n                <maxFileSize>50MB</maxFileSize>\n            </TimeBasedFileNamingAndTriggeringPolicy>\n        </rollingPolicy>\n        <encoder>\n            <charset>UTF-8</charset>\n            <Pattern>%d [%thread] %-5level %logger{36} %line - %msg%n</Pattern>\n        </encoder>\n    </appender>\n\n    <appender name=\"errorAppender\"\n              class=\"ch.qos.logback.core.rolling.RollingFileAppender\">\n        <filter class=\"ch.qos.logback.classic.filter.LevelFilter\">\n            <level>ERROR</level>\n            <onMatch>ACCEPT</onMatch>\n            <onMismatch>DENY</onMismatch>\n        </filter>\n\n        <File>${logging.file.path}/error.log</File>\n        <rollingPolicy class=\"ch.qos.logback.core.rolling.TimeBasedRollingPolicy\">\n            <FileNamePattern>${logging.file.path}/history/error.%d{yyyyMMdd}-%i.log\n            </FileNamePattern>\n            <maxHistory>30</maxHistory>\n            <TimeBasedFileNamingAndTriggeringPolicy\n                    class=\"ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP\">\n                <maxFileSize>50MB</maxFileSize>\n            </TimeBasedFileNamingAndTriggeringPolicy>\n        </rollingPolicy>\n        <encoder>\n            <charset>UTF-8</charset>\n            <Pattern>%d [%thread] %-5level %logger{36} %line - %msg%n</Pattern>\n        </encoder>\n    </appender>\n\n    <appender name=\"warnAppender\"\n              class=\"ch.qos.logback.core.rolling.RollingFileAppender\">\n        <filter class=\"ch.qos.logback.classic.filter.LevelFilter\">\n            <level>WARN</level>\n            <onMatch>ACCEPT</onMatch>\n            <onMismatch>DENY</onMismatch>\n        </filter>\n        <File>${logging.file.path}/warn.log</File>\n        <rollingPolicy class=\"ch.qos.logback.core.rolling.TimeBasedRollingPolicy\">\n            <FileNamePattern>${logging.file.path}/history/warn.%d{yyyyMMdd}-%i.log\n            </FileNamePattern>\n            <maxHistory>30</maxHistory>\n            <TimeBasedFileNamingAndTriggeringPolicy\n                    class=\"ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP\">\n                <maxFileSize>50MB</maxFileSize>\n            </TimeBasedFileNamingAndTriggeringPolicy>\n        </rollingPolicy>\n        <encoder>\n            <charset>UTF-8</charset>\n            <Pattern>%d [%thread] %-5level %logger{36} %line - %msg%n</Pattern>\n        </encoder>\n    </appender>\n\n    <appender name=\"consoleAsyncAppender\" class=\"ch.qos.logback.classic.AsyncAppender\">\n        <filter class=\"ch.qos.logback.classic.filter.ThresholdFilter\">\n            <level>DEBUG</level>\n        </filter>\n        <queueSize>10000</queueSize>\n        <appender-ref ref=\"console\"/>\n    </appender>\n\n    <appender name=\"debugAsyncAppender\" class=\"ch.qos.logback.classic.AsyncAppender\">\n        <filter class=\"ch.qos.logback.classic.filter.ThresholdFilter\">\n            <level>DEBUG</level>\n        </filter>\n        <queueSize>10000</queueSize>\n        <appender-ref ref=\"debugAppender\"/>\n    </appender>\n\n    <appender name=\"infoAsyncAppender\" class=\"ch.qos.logback.classic.AsyncAppender\">\n        <filter class=\"ch.qos.logback.classic.filter.ThresholdFilter\">\n            <level>INFO</level>\n        </filter>\n        <queueSize>10000</queueSize>\n        <appender-ref ref=\"infoAppender\"/>\n    </appender>\n\n    <appender name=\"errorAsyncAppender\" class=\"ch.qos.logback.classic.AsyncAppender\">\n        <filter class=\"ch.qos.logback.classic.filter.ThresholdFilter\">\n            <level>ERROR</level>\n        </filter>\n        <queueSize>10000</queueSize>\n        <includeCallerData>true</includeCallerData>\n        <appender-ref ref=\"errorAppender\"/>\n    </appender>\n\n    <appender name=\"warnAsyncAppender\" class=\"ch.qos.logback.classic.AsyncAppender\">\n        <filter class=\"ch.qos.logback.classic.filter.ThresholdFilter\">\n            <level>WARN</level>\n        </filter>\n        <queueSize>10000</queueSize>\n        <includeCallerData>true</includeCallerData>\n        <appender-ref ref=\"warnAppender\"/>\n    </appender>\n\n    <root level=\"INFO\">\n        <appender-ref ref=\"infoAsyncAppender\"/>\n        <appender-ref ref=\"console\"/>\n    </root>\n\n    <logger name=\"io.metersphere\" additivity=\"false\">\n        <level value=\"${logger.level:INFO}\"/>\n        <appender-ref ref=\"debugAsyncAppender\"/>\n        <appender-ref ref=\"infoAsyncAppender\"/>\n        <appender-ref ref=\"warnAsyncAppender\"/>\n        <appender-ref ref=\"errorAsyncAppender\"/>\n    </logger>\n\n    <logger name=\"io.metersphere.Application\" additivity=\"false\" level=\"${logger.level:INFO}\">\n        <appender-ref ref=\"infoAsyncAppender\"/>\n    </logger>\n\n</configuration>"
  }
]