Skip to content

Commit

Permalink
Fix checkstyle issues
Browse files Browse the repository at this point in the history
  • Loading branch information
sydney-munro committed Mar 28, 2022
1 parent 9d1c73a commit 6d92957
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 16 deletions.
Expand Up @@ -19,15 +19,16 @@
// [START storage_create_bucket_notifications]

import com.google.cloud.storage.Bucket;
import com.google.cloud.storage.Storage;
import com.google.cloud.storage.StorageOptions;
import com.google.cloud.storage.Notification;
import com.google.cloud.storage.NotificationInfo;
import com.google.cloud.storage.Storage;
import com.google.cloud.storage.StorageOptions;


public class CreateBucketPubSubNotification {

public static void createBucketPubSubNotification(String bucketName, NotificationInfo notificationInfo) {
public static void createBucketPubSubNotification(String bucketName,
NotificationInfo notificationInfo) {
// The ID to give your GCS bucket
// String bucketName = "your-unique-bucket-name";
// The NotificationInfo for the notification you would like to create
Expand Down
Expand Up @@ -32,7 +32,7 @@ public static void deleteBucketPubSubNotification(String bucketName, String noti
// String notificationId = "your-unique-notification-id"
Storage storage = StorageOptions.newBuilder().build().getService();
boolean success = storage.deleteNotification(bucketName, notificationId);
if(success) {
if (success) {
System.out.println("Successfully deleted notification");
} else {
System.out.println("Failed to find notification");
Expand Down
Expand Up @@ -19,9 +19,9 @@
// [START storage_list_bucket_notifications]

import com.google.cloud.storage.Bucket;
import com.google.cloud.storage.Notification;
import com.google.cloud.storage.Storage;
import com.google.cloud.storage.StorageOptions;
import com.google.cloud.storage.Notification;
import java.util.List;


Expand All @@ -32,8 +32,9 @@ public static void listPubSubNotifications(String bucketName) {
// String bucketName = "your-unique-bucket-name";
Storage storage = StorageOptions.newBuilder().build().getService();
List<Notification> notificationList = storage.listNotifications(bucketName);
for(Notification notification : notificationList) {
System.out.println("Found notification " + notification.getTopic() + " for bucket "+ bucketName);
for (Notification notification : notificationList) {
System.out.println(
"Found notification " + notification.getTopic() + " for bucket " + bucketName);
}
}
}
Expand Down
Expand Up @@ -19,9 +19,9 @@
// [START storage_print_pubsub_bucket_notification]

import com.google.cloud.storage.Bucket;
import com.google.cloud.storage.Notification;
import com.google.cloud.storage.Storage;
import com.google.cloud.storage.StorageOptions;
import com.google.cloud.storage.Notification;
import java.util.List;


Expand All @@ -35,7 +35,8 @@ public static void printPubSubNotification(String bucketName, String notificatio

Storage storage = StorageOptions.newBuilder().build().getService();
Notification notification = storage.getNotification(bucketName, notificationId);
System.out.println("Found notification " + notification.getTopic() + " for bucket "+ bucketName);
System.out.println(
"Found notification " + notification.getTopic() + " for bucket " + bucketName);
}
}
// [END storage_print_pubsub_bucket_notification]
Expand Up @@ -19,8 +19,8 @@
import static com.google.common.truth.Truth.assertThat;
import static org.junit.Assert.assertNotNull;

import com.google.cloud.pubsub.v1.TopicAdminClient;
import com.example.storage.TestBase;
import com.google.cloud.pubsub.v1.TopicAdminClient;
import com.google.cloud.storage.Notification;
import com.google.cloud.storage.NotificationInfo;
import com.google.common.collect.ImmutableMap;
Expand All @@ -34,6 +34,7 @@
import org.junit.Test;

public class CreateBucketPubSubNotificationTest extends TestBase {

private static final Notification.PayloadFormat PAYLOAD_FORMAT =
Notification.PayloadFormat.JSON_API_V1.JSON_API_V1;
private static final Map<String, String> CUSTOM_ATTRIBUTES = ImmutableMap.of("label1", "value1");
Expand All @@ -43,7 +44,7 @@ public class CreateBucketPubSubNotificationTest extends TestBase {

@BeforeClass
public static void configureTopicAdminClient() throws IOException {
if(PROJECT != null) {
if (PROJECT != null) {
topicAdminClient = TopicAdminClient.create();
topicAdminClient.createTopic(TOPIC);
GetIamPolicyRequest getIamPolicyRequest =
Expand Down
Expand Up @@ -19,8 +19,8 @@
import static com.google.common.truth.Truth.assertThat;
import static org.junit.Assert.assertNotNull;

import com.google.cloud.pubsub.v1.TopicAdminClient;
import com.example.storage.TestBase;
import com.google.cloud.pubsub.v1.TopicAdminClient;
import com.google.cloud.storage.Notification;
import com.google.cloud.storage.NotificationInfo;
import com.google.common.collect.ImmutableMap;
Expand Down
Expand Up @@ -19,8 +19,8 @@
import static com.google.common.truth.Truth.assertThat;
import static org.junit.Assert.assertNotNull;

import com.google.cloud.pubsub.v1.TopicAdminClient;
import com.example.storage.TestBase;
import com.google.cloud.pubsub.v1.TopicAdminClient;
import com.google.cloud.storage.Notification;
import com.google.cloud.storage.NotificationInfo;
import com.google.common.collect.ImmutableMap;
Expand All @@ -34,6 +34,7 @@
import org.junit.Test;

public class ListPubSubNotificationsTest extends TestBase {

private static final Notification.PayloadFormat PAYLOAD_FORMAT =
Notification.PayloadFormat.JSON_API_V1.JSON_API_V1;
private static final Map<String, String> CUSTOM_ATTRIBUTES = ImmutableMap.of("label1", "value1");
Expand All @@ -43,7 +44,7 @@ public class ListPubSubNotificationsTest extends TestBase {

@BeforeClass
public static void configureTopicAdminClient() throws IOException {
if(PROJECT != null) {
if (PROJECT != null) {
topicAdminClient = TopicAdminClient.create();
topicAdminClient.createTopic(TOPIC);
GetIamPolicyRequest getIamPolicyRequest =
Expand Down
Expand Up @@ -19,8 +19,8 @@
import static com.google.common.truth.Truth.assertThat;
import static org.junit.Assert.assertNotNull;

import com.google.cloud.pubsub.v1.TopicAdminClient;
import com.example.storage.TestBase;
import com.google.cloud.pubsub.v1.TopicAdminClient;
import com.google.cloud.storage.Notification;
import com.google.cloud.storage.NotificationInfo;
import com.google.common.collect.ImmutableMap;
Expand All @@ -34,6 +34,7 @@
import org.junit.Test;

public class PrintPubSubNotificationTest extends TestBase {

private static final Notification.PayloadFormat PAYLOAD_FORMAT =
Notification.PayloadFormat.JSON_API_V1.JSON_API_V1;
private static final Map<String, String> CUSTOM_ATTRIBUTES = ImmutableMap.of("label1", "value1");
Expand All @@ -43,7 +44,7 @@ public class PrintPubSubNotificationTest extends TestBase {

@BeforeClass
public static void configureTopicAdminClient() throws IOException {
if(PROJECT != null) {
if (PROJECT != null) {
topicAdminClient = TopicAdminClient.create();
topicAdminClient.createTopic(TOPIC);
GetIamPolicyRequest getIamPolicyRequest =
Expand Down

0 comments on commit 6d92957

Please sign in to comment.