मैं अपने वसंत बूट एकीकरण परीक्षण में एम्बेडेड लोचदार खोज जोड़ने का तरीका ढूंढ रहा हूं।लोचदार खोज स्प्रिंग बूट एकीकरण परीक्षण
मैंने लोचदार खोज एकीकरण परीक्षण देखा लेकिन यह वसंत बूट के साथ मिलकर काम नहीं करता क्योंकि दोनों को अलग-अलग परीक्षण धावक का उपयोग करना चाहिए। उन्हें कैसे चलाने के लिए या क्या विकल्प है बनाने के लिए
java.lang.IllegalStateException: No context information for thread: Thread[id=1, name=main, state=RUNNABLE, group=main]. Is this thread running under a class com.carrotsearch.randomizedtesting.RandomizedRunner runner context? Add @RunWith(class com.carrotsearch.randomizedtesting.RandomizedRunner.class) to your test class. Make sure your code accesses random contexts within @BeforeClass and @AfterClass boundary (for example, static test class initializers are not permitted to access random contexts).
@RunWith(SpringJUnit4ClassRunner.class)
@SpringApplicationConfiguration(classes = App.class)
@WebAppConfiguration
@IntegrationTest("server.port:0")
public class TestExample extends ElasticsearchIntegrationTest {
TestRestTemplate testRestTemplate = new TestRestTemplate();
@Value("${local.server.port}")
int port;
@Test
public void testOne(){
ResponseEntity<String> results = testRestTemplate.getForEntity(String.format("http://localhost:%d/client/1", port), String.class);
System.out.print(results);
}
}
करता है किसी को भी कुछ विचार है ??:
मैं दुर्भाग्य से यह त्रुटि के साथ काम नहीं करता है के रूप में नीचे एक कक्षा की परीक्षा है
गाने abo यह: https://github.com/spring-projects/spring-boot/blob/master/spring-boot-samples/spring-boot-sample-data-elasticsearch/? – Val
मैंने इसे पहले ही देखा है। सबसे पहले मैं वसंत-डेटा का उपयोग नहीं करता, दूसरी बात मुझे ईएस के एम्बेडेड संस्करण की आवश्यकता है। –