Issue-ID: NONRTRIC-612
Signed-off-by: elinuxhenrik <henrik.b.andersson@est.tech>
Change-Id: Ib94010a9be3a6b2e85f6627cb19265177725f9dc
func TestPollAndDistributeMessages(t *testing.T) {
assertions := require.New(t)
func TestPollAndDistributeMessages(t *testing.T) {
assertions := require.New(t)
messages := `[{"message": {"data": "data"}}]`
pollClientMock := NewTestClient(func(req *http.Request) *http.Response {
if req.URL.String() == "http://mrAddr/topicUrl" {
messages := `[{"message": {"data": "data"}}]`
pollClientMock := NewTestClient(func(req *http.Request) *http.Response {
if req.URL.String() == "http://mrAddr/topicUrl" {
handlerUnderTest := NewJobHandlerImpl("", pollClientMock, distributeClientMock)
handlerUnderTest := NewJobHandlerImpl("", pollClientMock, distributeClientMock)
jobInfo := JobInfo{
InfoTypeIdentity: "type1",
InfoJobIdentity: "job1",
jobInfo := JobInfo{
InfoTypeIdentity: "type1",
InfoJobIdentity: "job1",
handlerUnderTest.clearAll()
})
handlerUnderTest.clearAll()
})
wg.Add(2) // Two calls should be made to the server, one to poll and one to distribute
handlerUnderTest.pollAndDistributeMessages("http://mrAddr")
wg.Add(2) // Two calls should be made to the server, one to poll and one to distribute
handlerUnderTest.pollAndDistributeMessages("http://mrAddr")