diff --git a/google-cloud-errorreporting/pom.xml b/google-cloud-errorreporting/pom.xml
index 8def1aae..57785c68 100644
--- a/google-cloud-errorreporting/pom.xml
+++ b/google-cloud-errorreporting/pom.xml
@@ -73,6 +73,11 @@
junit
test
+
+ com.google.cloud
+ google-cloud-core
+ test
+
diff --git a/google-cloud-errorreporting/src/test/java/com/google/cloud/errorreporting/v1beta1/it/ITSystemTest.java b/google-cloud-errorreporting/src/test/java/com/google/cloud/errorreporting/v1beta1/it/ITSystemTest.java
new file mode 100644
index 00000000..bc67def9
--- /dev/null
+++ b/google-cloud-errorreporting/src/test/java/com/google/cloud/errorreporting/v1beta1/it/ITSystemTest.java
@@ -0,0 +1,148 @@
+/*
+ * Copyright 2019 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.google.cloud.errorreporting.v1beta1.it;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import com.google.api.gax.rpc.InvalidArgumentException;
+import com.google.cloud.ServiceOptions;
+import com.google.cloud.errorreporting.v1beta1.ErrorGroupServiceClient;
+import com.google.cloud.errorreporting.v1beta1.ErrorStatsServiceClient;
+import com.google.cloud.errorreporting.v1beta1.ReportErrorsServiceClient;
+import com.google.common.collect.Lists;
+import com.google.devtools.clouderrorreporting.v1beta1.ErrorEvent;
+import com.google.devtools.clouderrorreporting.v1beta1.ErrorGroup;
+import com.google.devtools.clouderrorreporting.v1beta1.ErrorGroupStats;
+import com.google.devtools.clouderrorreporting.v1beta1.GroupName;
+import com.google.devtools.clouderrorreporting.v1beta1.ProjectName;
+import com.google.devtools.clouderrorreporting.v1beta1.QueryTimeRange;
+import com.google.devtools.clouderrorreporting.v1beta1.ReportErrorEventResponse;
+import com.google.devtools.clouderrorreporting.v1beta1.ReportedErrorEvent;
+import java.util.List;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class ITSystemTest {
+
+ private static ErrorGroupServiceClient errorGroupServiceClient;
+ private static ReportErrorsServiceClient reportErrorsServiceClient;
+ private static ErrorStatsServiceClient errorStatsServiceClient;
+
+ private static final String PROJECT_ID = ServiceOptions.getDefaultProjectId();
+ private static final ProjectName PROJECT_NAME = ProjectName.of(PROJECT_ID);
+ private static final QueryTimeRange TIME_RANGE = QueryTimeRange.newBuilder().build();
+
+ @BeforeClass
+ public static void beforeClass() throws Exception {
+ errorGroupServiceClient = ErrorGroupServiceClient.create();
+ errorStatsServiceClient = ErrorStatsServiceClient.create();
+ reportErrorsServiceClient = ReportErrorsServiceClient.create();
+ }
+
+ @AfterClass
+ public static void afterClass() {
+ errorGroupServiceClient.close();
+ errorStatsServiceClient.close();
+ reportErrorsServiceClient.close();
+ }
+
+ @Test
+ public void listGroupStatsTest() {
+ ErrorStatsServiceClient.ListGroupStatsPagedResponse pagedListResponse =
+ errorStatsServiceClient.listGroupStats(PROJECT_NAME, TIME_RANGE);
+ List errorGroupStats = Lists.newArrayList(pagedListResponse.iterateAll());
+ if (errorGroupStats.size() > 0) {
+ ErrorGroup group =
+ errorGroupServiceClient.getGroup(errorGroupStats.get(0).getGroup().getName());
+ assertNotNull(group);
+ assertEquals(errorGroupStats.get(0).getGroup(), group);
+ assertEquals(errorGroupStats.get(0).getGroup().getGroupId(), group.getGroupId());
+ assertEquals(errorGroupStats.get(0).getGroup().getName(), group.getName());
+ }
+ }
+
+ @Test
+ public void listEventsTest() {
+ ErrorStatsServiceClient.ListGroupStatsPagedResponse pagedListResponse =
+ errorStatsServiceClient.listGroupStats(PROJECT_NAME, TIME_RANGE);
+ List errorGroupStats = Lists.newArrayList(pagedListResponse.iterateAll());
+ if (errorGroupStats.size() > 0) {
+ Iterable errorEvent =
+ errorStatsServiceClient
+ .listEvents(PROJECT_NAME, errorGroupStats.get(0).getGroup().getGroupId())
+ .iterateAll();
+ assertNotNull(errorEvent);
+ assertTrue(errorEvent.iterator().hasNext());
+ assertNotNull(errorEvent.iterator().next());
+ }
+ }
+
+ @Test
+ public void getGroupTest() {
+ ErrorStatsServiceClient.ListGroupStatsPagedResponse pagedListResponse =
+ errorStatsServiceClient.listGroupStats(PROJECT_NAME, TIME_RANGE);
+ List errorGroupStats = Lists.newArrayList(pagedListResponse.iterateAll());
+ if (errorGroupStats.size() > 0) {
+ ErrorGroup group =
+ errorGroupServiceClient.getGroup(errorGroupStats.get(0).getGroup().getName());
+ assertNotNull(group);
+ assertEquals(errorGroupStats.get(0).getGroup(), group);
+ assertEquals(errorGroupStats.get(0).getGroup().getGroupId(), group.getGroupId());
+ assertEquals(errorGroupStats.get(0).getGroup().getName(), group.getName());
+ }
+ }
+
+ @Test(expected = InvalidArgumentException.class)
+ public void getGroupExceptionTest() {
+ GroupName group = GroupName.of(PROJECT_ID, "DUMMY-GROUP");
+ errorGroupServiceClient.getGroup(group);
+ }
+
+ @Test
+ public void reportErrorEventTest() {
+ String message =
+ "{\n"
+ + " \"context\": {\n"
+ + " \"httpRequest\": {\n"
+ + " \"responseStatusCode\": 500,\n"
+ + " \"method\": \"GET\",\n"
+ + " \"url\": \"http://example.com/product/"\n"
+ + " },\n"
+ + " \"user\": \"2247177\"\n"
+ + " },\n"
+ + " \"message\": \"org.springframework.web.client.HttpServerErrorException: 500 Server Error\n"
+ + " at org.springframework.web.client.DefaultResponseErrorHandler.handleError(DefaultResponseErrorHandler.java: 94)\n"
+ + " \",\n"
+ + " \"serviceContext\": {\n"
+ + " \"service\": \"cart\",\n"
+ + " \"version\": \"\"\n"
+ + " }";
+ ReportedErrorEvent event = ReportedErrorEvent.newBuilder().setMessage(message).build();
+ ReportErrorEventResponse errorEventResponse =
+ reportErrorsServiceClient.reportErrorEvent(PROJECT_NAME, event);
+ assertNotNull(errorEventResponse);
+ assertTrue(errorEventResponse.isInitialized());
+ }
+
+ @Test(expected = InvalidArgumentException.class)
+ public void reportErrorEventExceptionTest() {
+ ReportedErrorEvent event = ReportedErrorEvent.newBuilder().build();
+ reportErrorsServiceClient.reportErrorEvent(PROJECT_NAME, event);
+ }
+}
diff --git a/pom.xml b/pom.xml
index 6e882858..0ee8086a 100644
--- a/pom.xml
+++ b/pom.xml
@@ -121,6 +121,11 @@
proto-google-common-protos
${google.common-protos.version}
+
+ com.google.cloud
+ google-cloud-core
+ ${google.core.version}
+
org.threeten
threetenbp