* Split Content-Type header field on semicolon and evaluate all substrings
Signed-off-by: Tony Ward <tony@lucidtron.com>
* included strings library
Signed-off-by: Tony Ward <tony0ward@hotmail.com>
* simplify code, run gofmt
Signed-off-by: tony <tony0ward@hotmail.com>
Signed-off-by: tony <tony@lucidtron.com>
* allow Content-Type to only contain the required type
Signed-off-by: Tony Ward <tony@lucidtron.com>
* Change bootstrap service port to 8200
Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com>
* Fix redis streams tests in things service
Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com>
* Things returns 404 when not found, not 500
Signed-off-by: Vladimir Starcevic <vstarcevic@gmail.com>
* MF-579 Things returns 404 when not found or thingid is in invalid format
Signed-off-by: Vladimir Starcevic <vstarcevic@gmail.com>
* MF-579 Things and channels returns 404 when not found, or ID is malformed not 500
Signed-off-by: Vladimir Starcevic <vstarcevic@gmail.com>
* MF-579 Things & Channels returns 404 when not found or ID is malformed, not 500
Signed-off-by: Vladimir Starcevic <vstarcevic@gmail.com>
* Update docs with new connection endpoints
Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com>
* Fix empty key bug
Return key that was absent from things that are returned in
connections endpoint.
Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com>
* Add list channels by thing id endpoint
Add list channels by thing id endpoint to things service. Add
pagination format and logic.
Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com>
* Add fetch channels by thing endpoint
Add fetch channels by thing endpoint with pagination.
Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com>
* Update list endpoints to contain pagination
Update list endpoints to contain pagination metadata.
Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com>
* Add tests for two new endpoints
Add tests for two new endpoints and update existing ones. Also,
remove connected field from channel response.
Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com>
* Fix tests for SDK
Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com>
* Add SDK methods for new endpoints
Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com>
* Update swagger docs for things service
Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com>
* Add error handling to http tests
Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com>
* Fix response body in http tests
Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com>
* Remove unused responses from things service
Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com>
* Add test cases to things postgres tests
Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com>
* Add test cases for event sourcing
Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com>
* Fix event sourcing client on LoRa adapter
Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com>
* Fix tests for things redis streams
Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com>
* MF-448 - Add option to connect to DB with verify-ca and verify-full
Adds the option to connect with verify-ca and verify-full
Users can now specify any extra certs and keys they may need.
Signed-off-by: MichaelFinley <Michael.Finley@target.com>
* Passing db config struct rather than seperate parameters
Also updated the tests to use the config
Signed-off-by: MichaelFinley <Michael.Finley@target.com>
* Unexporting fields apart of users config
Also added comments to the newly exported Config in things & users postgres/init.go
Signed-off-by: MichaelFinley <Michael.Finley@target.com>
* Update increment ID to UUID in things service
Update increment ID to UUID for things and channels in things
service and proto files. Also, update ID type from uint to string.
Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com>
* Update increment ID to UUID in http adapter
Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com>
* Update increment ID to UUID in ws adapter
Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com>
* Update increment ID to UUID in CoAP adapter
Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com>
* Update increment ID to UUID in normalizer service
Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com>
* Update increment ID to UUID in writer services
Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com>
* Update increment ID to UUID in reader services
Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com>
* Update increment ID to UUID in SDK
Update increment ID to UUID in SDK. Update id type to string.
Update tests.
Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com>
* Update increment ID to UUID in mqtt adapter
Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com>
* Remove unnecessary case from influxdb reader
Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com>
* Update tests in order to increase code coverage
Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com>
* Update lora adapter to use string ID instead of unsigned int
Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com>
* Add metadata field to channels and update things metadata
Add metadata field to channels. Update thing metadata field to be
in JSON format. Update tests..
Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com>
* Add metadata to channel events
Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com>
* Add metadata field to channel in go SDK
Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com>
* Add event sourcing middleware for things service
Add event sourcing for write operations over things and channels.
Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com>
* Add tests for event sourcing middleware
Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com>
* Update things in tests to contain metadata field
Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com>
* Add SKD tests for creating channel
Signed-off-by: Ivan Milošević <iva@blokovi.com>
* Add SDK tests for Channel function
Signed-off-by: Ivan Milošević <iva@blokovi.com>
* Add list channels over SDK tests
Signed-off-by: Ivan Milošević <iva@blokovi.com>
* Add SDK tests for updating channel
Signed-off-by: Ivan Milošević <iva@blokovi.com>
* Add SDK tests for deleting channel
Signed-off-by: Ivan Milošević <iva@blokovi.com>
* Add users service SDK tests
Signed-off-by: Ivan Milošević <iva@blokovi.com>
* SDK things tests
Signed-off-by: Ivan Milošević <iva@blokovi.com>
* Add SDK test for connecting and disconnecting things from channel
Signed-off-by: Ivan Milošević <iva@blokovi.com>
* testing SDK sending messages
Signed-off-by: Ivan Milošević <iva@blokovi.com>
* add tests for SDK func SetContentType
Signed-off-by: Ivan Milošević <iva@blokovi.com>
* add all test cases for sending messages
Signed-off-by: Ivan Milošević <iva@blokovi.com>
* Add handling StatusBadRequest when deleting thing over SDK
Signed-off-by: Ivan Milošević <iva@blokovi.com>
* Update error responses when deleting channel and thing
Signed-off-by: Ivan Milošević <iva@blokovi.com>
* Removed unused Unauthorized response when creating user
Signed-off-by: Ivan Milošević <iva@blokovi.com>
* update testing CreateChannel, tests if response is some string
Signed-off-by: Ivan Milošević <iva@blokovi.com>
* Add bad request case in testing CreateToken
Signed-off-by: Ivan Milošević <iva@blokovi.com>
* Remove response error conflict from things service
Signed-off-by: Ivan Milošević <iva@blokovi.com>
* Fix definition of sdk.ErrFailedDisconnect and return error in test cases for disconnecting things
Signed-off-by: Ivan Milošević <iva@blokovi.com>
* Add handling errors and formatting code
Signed-off-by: Ivan Milošević <iva@blokovi.com>
* Defined new ErrFailedPublish error in SDK
Signed-off-by: Ivan Milošević <iva@blokovi.com>
* Add SDK test for version
Signed-off-by: Ivan Milošević <iva@blokovi.com>
* Delete unused http response status in sdk.DeleteChannel
Signed-off-by: Ivan Milošević <iva@blokovi.com>
* Add TLS flag that will turn TLS on or off
Add TLS flag to things, http, ws and mqtt service.
Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com>
* Update readme files with new env vars
Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com>
* MF-448 - Option for Postgres SSL Mode
Adds an option to choose the ssl mode when connecting to postgres.
Only supporting disable or require for now with verify-ca and verify-full to come after more discussion.
Signed-off-by: Michael Finley <Michael.Finley@target.com>
* Changing package name back
Accidentally changed the package name so reverting that!
Signed-off-by: Michael Finley <Michael.Finley@target.com>
* Adding section in getting-started for securing pgsql connections
Signed-off-by: Michael Finley <Michael.Finley@target.com>
* Refactor Mainflux go SDK
Add structures instead of string parameters. Add offset and limit
parameters to things and channels methods. Add better configuration
support.
Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com>
* Add new public errors with better error handling
Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com>
* Update SDK to use uint instread of string id
Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com>
* Update cli to use new SDK API
Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com>
* Remove TLS termination from nginx configuration
Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com>
* Update SDK documentation and structures
Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com>
* Refactor things service
Decouple HTTP layer from business logic. Remove ID number validation
check. Remove models from HTTP requests and responses.
Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com>
* Reformat tests for things service
Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com>
* Increase test coverage for things service
Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com>
* Add test
Signed-off-by: Ivan Milošević <iva@blokovi.com>
* Add test
Signed-off-by: Ivan Milošević <iva@blokovi.com>
* Add test
Signed-off-by: Ivan Milošević <iva@blokovi.com>
* Add test
Signed-off-by: Ivan Milošević <iva@blokovi.com>
* Add test
Signed-off-by: Ivan Milošević <iva@blokovi.com>
* MF-384 - Add test for Redis cache
Signed-off-by: Ivan Milošević <iva@blokovi.com>
* Add copyright headers
Signed-off-by: Ivan Milošević <iva@blokovi.com>
* Fix copyright header
Signed-off-by: Ivan Milošević <iva@blokovi.com>
* Fix test setup
Signed-off-by: Ivan Milošević <iva@blokovi.com>
* handling errors and put test cases in maps instead of slices
Signed-off-by: Ivan Milošević <iva@blokovi.com>
* Add test case if thing already exists
Signed-off-by: Ivan Milošević <iva@blokovi.com>
* Fix TestThingSave to use require instead of assert
Signed-off-by: Ivan Milošević <iva@blokovi.com>
* Add test case for removing non-existing thing from cache
Signed-off-by: Ivan Milošević <iva@blokovi.com>
* Use table of test cases for Remove and test Connect for every case
Signed-off-by: Ivan Milošević <iva@blokovi.com>
* Use table of test cases for Save
Signed-off-by: Ivan Milošević <iva@blokovi.com>
* Test cases in slice instead of map for testing Remove
Signed-off-by: Ivan Milošević <iva@blokovi.com>
* Make test-cases independent, use asserts instead of requires
Signed-off-by: Ivan Milošević <iva@blokovi.com>
* Use slice and map where appropriate
Signed-off-by: Ivan Milošević <iva@blokovi.com>
* Adding an option to select log level
Signed-off-by: Michael Finley <Michael.Finley@target.com>
* making error default log level
Signed-off-by: Michael Finley <Michael.Finley@target.com>
* removing go-kit/levels and expanding levels wrapper
Signed-off-by: Michael Finley <Michael.Finley@target.com>
* refactoring test cases and using log.fatal
Signed-off-by: Michael Finley <Michael.Finley@target.com>
* logger.new no longer accpets enum and now accepts string for level
Signed-off-by: Michael Finley <Michael.Finley@target.com>
* level_test.go refactor to compare error
Signed-off-by: Michael Finley <Michael.Finley@target.com>
* Updating the ws README
Signed-off-by: Michael Finley <Michael.Finley@target.com>
* Adding log level for mqtt Adapter
Signed-off-by: Michael Finley <Michael.Finley@target.com>
* Add redis caching for thing and channel connections
Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com>
* Fix authorization caching flow
Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com>
* Update things documentation
Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com>
* Fixes#337
Signed-off-by: Jovan Kostovski <chombium@gmail.com>
* added create table if not exists
Signed-off-by: Jovan Kostovski <chombium@gmail.com>
* added test target in sync with Semaphore CI
Signed-off-by: Jovan Kostovski <chombium@gmail.com>
* added warning about the possible data loss
Signed-off-by: Jovan Kostovski <chombium@gmail.com>
* Rename Payload field to Metadata
Rename Payload field of Thing to Metadata.
Signed-off-by: Ivan Milošević <iva@blokovi.com>
* Revert JSON payload rename in docs
Signed-off-by: Ivan Milošević <iva@blokovi.com>
* Update WS tests
Signed-off-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com>
* Use require in all writer tests
Refactor code.
Signed-off-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com>
* Ignore Mainflux generated pb.go files
Ignore *.pb.go files generated by Mainflux, but don't ignore vendored generated code.
Signed-off-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com>
* Return an exported ErrNotFound instead of the unexported one
Signed-off-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com>
* Update mocks to match the actual behaviour
Signed-off-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com>
* Update mocks error message
Signed-off-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com>
* Add auth service unavailable error test
Since this error is caused by gRPC server returning codes.Internal,
this behaviour is simulated using specific token. When that token is
passed as an auth header, the mock gRPC client returns aforementioned error.
Signed-off-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com>
* Use require package for postgres tests
Signed-off-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com>
* Remove redundant error checks in tests
Refactor tests.
Signed-off-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com>
* Rename error flag token
Signed-off-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com>