TbRestApiCallNode - added upgrade step to add maxInMemoryBufferSizeInKb config
This commit is contained in:
		
							parent
							
								
									fb54dbc858
								
							
						
					
					
						commit
						a9ae6922a6
					
				@ -35,7 +35,7 @@ import java.util.List;
 | 
				
			|||||||
        type = ComponentType.EXTERNAL,
 | 
					        type = ComponentType.EXTERNAL,
 | 
				
			||||||
        name = "rest api call",
 | 
					        name = "rest api call",
 | 
				
			||||||
        configClazz = TbRestApiCallNodeConfiguration.class,
 | 
					        configClazz = TbRestApiCallNodeConfiguration.class,
 | 
				
			||||||
        version = 2,
 | 
					        version = 3,
 | 
				
			||||||
        nodeDescription = "Invoke REST API calls to external REST server",
 | 
					        nodeDescription = "Invoke REST API calls to external REST server",
 | 
				
			||||||
        nodeDetails = "Will invoke REST API call <code>GET | POST | PUT | DELETE</code> to external REST server. " +
 | 
					        nodeDetails = "Will invoke REST API call <code>GET | POST | PUT | DELETE</code> to external REST server. " +
 | 
				
			||||||
                "Message payload added into Request body. Configured attributes can be added into Headers from Message Metadata." +
 | 
					                "Message payload added into Request body. Configured attributes can be added into Headers from Message Metadata." +
 | 
				
			||||||
@ -52,6 +52,7 @@ import java.util.List;
 | 
				
			|||||||
public class TbRestApiCallNode extends TbAbstractExternalNode {
 | 
					public class TbRestApiCallNode extends TbAbstractExternalNode {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    static final String PARSE_TO_PLAIN_TEXT = "parseToPlainText";
 | 
					    static final String PARSE_TO_PLAIN_TEXT = "parseToPlainText";
 | 
				
			||||||
 | 
					    static final String MAX_IN_MEMORY_BUFFER_SIZE_IN_KB = "maxInMemoryBufferSizeInKb";
 | 
				
			||||||
    static final String TRIM_DOUBLE_QUOTES = "trimDoubleQuotes";
 | 
					    static final String TRIM_DOUBLE_QUOTES = "trimDoubleQuotes";
 | 
				
