Commit 40e5c64451344f256e3289d61c4ca1306043f9c2

Authored by volodymyr-babak
1 parent 5f228350

Fixed mapping for combo-boxes with multiple=false

Showing 11 changed files with 60 additions and 74 deletions
... ... @@ -37,7 +37,7 @@ public class RabbitMqPluginAction extends AbstractTemplatePluginAction<RabbitMqP
37 37 builder.sync(configuration.isSync());
38 38 builder.exchange(configuration.getExchange());
39 39 builder.queueName(configuration.getQueueName());
40   - builder.messageProperties(configuration.getMessageProperties()[0]);
  40 + builder.messageProperties(configuration.getMessageProperties());
41 41 builder.msgType(payload.getMsgType());
42 42 builder.requestId(payload.getRequestId());
43 43 builder.payload(getMsgBody(ctx, msg));
... ...
... ... @@ -27,6 +27,6 @@ public class RabbitMqPluginActionConfiguration implements TemplateActionConfigur
27 27 private boolean sync;
28 28 private String exchange;
29 29 private String queueName;
30   - private String[] messageProperties;
  30 + private String messageProperties;
31 31 private String template;
32 32 }
... ...
... ... @@ -18,35 +18,7 @@
18 18 },
19 19 "messageProperties": {
20 20 "title": "Message properties",
21   - "type": "array",
22   - "minItems" : 1,
23   - "items": [
24   - {
25   - "value": "BASIC",
26   - "label": "BASIC"
27   - },
28   - {
29   - "value": "MINIMAL_BASIC",
30   - "label": "MINIMAL_BASIC"
31   - },
32   - {
33   - "value": "MINIMAL_PERSISTENT_BASIC",
34   - "label": "MINIMAL_PERSISTENT_BASIC"
35   - },
36   - {
37   - "value": "PERSISTENT_BASIC",
38   - "label": "PERSISTENT_BASIC"
39   - },
40   - {
41   - "value": "PERSISTENT_TEXT_PLAIN",
42   - "label": "PERSISTENT_TEXT_PLAIN"
43   - },
44   - {
45   - "value": "TEXT_PLAIN",
46   - "label": "TEXT_PLAIN"
47   - }
48   - ],
49   - "uniqueItems": true
  21 + "type": "string"
50 22 },
51 23 "template": {
52 24 "title": "Body Template",
... ... @@ -67,8 +39,35 @@
67 39 {
68 40 "key": "messageProperties",
69 41 "type": "rc-select",
70   - "multiple": false
  42 + "multiple": false,
  43 + "items": [
  44 + {
  45 + "value": "BASIC",
  46 + "label": "BASIC"
  47 + },
  48 + {
  49 + "value": "MINIMAL_BASIC",
  50 + "label": "MINIMAL_BASIC"
  51 + },
  52 + {
  53 + "value": "MINIMAL_PERSISTENT_BASIC",
  54 + "label": "MINIMAL_PERSISTENT_BASIC"
  55 + },
  56 + {
  57 + "value": "PERSISTENT_BASIC",
  58 + "label": "PERSISTENT_BASIC"
  59 + },
  60 + {
  61 + "value": "PERSISTENT_TEXT_PLAIN",
  62 + "label": "PERSISTENT_TEXT_PLAIN"
  63 + },
  64 + {
  65 + "value": "TEXT_PLAIN",
  66 + "label": "TEXT_PLAIN"
  67 + }
  68 + ]
71 69 },
  70 +
72 71 {
73 72 "key": "template",
74 73 "type": "textarea",
... ...
extensions/extension-rabbitmq/src/test/java/org/thingsboard/server/extensions/rabbitmq/RabbitMqDemoClient.java renamed from extensions/extension-rabbitmq/src/test/java/org/thingsboard/server/extensions/rabbitmq/DemoClient.java
... ... @@ -22,7 +22,7 @@ import java.io.IOException;
22 22 /**
23 23 * @author Andrew Shvayka
24 24 */
25   -public class DemoClient {
  25 +public class RabbitMqDemoClient {
26 26
27 27 private static final String HOST = "localhost";
28 28 private static final String USERNAME = "guest";
... ...
... ... @@ -16,23 +16,14 @@
16 16 package org.thingsboard.server.extensions.rest.action;
17 17
18 18 import lombok.extern.slf4j.Slf4j;
19   -import org.apache.velocity.Template;
20   -import org.apache.velocity.VelocityContext;
21   -import org.apache.velocity.runtime.parser.ParseException;
22 19 import org.springframework.http.HttpMethod;
23 20 import org.springframework.http.HttpStatus;
24 21 import org.thingsboard.server.common.msg.device.ToDeviceActorMsg;
25 22 import org.thingsboard.server.common.msg.session.FromDeviceRequestMsg;
26   -import org.thingsboard.server.common.msg.session.ToDeviceMsg;
27 23 import org.thingsboard.server.extensions.api.component.Action;
28   -import org.thingsboard.server.extensions.api.plugins.PluginAction;
29   -import org.thingsboard.server.extensions.api.plugins.msg.PluginToRuleMsg;
30   -import org.thingsboard.server.extensions.api.plugins.msg.ResponsePluginToRuleMsg;
31 24 import org.thingsboard.server.extensions.api.plugins.msg.RuleToPluginMsg;
32 25 import org.thingsboard.server.extensions.api.rules.RuleContext;
33   -import org.thingsboard.server.extensions.api.rules.RuleProcessingMetaData;
34 26 import org.thingsboard.server.extensions.core.action.template.AbstractTemplatePluginAction;
35   -import org.thingsboard.server.extensions.core.utils.VelocityUtils;
36 27
37 28 import java.util.Optional;
38 29
... ... @@ -48,7 +39,7 @@ public class RestApiCallPluginAction extends AbstractTemplatePluginAction<RestAp
48 39 builder.requestId(payload.getRequestId());
49 40 builder.sync(configuration.isSync());
50 41 builder.actionPath(configuration.getActionPath());
51   - builder.httpMethod(HttpMethod.valueOf(configuration.getRequestMethod()[0]));
  42 + builder.httpMethod(HttpMethod.valueOf(configuration.getRequestMethod()));
52 43 builder.expectedResultCode(HttpStatus.valueOf(configuration.getExpectedResultCode()));
53 44 builder.msgBody(getMsgBody(ctx, msg));
54 45 return Optional.of(new RestApiCallActionMsg(msg.getTenantId(),
... ...
... ... @@ -24,5 +24,5 @@ public class RestApiCallPluginActionConfiguration implements TemplateActionConfi
24 24 private String template;
25 25 private String actionPath;
26 26 private int expectedResultCode;
27   - private String[] requestMethod;
  27 + private String requestMethod;
28 28 }
... ...
... ... @@ -47,7 +47,7 @@ public class RestApiCallPlugin extends AbstractPlugin<RestApiCallPluginConfigura
47 47 configuration.getPort(),
48 48 configuration.getBasePath());
49 49
50   - if (configuration.getAuthMethod()[0].equals(BASIC_AUTH_METHOD)) {
  50 + if (configuration.getAuthMethod().equals(BASIC_AUTH_METHOD)) {
51 51 String userName = configuration.getUserName();
52 52 String password = configuration.getPassword();
53 53 String credentials = String.format(CREDENTIALS_TEMPLATE, userName, password);
... ...
... ... @@ -23,7 +23,7 @@ public class RestApiCallPluginConfiguration {
23 23 private int port;
24 24 private String basePath;
25 25
26   - private String[] authMethod;
  26 + private String authMethod;
27 27
28 28 private String userName;
29 29 private String password;
... ...
... ... @@ -18,19 +18,7 @@
18 18 },
19 19 "requestMethod": {
20 20 "title": "Request method",
21   - "type": "array",
22   - "minItems" : 1,
23   - "items": [
24   - {
25   - "value": "POST",
26   - "label": "POST"
27   - },
28   - {
29   - "value": "PUT",
30   - "label": "PUT"
31   - }
32   - ],
33   - "uniqueItems": true
  21 + "type": "string"
34 22 },
35 23 "expectedResultCode": {
36 24 "title": "Expected Result Code",
... ... @@ -56,7 +44,17 @@
56 44 {
57 45 "key": "requestMethod",
58 46 "type": "rc-select",
59   - "multiple": false
  47 + "multiple": false,
  48 + "items": [
  49 + {
  50 + "value": "POST",
  51 + "label": "POST"
  52 + },
  53 + {
  54 + "value": "PUT",
  55 + "label": "PUT"
  56 + }
  57 + ]
60 58 },
61 59 "expectedResultCode"
62 60 ]
... ...
... ... @@ -21,19 +21,7 @@
21 21 },
22 22 "authMethod": {
23 23 "title": "Authentication method",
24   - "type": "array",
25   - "minItems" : 1,
26   - "items": [
27   - {
28   - "value": "NO_AUTH",
29   - "label": "No authentication"
30   - },
31   - {
32   - "value": "BASIC_AUTH",
33   - "label": "Basic authentication"
34   - }
35   - ],
36   - "uniqueItems": true
  24 + "type": "string"
37 25 },
38 26 "userName": {
39 27 "title": "Username",
... ... @@ -58,7 +46,17 @@
58 46 {
59 47 "key": "authMethod",
60 48 "type": "rc-select",
61   - "multiple": false
  49 + "multiple": false,
  50 + "items": [
  51 + {
  52 + "value": "NO_AUTH",
  53 + "label": "No authentication"
  54 + },
  55 + {
  56 + "value": "BASIC_AUTH",
  57 + "label": "Basic authentication"
  58 + }
  59 + ]
62 60 },
63 61 "userName",
64 62 {
... ...
extensions/extension-rest-api-call/src/test/java/org/thingsboard/server/extensions/rest/RestApiCallDemoClient.java renamed from extensions/extension-rest-api-call/src/test/java/org/thingsboard/server/extensions/kafka/RestApiCallDemoClient.java