Search in sources :

Example 1 with DefaultGcpProjectIdProvider

use of org.springframework.cloud.gcp.core.DefaultGcpProjectIdProvider in project spring-cloud-gcp by spring-cloud.

the class StackdriverJsonLayout method start.

@Override
public void start() {
    super.start();
    // If no Project ID set, then attempt to resolve it with the default project ID provider
    if (StringUtils.isEmpty(this.projectId) || this.projectId.endsWith("_IS_UNDEFINED")) {
        GcpProjectIdProvider projectIdProvider = new DefaultGcpProjectIdProvider();
        this.projectId = projectIdProvider.getProjectId();
    }
}
Also used : DefaultGcpProjectIdProvider(org.springframework.cloud.gcp.core.DefaultGcpProjectIdProvider) GcpProjectIdProvider(org.springframework.cloud.gcp.core.GcpProjectIdProvider) DefaultGcpProjectIdProvider(org.springframework.cloud.gcp.core.DefaultGcpProjectIdProvider)

Example 2 with DefaultGcpProjectIdProvider

use of org.springframework.cloud.gcp.core.DefaultGcpProjectIdProvider in project spring-cloud-gcp by spring-cloud.

the class PubSubChannelAdaptersIntegrationTests method enableTests.

@BeforeClass
public static void enableTests() throws IOException {
    assumeThat(System.getProperty("it.pubsub")).isEqualTo("true");
    pubSubAdmin = new PubSubAdmin(new DefaultGcpProjectIdProvider(), new DefaultCredentialsProvider(() -> new Credentials()));
}
Also used : DefaultCredentialsProvider(org.springframework.cloud.gcp.core.DefaultCredentialsProvider) Credentials(org.springframework.cloud.gcp.core.Credentials) PubSubAdmin(org.springframework.cloud.gcp.pubsub.PubSubAdmin) DefaultGcpProjectIdProvider(org.springframework.cloud.gcp.core.DefaultGcpProjectIdProvider) BeforeClass(org.junit.BeforeClass)

Aggregations

DefaultGcpProjectIdProvider (org.springframework.cloud.gcp.core.DefaultGcpProjectIdProvider)2 BeforeClass (org.junit.BeforeClass)1 Credentials (org.springframework.cloud.gcp.core.Credentials)1 DefaultCredentialsProvider (org.springframework.cloud.gcp.core.DefaultCredentialsProvider)1 GcpProjectIdProvider (org.springframework.cloud.gcp.core.GcpProjectIdProvider)1 PubSubAdmin (org.springframework.cloud.gcp.pubsub.PubSubAdmin)1