Uploaded image for project: 'Subscription Watch'
  1. Subscription Watch
  2. SWATCH-3526

Remove REST Client stubs for Quarkus clients

XMLWordPrintable

    • Icon: Task Task
    • Resolution: Done
    • Icon: Major Major
    • 2025-05-20 - API
    • None
    • None

      At the moment, we have some client stubs with hard-coded values that are activated when a concrete property is enabled (for example: rhsm-subscriptions.XX.use-stub=true). Then, we have a “factory bean” that will inject the stub client or the real one:

      @ApplicationScoped
      @Produces
      @ContractsClient
      public DefaultApi getApi(
         @ConfigProperty(name = "rhsm-subscriptions.contracts.use-stub", defaultValue = "false")
             boolean useStub,
         @RestClient DefaultApi contractsApi) {
       if (useStub) {
         return new StubContractsApi();
       }
      
      
       return contractsApi;
      }
      

      Then, we need to use the “@ContractsClient” qualifier, to inject the client in our services:

      @Inject
      @ContractsClient
      public DefaultApi client;
      

      When using the Quarkus Resteasy REST Client extension, this solution does not work any longer because it will only generate one client, so having the stub in place, will cause the real client not to be generated.

      Therefore, we need to move the stubs into wiremock.

      Acceptance Criteria

      • Remove stubs for Quarkus clients
      • Remove no longer used "XX.use-stub" properties
      • Move the stubs into the wiremock instance that is started in docker-compose.yml, and add some documentation about how to use these mocks.
      • Verify that USE STUBS isn't being used in ClowdApp templates or ephemeral. If it is, we'll need to configure that wiremock too. This can be done as part of this card.

              jcarvaja@redhat.com Jose Carvajal Hilario
              jcarvaja@redhat.com Jose Carvajal Hilario
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: