X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=dmaap-mediator-producer%2Finternal%2Fconfig%2Fregistrator_test.go;h=2cffa2c3a6a6c3df05cf2957104f0855e77972f9;hb=f1cee0f81c6bc482f73182c8f4c903e8376381e8;hp=353e9de8678b7bdb23cb81d65ec3491e39a456fa;hpb=47d0ee37691eddc290a1f9e34091dfd2020db07f;p=nonrtric.git diff --git a/dmaap-mediator-producer/internal/config/registrator_test.go b/dmaap-mediator-producer/internal/config/registrator_test.go index 353e9de8..2cffa2c3 100644 --- a/dmaap-mediator-producer/internal/config/registrator_test.go +++ b/dmaap-mediator-producer/internal/config/registrator_test.go @@ -27,28 +27,24 @@ import ( "github.com/stretchr/testify/mock" "github.com/stretchr/testify/require" - "oransc.org/nonrtric/dmaapmediatorproducer/internal/jobs" - "oransc.org/nonrtric/dmaapmediatorproducer/internal/restclient" - "oransc.org/nonrtric/dmaapmediatorproducer/mocks" + "oransc.org/nonrtric/dmaapmediatorproducer/mocks/httpclient" ) func TestRegisterTypes(t *testing.T) { assertions := require.New(t) - clientMock := mocks.HTTPClient{} + clientMock := httpclient.HTTPClient{} clientMock.On("Do", mock.Anything).Return(&http.Response{ StatusCode: http.StatusCreated, }, nil) - restclient.Client = &clientMock - - type1 := jobs.TypeData{ - TypeId: "Type1", + type1 := TypeDefinition{ + Id: "Type1", } - types := []jobs.TypeData{type1} + types := []TypeDefinition{type1} - r := NewRegistratorImpl("http://localhost:9990") + r := NewRegistratorImpl("http://localhost:9990", &clientMock) err := r.RegisterTypes(types) assertions.Nil(err) @@ -71,21 +67,19 @@ func TestRegisterTypes(t *testing.T) { func TestRegisterProducer(t *testing.T) { assertions := require.New(t) - clientMock := mocks.HTTPClient{} + clientMock := httpclient.HTTPClient{} clientMock.On("Do", mock.Anything).Return(&http.Response{ StatusCode: http.StatusCreated, }, nil) - restclient.Client = &clientMock - producer := ProducerRegistrationInfo{ InfoProducerSupervisionCallbackUrl: "supervisionCallbackUrl", SupportedInfoTypes: []string{"type1"}, InfoJobCallbackUrl: "jobCallbackUrl", } - r := NewRegistratorImpl("http://localhost:9990") + r := NewRegistratorImpl("http://localhost:9990", &clientMock) err := r.RegisterProducer("Producer1", &producer) assertions.Nil(err)