+ @Test(expected = CambriaApiException.class)
+ public void testPushEvents_DMaaPAccessDeniedException()
+ throws AccessDeniedException, CambriaApiException, IOException, TopicExistsException, ConfigDbException,
+ missingReqdSetting {
+ doThrow(new DMaaPAccessDeniedException(errorResponse)).when(eventsService).pushEvents(ArgumentMatchers.any(DMaaPContext.class), ArgumentMatchers.any(String.class), ArgumentMatchers.any(InputStream.class), ArgumentMatchers.any(String.class), ArgumentMatchers.isNull());
+
+ eventsRestService.pushEvents("topicName", iStream, "partitionKey");
+
+ }
+
+ @Test(expected = CambriaApiException.class)
+ public void testPushEvents_ConfigDbException()
+ throws AccessDeniedException, CambriaApiException, IOException, TopicExistsException, ConfigDbException,
+ missingReqdSetting {
+ doThrow(new ConfigDbException("error")).when(eventsService).pushEvents(ArgumentMatchers.any(DMaaPContext.class), ArgumentMatchers.any(String.class), ArgumentMatchers.any(InputStream.class), ArgumentMatchers.any(String.class), ArgumentMatchers.isNull());
+
+ eventsRestService.pushEvents("topicName", iStream, "partitionKey");
+
+ }
+
+ @Test(expected = CambriaApiException.class)
+ public void testPushEvents_IOException()
+ throws AccessDeniedException, CambriaApiException, IOException, TopicExistsException, ConfigDbException,
+ missingReqdSetting {
+ doThrow(new IOException("error")).when(eventsService).pushEvents(ArgumentMatchers.any(DMaaPContext.class), ArgumentMatchers.any(String.class), ArgumentMatchers.any(InputStream.class), ArgumentMatchers.any(String.class), ArgumentMatchers.isNull());
+
+ eventsRestService.pushEvents("topicName", iStream, "partitionKey");
+
+ }
+
+ @Test(expected = CambriaApiException.class)
+ public void testPushEvents_missingReqdSetting()
+ throws AccessDeniedException, CambriaApiException, IOException, TopicExistsException, ConfigDbException,
+ missingReqdSetting {
+ doThrow(new missingReqdSetting("error")).when(eventsService).pushEvents(ArgumentMatchers.any(DMaaPContext.class), ArgumentMatchers.any(String.class), ArgumentMatchers.any(InputStream.class), ArgumentMatchers.any(String.class), ArgumentMatchers.isNull());
+
+ eventsRestService.pushEvents("topicName", iStream, "partitionKey");
+
+ }
+
+ @Test(expected = CambriaApiException.class)
+ public void testPushEvents_AccessDeniedException()
+ throws AccessDeniedException, CambriaApiException, IOException, TopicExistsException, ConfigDbException,
+ missingReqdSetting {
+ doThrow(new AccessDeniedException("error")).when(eventsService).pushEvents(ArgumentMatchers.any(DMaaPContext.class), ArgumentMatchers.any(String.class), ArgumentMatchers.any(InputStream.class), ArgumentMatchers.any(String.class), ArgumentMatchers.isNull());
+
+ eventsRestService.pushEvents("topicName", iStream, "partitionKey");
+
+ }
+
+ @Test(expected = CambriaApiException.class)