			||||||
    protected TbHttpClient httpClient;
 | 
					    protected TbHttpClient httpClient;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -92,6 +93,11 @@ public class TbRestApiCallNode extends TbAbstractExternalNode {
 | 
				
			|||||||
                    hasChanges = true;
 | 
					                    hasChanges = true;
 | 
				
			||||||
                    ((ObjectNode) oldConfiguration).remove(List.of("useRedisQueueForMsgPersistence", "trimQueue", "maxQueueSize"));
 | 
					                    ((ObjectNode) oldConfiguration).remove(List.of("useRedisQueueForMsgPersistence", "trimQueue", "maxQueueSize"));
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
 | 
					            case 2:
 | 
				
			||||||
 | 
					                if (!oldConfiguration.has(MAX_IN_MEMORY_BUFFER_SIZE_IN_KB)) {
 | 
				
			||||||
 | 
					                    hasChanges = true;
 | 
				
			||||||
 | 
					                    ((ObjectNode) oldConfiguration).put(MAX_IN_MEMORY_BUFFER_SIZE_IN_KB, 256);
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
                break;
 | 
					                break;
 | 
				
			||||||
            default:
 | 
					            default:
 | 
				
			||||||
                break;
 | 
					                break;
 | 
				
			||||||
 | 
				
			|||||||
@ -233,7 +233,8 @@ public class TbRestApiCallNodeTest extends AbstractRuleNodeUpgradeTest {
 | 
				
			|||||||
                                "\"enableProxy\": false,\"useSystemProxyProperties\": false,\"proxyScheme\": null,\"proxyHost\": null," +
 | 
					                                "\"enableProxy\": false,\"useSystemProxyProperties\": false,\"proxyScheme\": null,\"proxyHost\": null," +
 | 
				
			||||||
                                "\"proxyPort\": 0,\"proxyUser\": null,\"proxyPassword\": null,\"readTimeoutMs\": 0," +
 | 
					                                "\"proxyPort\": 0,\"proxyUser\": null,\"proxyPassword\": null,\"readTimeoutMs\": 0," +
 | 
				
			||||||
                                "\"maxParallelRequestsCount\": 0,\"headers\": {\"Content-Type\": \"application/json\"}," +
 | 
					                                "\"maxParallelRequestsCount\": 0,\"headers\": {\"Content-Type\": \"application/json\"}," +
 | 
				
			||||||
                                "\"credentials\": {\"type\": \"anonymous\"}}"),
 | 
					                                "\"credentials\": {\"type\": \"anonymous\"}," +
 | 
				
			||||||
 | 
					                                "\"maxInMemoryBufferSizeInKb\": 256}"),
 | 
				
			||||||
                // config for version 2 with upgrade from version 1
 | 
					                // config for version 2 with upgrade from version 1
 | 
				
			||||||
                Arguments.of(1,
 | 
					                Arguments.of(1,
 | 
				
			||||||
                        "{\"restEndpointUrlPattern\":\"http://localhost/api\",\"requestMethod\": \"POST\"," +
 | 
					                        "{\"restEndpointUrlPattern\":\"http://localhost/api\",\"requestMethod\": \"POST\"," +
 | 
				
			||||||
@ -249,7 +250,24 @@ public class TbRestApiCallNodeTest extends AbstractRuleNodeUpgradeTest {
 | 
				
			|||||||
                                "\"enableProxy\": false,\"useSystemProxyProperties\": false,\"proxyScheme\": null,\"proxyHost\": null," +
 | 
					                                "\"enableProxy\": false,\"useSystemProxyProperties\": false,\"proxyScheme\": null,\"proxyHost\": null," +
 | 
				
			||||||
                                "\"proxyPort\": 0,\"proxyUser\": null,\"proxyPassword\": null,\"readTimeoutMs\": 0," +
 | 
					                                "\"proxyPort\": 0,\"proxyUser\": null,\"proxyPassword\": null,\"readTimeoutMs\": 0," +
 | 
				
			||||||
                                "\"maxParallelRequestsCount\": 0,\"headers\": {\"Content-Type\": \"application/json\"}," +
 | 
					                                "\"maxParallelRequestsCount\": 0,\"headers\": {\"Content-Type\": \"application/json\"}," +
 | 
				
			||||||
                                "\"credentials\": {\"type\": \"anonymous\"}}")
 | 
					                                "\"credentials\": {\"type\": \"anonymous\"}," +
 | 
				
			||||||
 | 
					                                "\"maxInMemoryBufferSizeInKb\": 256}"),
 | 
				
			||||||
 | 
					                // config for version 3 with upgrade from version 2
 | 
				
			||||||
 | 
					                Arguments.of(2,
 | 
				
			||||||
 | 
					                        "{\"restEndpointUrlPattern\":\"http://localhost/api\",\"requestMethod\": \"POST\"," +
 | 
				
			||||||
 | 
					                                "\"useSimpleClientHttpFactory\": false,\"parseToPlainText\": false,\"ignoreRequestBody\": false," +
 | 
				
			||||||
 | 
					                                "\"enableProxy\": false,\"useSystemProxyProperties\": false,\"proxyScheme\": null,\"proxyHost\": null," +
 | 
				
			||||||
 | 
					                                "\"proxyPort\": 0,\"proxyUser\": null,\"proxyPassword\": null,\"readTimeoutMs\": 0," +
 | 
				
			||||||
 | 
					                                "\"maxParallelRequestsCount\": 0,\"headers\": {\"Content-Type\": \"application/json\"}," +
 | 
				
			||||||
 | 
					                                "\"credentials\": {\"type\": \"anonymous\"}}",
 | 
				
			||||||
 | 
					                        true,
 | 
				
			||||||
 | 
					                        "{\"restEndpointUrlPattern\":\"http://localhost/api\",\"requestMethod\": \"POST\"," +
 | 
				
			||||||
 | 
					                                "\"useSimpleClientHttpFactory\": false,\"parseToPlainText\": false,\"ignoreRequestBody\": false," +
 | 
				
			||||||
 | 
					                                "\"enableProxy\": false,\"useSystemProxyProperties\": false,\"proxyScheme\": null,\"proxyHost\": null," +
 | 
				
			||||||
 | 
					                                "\"proxyPort\": 0,\"proxyUser\": null,\"proxyPassword\": null,\"readTimeoutMs\": 0," +
 | 
				
			||||||
 | 
					                                "\"maxParallelRequestsCount\": 0,\"headers\": {\"Content-Type\": \"application/json\"}," +
 | 
				
			||||||
 | 
					                                "\"credentials\": {\"type\": \"anonymous\"}," +
 | 
				
			||||||
 | 
					                                "\"maxInMemoryBufferSizeInKb\": 256}")
 | 
				
			||||||
        );
 | 
					        );
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user