kapua icon indicating copy to clipboard operation
kapua copied to clipboard

Problems with translators in kapua-translator-kura-mqtt module

Open ct-anaalbic opened this issue 5 years ago • 0 comments

Describe the bug This issue contains different problems, which are explained bellow.

  1. Translators in kapua-translator-kura-mqtt module (translate() method) are not working correctly. In TranslatorDataMqttKura and TranslatorDataKuraMqtt all topics/channels pass without exception, which is wrong.
  2. In TranslatorDataMqttKura, when user tries to translate MqttMessage into KuraDataMessage, if correct topic is forwarded KuraDataChannel is not valid, and semantic part of KuraDataChannel always is null.
  3. In TranslatorDataKuraJms and TranslatorDataKuraJms all topics/channels are correct, and exception is never thrown.
  4. Specific translators have the same problem as TranslatorDataKuraJms --> Wrong topic is accepted as correct, and exception is not thrown. In TranslatorLifeNotifyJmsKura only jms topic with six parts are correct. In other case, ArrayIndexOutOfBoundsException exception is thrown. But topic, can contains every symbols in that six parts. For example fff.eee.eee.eee.eee.eee topic is correct, which is wrong.

To Reproduce Steps to reproduce the first behavior:

  1. Create MqttMessage or KuraDataMessage with invalid topic / channel
  2. Try to translate it
  3. Exception is not thrown

Steps to reproduce the second behavior:

  1. Create MqttMessage with valid topic (accont/clientId/semanticPart)
  2. Try to translate it into KuraDataMessage
  3. KuraDataChannel has NULL semantic part

Steps to reproduce the third behavior:

  1. Create JmsMessage or KuraDataMessage with invalid topic / channel
  2. Try to translate it
  3. Exception is not thrown

Steps to reproduce the fourth behavior:

  1. Create specific JMS message (Translator{appName}JmsKura) with invalid topic
  2. Try to translate it
  3. Exception is not thrown

Expected behavior --> In first behavior, if user put invalid topic in MqttMessage, or invalid channel in KuraDataMessage, after translation an exception should be thrown.

--> In second behavior, if user put valid topic into MqttMessage, KuraDataChannel should have semantic part.

--> In third behavior, if user put invalid topic in JmsMessage, or invalid channel in KuraDataMessage, after translation an exception should be thrown.

--> In fourth behavior, if user creates specific JmsMessage with invalid topic, after translation an exception should be thrown. Also, if user try to create TranslatorLifeNotifyJmsKura with six parts which are not correct, KapuaException should be thrown.

Screenshots /

Version of Kapua [e.g. 1.0.0]

Type of deployment [ ] Local Vagrant deployment [ ] Docker [ ] Openshift (in its variants) [ ] Others

Main component affected [ ] Console (in case of console please report info on which browser you encountered the problem) [ ] REST API [ ] Message Broker [ ] - Others

Additional context Add any other context about the problem here.

ct-anaalbic avatar Dec 20 '19 15:12 ct-anaalbic