Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: stabilize unit test testUpgradePopularSpacesPortlet - EXO-66907 #173

Merged
merged 1 commit into from
Oct 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,19 @@ public class PopularSpacesRemovePreferencesTest extends AbstractKernelTest {
protected EntityManagerService entityManagerService;
protected Page testPage;

public PopularSpacesRemovePreferencesTest() {
setForceContainerReload(true);
}

@Before
public void setUp() {
container = PortalContainer.getInstance();
public void setUp() throws Exception {
super.setUp();
container = getContainer();
pageService = container.getComponentInstanceOfType(PageService.class);
dataStorage = container.getComponentInstanceOfType(DataStorage.class);
entityManagerService = container.getComponentInstanceOfType(EntityManagerService.class);

begin();
}

@Test
Expand Down Expand Up @@ -75,7 +81,7 @@ public void testUpgradePopularSpacesPortlet() throws Exception {
@After
public void tearDown() throws Exception {
pageService.destroyPage(testPage.getPageKey());
RequestLifeCycle.end();
end();
}

private Page createPage(String pageName, String contentId) throws Exception {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import org.exoplatform.commons.api.settings.data.Context;
import org.exoplatform.commons.api.settings.data.Scope;
import org.exoplatform.commons.persistence.impl.EntityManagerService;
import org.exoplatform.component.test.AbstractKernelTest;
import org.exoplatform.component.test.ConfigurationUnit;
import org.exoplatform.component.test.ConfiguredBy;
import org.exoplatform.component.test.ContainerScope;
Expand Down Expand Up @@ -33,8 +34,12 @@
import static org.junit.Assert.*;

@RunWith(MockitoJUnitRunner.class)
@ConfiguredBy({ @ConfigurationUnit(scope = ContainerScope.PORTAL, path = "conf/portal/configuration.xml") })
public class SpaceApplicationMigrationTest {
@ConfiguredBy({
@ConfigurationUnit(scope = ContainerScope.PORTAL, path = "conf/portal/configuration.xml"),
@ConfigurationUnit(scope = ContainerScope.PORTAL, path = "conf/exo.portal.component.portal-configuration-local.xml"),
@ConfigurationUnit(scope = ContainerScope.PORTAL, path = "org/exoplatform/portal/config/conf/configuration.xml")
})
public class SpaceApplicationMigrationTest extends AbstractKernelTest {

protected PortalContainer container;

Expand All @@ -50,9 +55,13 @@ public class SpaceApplicationMigrationTest {

private SpaceApplicationMigration spaceApplicationMigration;

public SpaceApplicationMigrationTest() {
setForceContainerReload(true);
}

@Before
public void setUp() {
container = PortalContainer.getInstance();
container = getContainer();
this.spaceService = container.getComponentInstanceOfType(SpaceService.class);
this.navigationService = container.getComponentInstanceOfType(NavigationService.class);
this.identityRegistry = container.getComponentInstanceOfType(IdentityRegistry.class);
Expand Down