Skip to content

Commit

Permalink
test(mce-consumer): mockbeans (datahub-project#6878)
Browse files Browse the repository at this point in the history
  • Loading branch information
david-leifker authored and cccs-Dustin committed Feb 1, 2023
1 parent e7cc919 commit 86ddbb7
Showing 1 changed file with 16 additions and 36 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@
import com.linkedin.metadata.models.registry.ConfigEntityRegistry;
import com.linkedin.metadata.models.registry.EntityRegistry;
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.restli.client.Client;
import io.ebean.EbeanServer;
import org.mockito.Mockito;
import org.springframework.beans.factory.annotation.Autowired;
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.context.annotation.Bean;
import org.springframework.context.annotation.Import;
Expand All @@ -29,17 +29,11 @@ public class MceConsumerApplicationTestConfiguration {
@Autowired
private TestRestTemplate restTemplate;

@Bean("kafkaHealthChecker")
@Primary
public KafkaHealthChecker kafkaHealthChecker() {
return Mockito.mock(KafkaHealthChecker.class);
}
@MockBean
public KafkaHealthChecker kafkaHealthChecker;

@Bean("entityService")
@Primary
public EntityService entityService() {
return Mockito.mock(EntityService.class);
}
@MockBean
public EntityService entityService;

@Bean("restliEntityClient")
@Primary
Expand All @@ -49,32 +43,18 @@ public RestliEntityClient restliEntityClient() {
return new RestliEntityClient(restClient, new ExponentialBackoff(1), 1);
}

@Bean
@Primary
public EbeanServer ebeanServer() {
return Mockito.mock(EbeanServer.class);
}
@MockBean
public EbeanServer ebeanServer;

@Bean(name = "elasticSearchTimeseriesAspectService")
@Primary
protected ElasticSearchTimeseriesAspectService elasticSearchTimeseriesAspectService() {
return Mockito.mock(ElasticSearchTimeseriesAspectService.class);
}
@MockBean
protected TimeseriesAspectService timeseriesAspectService;

@Bean("entityRegistry")
@Primary
protected EntityRegistry entityRegistry() {
return Mockito.mock(EntityRegistry.class);
}
@MockBean
protected EntityRegistry entityRegistry;

@Bean("configEntityRegistry")
protected ConfigEntityRegistry configEntityRegistry() {
return Mockito.mock(ConfigEntityRegistry.class);
}
@MockBean
protected ConfigEntityRegistry configEntityRegistry;

@Bean("siblingGraphService")
@Primary
protected SiblingGraphService siblingGraphService() {
return Mockito.mock(SiblingGraphService.class);
}
@MockBean
protected SiblingGraphService siblingGraphService;
}

0 comments on commit 86ddbb7

Please sign in to comment.