mirror of
https://github.com/datahub-project/datahub.git
synced 2025-12-28 02:17:53 +00:00
fix(mae-consumer): fix aspect retriever injections mae-consumer (#10125)
This commit is contained in:
parent
eb2278ccfd
commit
f726135673
@ -0,0 +1,23 @@
|
||||
package com.linkedin.metadata.kafka;
|
||||
|
||||
import com.linkedin.metadata.aspect.AspectRetriever;
|
||||
import com.linkedin.metadata.search.EntitySearchService;
|
||||
import javax.annotation.PostConstruct;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@Configuration
|
||||
public class MaeConsumerConfig {
|
||||
|
||||
@Autowired
|
||||
@Qualifier("cachingAspectRetriever")
|
||||
private AspectRetriever aspectRetriever;
|
||||
|
||||
@Autowired private EntitySearchService entitySearchService;
|
||||
|
||||
@PostConstruct
|
||||
protected void postConstruct() {
|
||||
entitySearchService.postConstruct(aspectRetriever);
|
||||
}
|
||||
}
|
||||
@ -2,9 +2,13 @@ package com.linkedin.metadata.kafka;
|
||||
|
||||
import static org.testng.AssertJUnit.*;
|
||||
|
||||
import com.linkedin.metadata.aspect.AspectRetriever;
|
||||
import com.linkedin.metadata.entity.EntityService;
|
||||
import com.linkedin.metadata.search.EntitySearchService;
|
||||
import com.linkedin.metadata.search.elasticsearch.query.ESSearchDAO;
|
||||
import com.linkedin.metadata.service.FormService;
|
||||
import io.datahubproject.metadata.jobs.common.health.kafka.KafkaHealthIndicator;
|
||||
import org.apache.commons.lang3.reflect.FieldUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.test.context.ActiveProfiles;
|
||||
@ -22,10 +26,20 @@ public class MaeConsumerApplicationTest extends AbstractTestNGSpringContextTests
|
||||
|
||||
@Autowired private FormService formService;
|
||||
|
||||
@Autowired private EntitySearchService entitySearchService;
|
||||
|
||||
@Test
|
||||
public void testMaeConsumerAutoWiring() {
|
||||
assertNotNull(mockEntityService);
|
||||
assertNotNull(kafkaHealthIndicator);
|
||||
assertNotNull(formService);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testPostConstruct() throws IllegalAccessException {
|
||||
ESSearchDAO test = (ESSearchDAO) FieldUtils.readField(entitySearchService, "esSearchDAO", true);
|
||||
AspectRetriever aspectRetriever =
|
||||
(AspectRetriever) FieldUtils.readField(test, "aspectRetriever", true);
|
||||
assertNotNull(aspectRetriever);
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user