mirror of
https://github.com/datahub-project/datahub.git
synced 2025-08-05 07:47:56 +00:00
test(mce-consumer): mockbeans (#6878)
This commit is contained in:
parent
1503ef38f9
commit
b5275acab8
@ -8,13 +8,13 @@ import com.linkedin.metadata.graph.SiblingGraphService;
|
|||||||
import com.linkedin.metadata.models.registry.ConfigEntityRegistry;
|
import com.linkedin.metadata.models.registry.ConfigEntityRegistry;
|
||||||
import com.linkedin.metadata.models.registry.EntityRegistry;
|
import com.linkedin.metadata.models.registry.EntityRegistry;
|
||||||
import com.linkedin.metadata.restli.DefaultRestliClientFactory;
|
import com.linkedin.metadata.restli.DefaultRestliClientFactory;
|
||||||
import com.linkedin.metadata.timeseries.elastic.ElasticSearchTimeseriesAspectService;
|
import com.linkedin.metadata.timeseries.TimeseriesAspectService;
|
||||||
import com.linkedin.parseq.retry.backoff.ExponentialBackoff;
|
import com.linkedin.parseq.retry.backoff.ExponentialBackoff;
|
||||||
import com.linkedin.restli.client.Client;
|
import com.linkedin.restli.client.Client;
|
||||||
import io.ebean.EbeanServer;
|
import io.ebean.EbeanServer;
|
||||||
import org.mockito.Mockito;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.boot.test.context.TestConfiguration;
|
import org.springframework.boot.test.context.TestConfiguration;
|
||||||
|
import org.springframework.boot.test.mock.mockito.MockBean;
|
||||||
import org.springframework.boot.test.web.client.TestRestTemplate;
|
import org.springframework.boot.test.web.client.TestRestTemplate;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Import;
|
import org.springframework.context.annotation.Import;
|
||||||
@ -29,17 +29,11 @@ public class MceConsumerApplicationTestConfiguration {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private TestRestTemplate restTemplate;
|
private TestRestTemplate restTemplate;
|
||||||
|
|
||||||
@Bean("kafkaHealthChecker")
|
@MockBean
|
||||||
@Primary
|
public KafkaHealthChecker kafkaHealthChecker;
|
||||||
public KafkaHealthChecker kafkaHealthChecker() {
|
|
||||||
return Mockito.mock(KafkaHealthChecker.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Bean("entityService")
|
@MockBean
|
||||||
@Primary
|
public EntityService entityService;
|
||||||
public EntityService entityService() {
|
|
||||||
return Mockito.mock(EntityService.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Bean("restliEntityClient")
|
@Bean("restliEntityClient")
|
||||||
@Primary
|
@Primary
|
||||||
@ -49,32 +43,18 @@ public class MceConsumerApplicationTestConfiguration {
|
|||||||
return new RestliEntityClient(restClient, new ExponentialBackoff(1), 1);
|
return new RestliEntityClient(restClient, new ExponentialBackoff(1), 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Bean
|
@MockBean
|
||||||
@Primary
|
public EbeanServer ebeanServer;
|
||||||
public EbeanServer ebeanServer() {
|
|
||||||
return Mockito.mock(EbeanServer.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Bean(name = "elasticSearchTimeseriesAspectService")
|
@MockBean
|
||||||
@Primary
|
protected TimeseriesAspectService timeseriesAspectService;
|
||||||
protected ElasticSearchTimeseriesAspectService elasticSearchTimeseriesAspectService() {
|
|
||||||
return Mockito.mock(ElasticSearchTimeseriesAspectService.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Bean("entityRegistry")
|
@MockBean
|
||||||
@Primary
|
protected EntityRegistry entityRegistry;
|
||||||
protected EntityRegistry entityRegistry() {
|
|
||||||
return Mockito.mock(EntityRegistry.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Bean("configEntityRegistry")
|
@MockBean
|
||||||
protected ConfigEntityRegistry configEntityRegistry() {
|
protected ConfigEntityRegistry configEntityRegistry;
|
||||||
return Mockito.mock(ConfigEntityRegistry.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Bean("siblingGraphService")
|
@MockBean
|
||||||
@Primary
|
protected SiblingGraphService siblingGraphService;
|
||||||
protected SiblingGraphService siblingGraphService() {
|
|
||||||
return Mockito.mock(SiblingGraphService.class);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user