From 4e26871f9227bb309a05d4bfcec0fe35d77fe8b1 Mon Sep 17 00:00:00 2001 From: Robert Grimm Date: Wed, 1 Nov 2023 19:45:59 -0500 Subject: [PATCH 1/2] Transform to use JSON-based API Resolves FwMotion#85 --- ...mvn generate-sources [rest-client].run.xml | 2 + README.adoc | 2 +- .../threescale/cms/cli/TopLevelCommand.java | 2 +- .../cli/config/ReflectionConfiguration.java | 14 +- openapi-generator-template/pom.xml | 34 + .../resources/java-client/ApiClient.mustache | 1108 ++++++++++ .../main/resources/java-client/pojo.mustache | 632 ++++++ .../src/main/site/site.xml | 35 + parent/pom.xml | 10 +- pom.xml | 1 + rest-client/pom.xml | 59 +- .../threescale/cms/ThreescaleCmsClient.java | 8 +- .../cms/ThreescaleCmsClientFactory.java | 6 +- .../cms/ThreescaleCmsClientImpl.java | 46 +- .../cms/mappers/CmsBuiltinSectionMapper.java | 14 - .../cms/mappers/CmsTemplateMapper.java | 16 + .../threescale/cms/mixins/FileListMixIn.java | 27 - .../cms/mixins/SectionListMixIn.java | 41 - .../cms/mixins/SectionMergingList.java | 40 - .../cms/mixins/TemplateListMixIn.java | 48 - .../cms/mixins/TemplateMergingList.java | 61 - .../cms/model/CmsBuiltinSection.java | 9 - .../threescale/cms/model/CmsFile.java | 13 +- .../threescale/cms/model/CmsLayout.java | 24 +- .../AbstractPagedRestApiSpliterator.java | 19 +- .../cms/support/ApiClientBuilder.java | 20 +- .../cms/support/PagedFilesSpliterator.java | 7 +- .../cms/support/PagedSectionsSpliterator.java | 20 +- .../support/PagedTemplatesSpliterator.java | 44 +- .../rest/cms/XmlEnabledApiClient.java | 108 - .../main/resources/api-spec/3scale-cms.yaml | 1786 ++++++----------- ...hreescaleCmsClientImplIntegrationTest.java | 2 +- .../cms/ThreescaleCmsClientImplUnitTest.java | 87 +- .../matchers/CmsBuiltinSectionMatcher.java | 39 - .../cms/matchers/CmsFileMatcher.java | 4 +- .../cms/matchers/CmsLayoutMatcher.java | 8 +- .../cms/matchers/CmsSectionMatcher.java | 4 +- .../cms/testsupport/FilesApiTestSupport.java | 21 +- .../testsupport/SectionsApiTestSupport.java | 47 +- .../testsupport/TemplatesApiTestSupport.java | 40 +- .../imposter/normal/3scale-cms-config.yaml | 83 +- .../imposter/responses/forbidden.json | 1 + .../imposter/responses/forbidden.xml | 2 - .../imposter/responses/list-files-1.xml | 99 - .../imposter/responses/list-files-2.xml | 2 - .../responses/list-files/list-files-1.json | 1 + .../responses/list-files/list-files-2.json | 1 + .../imposter/responses/list-sections-1.xml | 203 -- .../imposter/responses/list-sections-2.xml | 53 - .../imposter/responses/list-sections-3.xml | 3 - .../list-sections/list-sections-1.json | 210 ++ .../list-sections/list-sections-2.json | 1 + .../list-sections/list-sections-3.json | 1 + .../imposter/responses/list-templates-1.xml | 229 --- .../imposter/responses/list-templates-2.xml | 153 -- .../imposter/responses/list-templates-3.xml | 143 -- .../imposter/responses/list-templates-4.xml | 37 - .../imposter/responses/list-templates-5.xml | 3 - .../list-templates-with-content-1.json | 1 + .../list-templates-with-content-2.json | 1 + .../list-templates-with-content-3.json | 1 + .../list-templates-with-content-4.json | 1 + .../list-templates-with-content-5.json | 1 + .../list-templates/list-templates-1.json | 231 +++ .../list-templates/list-templates-2.json | 1 + .../list-templates/list-templates-3.json | 1 + .../list-templates/list-templates-4.json | 1 + .../list-templates/list-templates-5.json | 1 + .../imposter/responses/not-acceptable.xml | 1 + .../templated-provider-settings.json | 1 + .../responses/templated-provider-settings.xml | 58 - 71 files changed, 3153 insertions(+), 2880 deletions(-) create mode 100644 openapi-generator-template/pom.xml create mode 100644 openapi-generator-template/src/main/resources/java-client/ApiClient.mustache create mode 100644 openapi-generator-template/src/main/resources/java-client/pojo.mustache create mode 100644 openapi-generator-template/src/main/site/site.xml delete mode 100644 rest-client/src/main/java/com/fwmotion/threescale/cms/mappers/CmsBuiltinSectionMapper.java delete mode 100644 rest-client/src/main/java/com/fwmotion/threescale/cms/mixins/FileListMixIn.java delete mode 100644 rest-client/src/main/java/com/fwmotion/threescale/cms/mixins/SectionListMixIn.java delete mode 100644 rest-client/src/main/java/com/fwmotion/threescale/cms/mixins/SectionMergingList.java delete mode 100644 rest-client/src/main/java/com/fwmotion/threescale/cms/mixins/TemplateListMixIn.java delete mode 100644 rest-client/src/main/java/com/fwmotion/threescale/cms/mixins/TemplateMergingList.java delete mode 100644 rest-client/src/main/java/com/fwmotion/threescale/cms/model/CmsBuiltinSection.java delete mode 100644 rest-client/src/main/java/com/redhat/threescale/rest/cms/XmlEnabledApiClient.java delete mode 100644 rest-client/src/test/java/com/fwmotion/threescale/cms/matchers/CmsBuiltinSectionMatcher.java create mode 100644 rest-client/src/test/resources/imposter/responses/forbidden.json delete mode 100644 rest-client/src/test/resources/imposter/responses/forbidden.xml delete mode 100644 rest-client/src/test/resources/imposter/responses/list-files-1.xml delete mode 100644 rest-client/src/test/resources/imposter/responses/list-files-2.xml create mode 100644 rest-client/src/test/resources/imposter/responses/list-files/list-files-1.json create mode 100644 rest-client/src/test/resources/imposter/responses/list-files/list-files-2.json delete mode 100644 rest-client/src/test/resources/imposter/responses/list-sections-1.xml delete mode 100644 rest-client/src/test/resources/imposter/responses/list-sections-2.xml delete mode 100644 rest-client/src/test/resources/imposter/responses/list-sections-3.xml create mode 100644 rest-client/src/test/resources/imposter/responses/list-sections/list-sections-1.json create mode 100644 rest-client/src/test/resources/imposter/responses/list-sections/list-sections-2.json create mode 100644 rest-client/src/test/resources/imposter/responses/list-sections/list-sections-3.json delete mode 100644 rest-client/src/test/resources/imposter/responses/list-templates-1.xml delete mode 100644 rest-client/src/test/resources/imposter/responses/list-templates-2.xml delete mode 100644 rest-client/src/test/resources/imposter/responses/list-templates-3.xml delete mode 100644 rest-client/src/test/resources/imposter/responses/list-templates-4.xml delete mode 100644 rest-client/src/test/resources/imposter/responses/list-templates-5.xml create mode 100644 rest-client/src/test/resources/imposter/responses/list-templates-with-content/list-templates-with-content-1.json create mode 100644 rest-client/src/test/resources/imposter/responses/list-templates-with-content/list-templates-with-content-2.json create mode 100644 rest-client/src/test/resources/imposter/responses/list-templates-with-content/list-templates-with-content-3.json create mode 100644 rest-client/src/test/resources/imposter/responses/list-templates-with-content/list-templates-with-content-4.json create mode 100644 rest-client/src/test/resources/imposter/responses/list-templates-with-content/list-templates-with-content-5.json create mode 100644 rest-client/src/test/resources/imposter/responses/list-templates/list-templates-1.json create mode 100644 rest-client/src/test/resources/imposter/responses/list-templates/list-templates-2.json create mode 100644 rest-client/src/test/resources/imposter/responses/list-templates/list-templates-3.json create mode 100644 rest-client/src/test/resources/imposter/responses/list-templates/list-templates-4.json create mode 100644 rest-client/src/test/resources/imposter/responses/list-templates/list-templates-5.json create mode 100644 rest-client/src/test/resources/imposter/responses/not-acceptable.xml create mode 100644 rest-client/src/test/resources/imposter/responses/templated-provider-settings.json delete mode 100644 rest-client/src/test/resources/imposter/responses/templated-provider-settings.xml diff --git a/.run/mvn generate-sources [rest-client].run.xml b/.run/mvn generate-sources [rest-client].run.xml index 36921af..cb24fe8 100644 --- a/.run/mvn generate-sources [rest-client].run.xml +++ b/.run/mvn generate-sources [rest-client].run.xml @@ -11,6 +11,8 @@