Skip to content

Commit

Permalink
HSEARCH-4072 Speed up LibraryShowcaseSearchIT
Browse files Browse the repository at this point in the history
Signed-off-by: Yoann Rodière <yoann@hibernate.org>
  • Loading branch information
yrodiere authored and fax4ever committed Nov 9, 2020
1 parent 1e90d58 commit b755e77
Showing 1 changed file with 14 additions and 3 deletions.
Expand Up @@ -55,6 +55,7 @@
import org.hibernate.search.util.common.data.Range;

import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;

Expand All @@ -67,8 +68,10 @@
@RunWith(SpringRunner.class)
@SpringBootTest
@ActiveProfiles(resolver = TestActiveProfilesResolver.class)
@DirtiesContext(classMode = DirtiesContext.ClassMode.BEFORE_EACH_TEST_METHOD)
public class LibraryShowcaseBaseIT {
@DirtiesContext(classMode = DirtiesContext.ClassMode.BEFORE_CLASS)
public class LibraryShowcaseSearchIT {

private static boolean needsInit;

@Autowired
private DocumentService documentService;
Expand All @@ -82,9 +85,17 @@ public class LibraryShowcaseBaseIT {
@Autowired
private TestDataService testDataService;

@BeforeClass
public static void beforeClass() {
needsInit = true;
}

@Before
public void before() {
testDataService.initDefaultDataSet();
if ( needsInit ) {
testDataService.initDefaultDataSet();
needsInit = false;
}
}

@Test
Expand Down

0 comments on commit b755e77

Please sign in to comment.