Skip to content

Commit

Permalink
test reverting changes in pubsub binder
Browse files Browse the repository at this point in the history
  • Loading branch information
diegomarquezp committed Dec 30, 2024
1 parent c14b659 commit 4eae5e7
Showing 1 changed file with 15 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,13 @@
package com.google.cloud.spring.stream.binder.pubsub;

import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;

import com.google.api.gax.core.CredentialsProvider;
import com.google.auth.CredentialTypeForMetrics;
import com.google.auth.Credentials;
import com.google.cloud.spring.core.GcpProjectIdProvider;
import com.google.cloud.spring.pubsub.PubSubAdmin;
import com.google.cloud.spring.pubsub.core.PubSubTemplate;
Expand Down Expand Up @@ -101,11 +104,10 @@ void init() {
new ApplicationContextRunner()
.withBean(PubSubTemplate.class, () -> pubSubTemplate)
.withBean(PubSubAdmin.class, () -> pubSubAdmin)
.withUserConfiguration(BaseTestConfiguration.class)
.withConfiguration(
AutoConfigurations.of(
PubSubBinderConfiguration.class
));
PubSubBinderConfiguration.class,
PubSubExtendedBindingProperties.class));
this.binder = new PubSubMessageChannelBinder(new String[0], this.channelProvisioner, this.pubSubTemplate, this.properties);
}

Expand Down Expand Up @@ -362,24 +364,6 @@ void testConsumerEndpointCreationWithHeadersProvided() {
});
}

@EnableAutoConfiguration
public static class BaseTestConfiguration {
@Bean
public PubSubExtendedBindingProperties pubSubExtendedBindingProperties() {
return new PubSubExtendedBindingProperties();
}

@Bean
public CredentialsProvider googleCredentials() {
return () -> TestUtils.MOCK_CREDENTIALS;
}

@Bean
public GcpProjectIdProvider projectIdProvider() {
return () -> "fake project";
}
}

@EnableAutoConfiguration
public static class PubSubBinderTestConfig {

Expand All @@ -403,5 +387,15 @@ public Supplier<Flux<String>> producer() {
public Consumer<String> consumer() {
return str -> LOGGER.info("received " + str);
}

@Bean
public GcpProjectIdProvider projectIdProvider() {
return () -> "fake project";
}

@Bean
public CredentialsProvider googleCredentials() {
return () -> TestUtils.MOCK_CREDENTIALS;
}
}
}

0 comments on commit 4eae5e7

Please sign in to comment.