Skip to content

Commit

Permalink
WDUniqueNamesPropertyDisabledUiTest does not apply Webdav app property
Browse files Browse the repository at this point in the history
…#38

Tried to use additional context initializer
  • Loading branch information
Flaurite committed Apr 21, 2022
1 parent 7127722 commit caa8b83
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 9 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package io.jmix.tests.ui.test.webdav;

import org.springframework.boot.test.util.TestPropertyValues;
import org.springframework.context.ApplicationContextInitializer;
import org.springframework.context.ConfigurableApplicationContext;

public class WebDavContextInitializer implements ApplicationContextInitializer<ConfigurableApplicationContext> {

@Override
public void initialize(ConfigurableApplicationContext applicationContext) {
TestPropertyValues.of("jmix.webdav.auto-generate-unique-resource-uri=false")
.applyTo(applicationContext.getEnvironment());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import io.jmix.tests.ui.screen.administration.webdav.browse.WebDAVDocumentBrowse
import io.jmix.tests.ui.screen.system.dialog.ConfirmationDialog
import io.jmix.tests.ui.screen.system.main.MainScreen
import io.jmix.tests.ui.test.webdav.WebDAVBaseUITest
import io.jmix.tests.ui.test.webdav.WebDavContextInitializer
import io.jmix.webdav.WebdavProperties
import io.jmix.webdav.entity.WebdavDocument
import org.junit.jupiter.api.BeforeEach
Expand All @@ -23,8 +24,6 @@ import org.slf4j.LoggerFactory
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.boot.test.context.SpringBootTest
import org.springframework.test.context.ContextConfiguration
import org.springframework.test.context.DynamicPropertyRegistry
import org.springframework.test.context.DynamicPropertySource

import static io.jmix.masquerade.Selectors.$j

Expand All @@ -36,7 +35,7 @@ import static io.jmix.masquerade.Selectors.$j
@SpringBootTest(classes = JmixUiTestsApplication,
webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT/*,
properties = ["jmix.webdav.auto-generate-unique-resource-uri=false"]*/)
@ContextConfiguration(initializers = TestContextInitializer)
@ContextConfiguration(initializers = [TestContextInitializer, WebDavContextInitializer])
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
class WDUniqueNamesPropertyDisabledUiTest extends WebDAVBaseUITest {

Expand All @@ -51,12 +50,6 @@ class WDUniqueNamesPropertyDisabledUiTest extends WebDAVBaseUITest {

private static final Logger log = LoggerFactory.getLogger(WDUniqueNamesPropertyDisabledUiTest)

@DynamicPropertySource
static void dynamicProperties(DynamicPropertyRegistry registry) {
registry.add("jmix.webdav.auto-generate-unique-resource-uri", () -> false)
log.debug("dynamicProperties invoked")
}

@BeforeEach
void beforeEachTest() {
loginAsAdmin()
Expand Down

0 comments on commit caa8b83

Please sign in to comment.