Merge pull request #11702 from volodymyr-babak/http-node-upgrade
TbRestApiCallNode - added upgrade step to add maxInMemoryBufferSizeInKb config
This commit is contained in:
		
						commit
						16495e659c
					
				@ -35,7 +35,7 @@ import java.util.List;
 | 
			
		||||
        type = ComponentType.EXTERNAL,
 | 
			
		||||
        name = "rest api call",
 | 
			
		||||
        configClazz = TbRestApiCallNodeConfiguration.class,
 | 
			
		||||
        version = 2,
 | 
			
		||||
        version = 3,
 | 
			
		||||
        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. " +
 | 
			
		||||
                "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 {
 | 
			
		||||
 | 
			
		||||
    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";
 | 
			
		||||
    protected TbHttpClient httpClient;
 | 
			
		||||
 | 
			
		||||
@ -92,6 +93,11 @@ public class TbRestApiCallNode extends TbAbstractExternalNode {
 | 
			
		||||
                    hasChanges = true;
 | 
			
		||||
                    ((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;
 | 
			
		||||
            default:
 | 
			
		||||
                break;
 | 
			
		||||
 | 
			
		||||
@ -233,7 +233,8 @@ public class TbRestApiCallNodeTest extends AbstractRuleNodeUpgradeTest {
 | 
			
		||||
                                "\"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\"}}"),
 | 
			
		||||
                                "\"credentials\": {\"type\": \"anonymous\"}," +
 | 
			
		||||
                                "\"maxInMemoryBufferSizeInKb\": 256}"),
 | 
			
		||||
                // config for version 2 with upgrade from version 1
 | 
			
		||||
                Arguments.of(1,
 | 
			
		||||
                        "{\"restEndpointUrlPattern\":\"http://localhost/api\",\"requestMethod\": \"POST\"," +
 | 
			
		||||
@ -249,7 +250,24 @@ public class TbRestApiCallNodeTest extends AbstractRuleNodeUpgradeTest {
 | 
			
		||||
                                "\"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\"}}")
 | 
			
		||||
                                "\"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