void getFormsInMaster()

in ddm-rrm/src/it/java/com/epam/digital/data/platform/management/MasterVersionFormsControllerIT.java [125:170]


    void getFormsInMaster() {
      // add 2 files to "remote" repo pull head branch repo and add 1 more file to "remote"
      final var johnDoesFormContent = context.getResourceContent(
          "/versions/master/forms/GET/john-does-form.json");
      context.addFileToRemoteHeadRepo("/forms/john-does-form.json", johnDoesFormContent);
      final var mrSmithsFormContent = context.getResourceContent(
          "/versions/master/forms/GET/mr-smiths-form.json");
      context.addFileToRemoteHeadRepo("/forms/mr-smiths-form.json", mrSmithsFormContent);
      context.pullHeadRepo();
      context.addFileToRemoteHeadRepo("/forms/mr-smiths-form1.json", mrSmithsFormContent);

      // define expected john-does-form dates
      final var expectedJohnDoesFormDates = context.getHeadRepoDatesByPath(
          "forms/john-does-form.json");

      // perform query and expect only 2 of the processes that are pulled on head-branch repo
      mockMvc.perform(
          get("/versions/master/forms")
              .accept(MediaType.APPLICATION_JSON)
      ).andExpectAll(
          status().isOk(),
          content().contentType(MediaType.APPLICATION_JSON),
          jsonPath("$", hasSize(2)),
          jsonPath("$[0].name", is("john-does-form")),
          jsonPath("$[0].title", is("John Doe's form")),
          jsonPath("$[0].created", is(expectedJohnDoesFormDates.getCreated())),
          jsonPath("$[0].updated", is(expectedJohnDoesFormDates.getUpdated())),
          jsonPath("$[1].name", is("mr-smiths-form")),
          jsonPath("$[1].title", is("Mr Smith's form")),
          jsonPath("$[1].created", is("2022-10-28T20:21:48.845Z")),
          jsonPath("$[1].updated", is("2022-10-28T20:56:32.309Z"))
      );

      final var datesCache = cacheManager.getCache(DATE_CACHE_NAME);
      Assertions.assertThat(datesCache).isNotNull();

      final var valueWrapper = datesCache.get("head-branch");
      Assertions.assertThat(valueWrapper).isNotNull();

      Thread.sleep(10000);
      final var emptyDatesCache = cacheManager.getCache(DATE_CACHE_NAME);
      Assertions.assertThat(emptyDatesCache)
          .isNotNull()
          .extracting(cache -> cache.get("head-branch"))
          .isNull();
    }