import org.mockito.Mock;\r
import org.mockito.Mockito;\r
import org.mockito.MockitoAnnotations;\r
-import static org.mockito.Mockito.when;\r
+import static org.mockito.Matchers.any;\r
import org.powermock.core.classloader.annotations.PrepareForTest;\r
import org.powermock.modules.junit4.PowerMockRunner;\r
import org.powermock.api.mockito.PowerMockito;\r
+import static org.mockito.Mockito.when;\r
\r
import com.att.ajsc.beans.PropertiesMapBean;\r
-import com.att.nsa.cambria.CambriaApiException;\r
-import com.att.nsa.cambria.backends.ConsumerFactory.UnavailableException;\r
-import com.att.nsa.cambria.exception.DMaaPErrorMessages;\r
-import com.att.nsa.cambria.service.EventsService;\r
+import com.att.dmf.mr.CambriaApiException;\r
+import com.att.dmf.mr.backends.ConsumerFactory.UnavailableException;\r
+import com.att.dmf.mr.exception.DMaaPErrorMessages;\r
+import com.att.dmf.mr.service.EventsService;\r
import com.att.nsa.configs.ConfigDbException;\r
-import com.att.nsa.cambria.utils.Utils;\r
+import com.att.dmf.mr.utils.Utils;\r
import com.att.nsa.drumlin.till.nv.rrNvReadable.missingReqdSetting;\r
import com.att.nsa.security.ReadWriteSecuredResource.AccessDeniedException;\r
\r
import javax.servlet.ServletOutputStream;\r
import javax.servlet.http.HttpServletRequest;\r
\r
-import com.att.nsa.cambria.beans.DMaaPContext;\r
-import com.att.nsa.cambria.exception.DMaaPAccessDeniedException;\r
-import com.att.nsa.cambria.exception.ErrorResponse;\r
-import com.att.nsa.cambria.metabroker.Broker.TopicExistsException;\r
+import com.att.dmf.mr.beans.DMaaPContext;\r
+import com.att.dmf.mr.exception.DMaaPAccessDeniedException;\r
+import com.att.dmf.mr.exception.ErrorResponse;\r
+import com.att.dmf.mr.metabroker.Broker.TopicExistsException;\r
\r
@RunWith(PowerMockRunner.class)\r
@PrepareForTest({ PropertiesMapBean.class })\r
public void testGetEvents_error() {\r
\r
try {\r
- PowerMockito.doThrow(new IOException()).when(eventsService).getEvents(dmaapContext, "topicName",\r
- "consumergroup", "consumerid");\r
+ PowerMockito.doThrow(new IOException()).when(eventsService).getEvents(any(), any(),\r
+ any(), any());\r
} catch (TopicExistsException | DMaaPAccessDeniedException | AccessDeniedException | ConfigDbException\r
| UnavailableException | IOException excp) {\r
assertTrue(false);\r
}\r
\r
try {\r
- PowerMockito.doThrow(new AccessDeniedException()).when(eventsService).getEvents(dmaapContext, "topicName",\r
- "consumergroup", "consumerid");\r
+ PowerMockito.doThrow(new AccessDeniedException()).when(eventsService).getEvents(any(), any(),\r
+ any(), any());\r
} catch (TopicExistsException | DMaaPAccessDeniedException | AccessDeniedException | ConfigDbException\r
| UnavailableException | IOException excp) {\r
assertTrue(false);\r
}\r
\r
try {\r
- PowerMockito.doThrow(new TopicExistsException("error")).when(eventsService).getEvents(dmaapContext,\r
- "topicName", "consumergroup", "consumerid");\r
+ PowerMockito.doThrow(new TopicExistsException("error")).when(eventsService).getEvents(any(),\r
+ any(), any(), any());\r
} catch (TopicExistsException | DMaaPAccessDeniedException | AccessDeniedException | ConfigDbException\r
| UnavailableException | IOException excp) {\r
assertTrue(false);\r
public void testGetEvents_TopicExistException() throws CambriaApiException, ConfigDbException, TopicExistsException,\r
UnavailableException, IOException, AccessDeniedException {\r
\r
- Mockito.doThrow(new TopicExistsException("topic exists")).when(eventsService).getEvents(dmaapContext,\r
- "topicName", "consumergroup", "consumerid");\r
+ Mockito.doThrow(new TopicExistsException("topic exists")).when(eventsService).getEvents(any(),\r
+ any(), any(), any());\r
\r
eventsService.getEvents(dmaapContext, "topicName", "consumergroup", "consumerid");\r
\r
public void testGetEvents_DMaaPAccessDeniedException() throws CambriaApiException, ConfigDbException,\r
TopicExistsException, UnavailableException, IOException, AccessDeniedException {\r
\r
- Mockito.doThrow(new DMaaPAccessDeniedException(errorResponse)).when(eventsService).getEvents(dmaapContext,\r
- "topicName", "consumergroup", "consumerid");\r
+ Mockito.doThrow(new DMaaPAccessDeniedException(errorResponse)).when(eventsService).getEvents(any(),\r
+ any(), any(), any());\r
\r
eventsService.getEvents(dmaapContext, "topicName", "consumergroup", "consumerid");\r
\r
public void testPushEvents_error() {\r
\r
try {\r
- PowerMockito.doThrow(new IOException()).when(eventsService).pushEvents(dmaapContext, "topicName", iStream,\r
- "partitionKey", null);\r
+ PowerMockito.doThrow(new IOException()).when(eventsService).pushEvents(any(), any(), any(),\r
+ any(), any());\r
} catch (TopicExistsException | DMaaPAccessDeniedException | AccessDeniedException | ConfigDbException\r
| missingReqdSetting | IOException excp) {\r
assertTrue(false);\r
}\r
\r
try {\r
- PowerMockito.doThrow(new AccessDeniedException()).when(eventsService).pushEvents(dmaapContext, "topicName",\r
- iStream, "partitionKey", null);\r
+ PowerMockito.doThrow(new AccessDeniedException()).when(eventsService).pushEvents(any(), any(),\r
+ any(), any(), any());\r
} catch (TopicExistsException | DMaaPAccessDeniedException | AccessDeniedException | ConfigDbException\r
| missingReqdSetting | IOException excp) {\r
assertTrue(false);\r
}\r
\r
try {\r
- PowerMockito.doThrow(new TopicExistsException("error")).when(eventsService).pushEvents(dmaapContext,\r
- "topicName", iStream, "partitionKey", null);\r
+ PowerMockito.doThrow(new TopicExistsException("error")).when(eventsService).pushEvents(any(),\r
+ any(), any(), any(), any());\r
} catch (TopicExistsException | DMaaPAccessDeniedException | AccessDeniedException | ConfigDbException\r
| missingReqdSetting | IOException excp) {\r
assertTrue(false);\r
ServletInputStream stream = request.getInputStream();\r
\r
try {\r
- PowerMockito.doThrow(new TopicExistsException("error")).when(eventsService).pushEvents(dmaapContext,\r
- "topicName", stream, "partitionKey", Utils.getFormattedDate(new Date()));\r
+ PowerMockito.doThrow(new TopicExistsException("error")).when(eventsService).pushEvents(any(),\r
+ any(), any(), any(), any());\r
} catch (TopicExistsException | DMaaPAccessDeniedException | AccessDeniedException | ConfigDbException\r
| missingReqdSetting | IOException excp) {\r
assertTrue(false);\r
}\r
\r
try {\r
- PowerMockito.doThrow(new AccessDeniedException()).when(eventsService).pushEvents(dmaapContext, "topicName",\r
- stream, "partitionKey", Utils.getFormattedDate(new Date()));\r
+ PowerMockito.doThrow(new AccessDeniedException()).when(eventsService).pushEvents(any(),any(),\r
+ any(), any(), any());\r
} catch (TopicExistsException | DMaaPAccessDeniedException | AccessDeniedException | ConfigDbException\r
| missingReqdSetting | IOException excp) {\r
assertTrue(false);\r
}\r
\r
try {\r
- PowerMockito.doThrow(new IOException()).when(eventsService).pushEvents(dmaapContext, "topicName", stream,\r
- "partitionKey", Utils.getFormattedDate(new Date()));\r
+ PowerMockito.doThrow(new IOException()).when(eventsService).pushEvents(any(), any(), any(),\r
+ any(), any());\r
} catch (TopicExistsException | DMaaPAccessDeniedException | AccessDeniedException | ConfigDbException\r
| missingReqdSetting | IOException excp) {\r
assertTrue(false);\r