From 8a484e0e67ad36c4d31644a7fc75e63d20c3c120 Mon Sep 17 00:00:00 2001 From: clauguinovart <101648582+clauguinovart@users.noreply.github.com> Date: Mon, 18 Mar 2024 07:00:32 -0700 Subject: [PATCH] Release 2.3 (#61) --- pom.xml | 2 +- .../correlation/CorrelationProxyControl.java | 44 +- .../CorrelationProxyControlGui.java | 19 +- .../core/automatic/CorrelationHistory.java | 219 ++++- .../core/automatic/FileManagementUtils.java | 49 +- .../core/automatic/JMeterElementUtils.java | 69 +- .../core/automatic/ReplayWorker.java | 16 + .../correlation/gui/RulesContainer.java | 22 + .../automatic/CorrelationHistoryFrame.java | 396 ++++++++ .../CorrelationSuggestionsPanel.java | 7 +- .../gui/automatic/CorrelationWizard.java | 26 +- .../jmeter/correlation/TestUtils.java | 7 +- .../automatic/CorrelationHistoryBaseTest.java | 60 ++ .../automatic/CorrelationHistoryTest.java | 215 +++++ .../automatic/JMeterElementUtilsTest.java | 82 +- .../core/automatic/NonGuiFilesExtractor.java | 115 +++ .../method/ComparisonMethodTest.java | 2 +- .../CorrelationTemplateDependencyTest.java | 96 ++ .../CorrelationTemplateVersionsTest.java | 72 ++ ...emplatesRepositoriesConfigurationTest.java | 226 +++++ ...nTemplatesRepositoryConfigurationTest.java | 41 + .../CorrelationTemplatesRepositoryTest.java | 129 +++ .../templates/LocalConfigurationTest.java | 873 ++++++++++-------- ...LocalCorrelationTemplatesRegistryTest.java | 64 +- .../core/templates/ProtocolTest.java | 52 ++ ...tionTemplatesRepositoriesRegistryTest.java | 49 +- .../core/templates/RepositoryTest.java | 17 + .../core/templates/TemplateTest.java | 609 ++++++++++++ .../TemplateVersionKeyDeserializerTest.java | 22 + .../core/templates/WiredBaseTest.java | 90 ++ .../automatic/CorrelationHistoryFrameIT.java | 100 ++ .../gui/templates/TemplateSaveFrameIT.java | 8 +- src/test/resources/history-test.json | 22 + 33 files changed, 3267 insertions(+), 553 deletions(-) create mode 100644 src/main/java/com/blazemeter/jmeter/correlation/gui/automatic/CorrelationHistoryFrame.java create mode 100644 src/test/java/com/blazemeter/jmeter/correlation/core/automatic/CorrelationHistoryBaseTest.java create mode 100644 src/test/java/com/blazemeter/jmeter/correlation/core/automatic/CorrelationHistoryTest.java create mode 100644 src/test/java/com/blazemeter/jmeter/correlation/core/automatic/NonGuiFilesExtractor.java create mode 100644 src/test/java/com/blazemeter/jmeter/correlation/core/templates/CorrelationTemplateDependencyTest.java create mode 100644 src/test/java/com/blazemeter/jmeter/correlation/core/templates/CorrelationTemplateVersionsTest.java create mode 100644 src/test/java/com/blazemeter/jmeter/correlation/core/templates/CorrelationTemplatesRepositoriesConfigurationTest.java create mode 100644 src/test/java/com/blazemeter/jmeter/correlation/core/templates/CorrelationTemplatesRepositoryConfigurationTest.java create mode 100644 src/test/java/com/blazemeter/jmeter/correlation/core/templates/CorrelationTemplatesRepositoryTest.java create mode 100644 src/test/java/com/blazemeter/jmeter/correlation/core/templates/ProtocolTest.java create mode 100644 src/test/java/com/blazemeter/jmeter/correlation/core/templates/RepositoryTest.java create mode 100644 src/test/java/com/blazemeter/jmeter/correlation/core/templates/TemplateTest.java create mode 100644 src/test/java/com/blazemeter/jmeter/correlation/core/templates/TemplateVersionKeyDeserializerTest.java create mode 100644 src/test/java/com/blazemeter/jmeter/correlation/core/templates/WiredBaseTest.java create mode 100644 src/test/java/com/blazemeter/jmeter/correlation/gui/automatic/CorrelationHistoryFrameIT.java create mode 100644 src/test/resources/history-test.json diff --git a/pom.xml b/pom.xml index 3cb865d..6b91381 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.blazemeter jmeter-bzm-correlation-recorder jar - 2.2.1 + 2.3 Correlation Recorder as JMeter plugin Correlation Recorder Plugin for JMeter https://github.com/Blazemeter/CorrelationRecorder diff --git a/src/main/java/com/blazemeter/jmeter/correlation/CorrelationProxyControl.java b/src/main/java/com/blazemeter/jmeter/correlation/CorrelationProxyControl.java index a948744..41d8c90 100644 --- a/src/main/java/com/blazemeter/jmeter/correlation/CorrelationProxyControl.java +++ b/src/main/java/com/blazemeter/jmeter/correlation/CorrelationProxyControl.java @@ -8,6 +8,7 @@ import com.blazemeter.jmeter.correlation.core.InvalidRulePartElementException; import com.blazemeter.jmeter.correlation.core.RulesGroup; import com.blazemeter.jmeter.correlation.core.automatic.CorrelationHistory; +import com.blazemeter.jmeter.correlation.core.automatic.FileManagementUtils; import com.blazemeter.jmeter.correlation.core.automatic.JMeterElementUtils; import com.blazemeter.jmeter.correlation.core.automatic.ResultFileParser; import com.blazemeter.jmeter.correlation.core.proxy.ComparableCookie; @@ -90,8 +91,8 @@ public class CorrelationProxyControl extends ProxyControl implements private static final String CORRELATION_COMPONENTS = "CorrelationProxyControl.components"; private static final String RESPONSE_FILTER = "CorrelationProxyControl.responseFilter"; private static final String TEMPLATE_PATH = "CorrelationProxyControl.templatePath"; - private static final String CORRELATION_HISTORY_PATH = - "CorrelationProxyControl.correlationHistoryPath"; + private static final String CORRELATION_HISTORY_ID = + "CorrelationProxyControl.correlationHistoryId"; private static final String RECORDER_NAME = "bzm - Correlation Recorder"; // we use reflection to be able to call these non visible methods and not have to re implement // them. @@ -119,7 +120,7 @@ public class CorrelationProxyControl extends ProxyControl implements private JMeterTreeNode target = null; private List samples = new ArrayList<>(); private Method putSamplesIntoModel; - private CorrelationHistory history = new CorrelationHistory(); + private CorrelationHistory history; private Runnable onStopRecordingMethod; private String originalDisablingValue = null; @@ -151,6 +152,7 @@ public CorrelationProxyControl( templateRepositoryConfig; this.localConfiguration = localConfiguration; this.correlationEngine = correlationEngine; + configHistory(); } public CorrelationTemplatesRepositoriesConfiguration getTemplateRepositoryConfig() { @@ -291,7 +293,12 @@ public CorrelationRulesTestElement getCorrelationRulesTestElement() { @Override public synchronized void deliverSampler(HTTPSamplerBase sampler, TestElement[] testElements, SampleResult result) { - pendingProxies.get(Thread.currentThread()).update(sampler, testElements, result); + if (pendingProxies.containsKey(Thread.currentThread())) { + pendingProxies.get(Thread.currentThread()).update(sampler, testElements, result); + } else { + LOG.error("Unexpected error. Proxy not found! {}", Thread.currentThread()); + LOG.error(pendingProxies.keySet().toString()); + } } public synchronized void startedProxy(Thread proxy) { @@ -305,6 +312,7 @@ public synchronized void endedProxy(Thread proxy) { is not invoked for used clientSocket */ if (pendingProxy == null) { + deliverPendingCompletedRequests(); return; } /* @@ -324,7 +332,7 @@ private void deliverPendingCompletedRequests() { while (it.hasNext()) { PendingProxy proxy = it.next(); if (!proxy.isComplete()) { - return; + continue; } deliverCompletedProxy(proxy); it.remove(); @@ -548,12 +556,12 @@ public void setCorrelationGroups(List groups) { removeProperty(CORRELATION_RULES); } - public void setCorrelationHistoryPath(String path) { - setProperty(CORRELATION_HISTORY_PATH, path); + public void setCorrelationHistoryId(String id) { + setProperty(CORRELATION_HISTORY_ID, id); } - public void getCorrelationHistoryPath() { - getPropertyAsString(CORRELATION_HISTORY_PATH); + public String getCorrelationHistoryId() { + return getPropertyAsString(CORRELATION_HISTORY_ID); } public String getCorrelationComponents() { @@ -658,12 +666,10 @@ public List