From b3fc52ae60758b2328b5bb840008cf2dacf6cab1 Mon Sep 17 00:00:00 2001 From: mikera Date: Wed, 1 May 2024 12:05:17 +0100 Subject: [PATCH] Add query tests to StressPanel --- .../convex/gui/peer/windows/StressPanel.java | 25 +++++++++++++++---- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/convex-gui/src/main/java/convex/gui/peer/windows/StressPanel.java b/convex-gui/src/main/java/convex/gui/peer/windows/StressPanel.java index 5e61eeca0..c4a7a32be 100644 --- a/convex-gui/src/main/java/convex/gui/peer/windows/StressPanel.java +++ b/convex-gui/src/main/java/convex/gui/peer/windows/StressPanel.java @@ -64,6 +64,7 @@ public class StressPanel extends JPanel { private JCheckBox syncCheckBox; private JCheckBox distCheckBox; private JCheckBox repeatCheckBox; + private JCheckBox queryCheckBox; private JSplitPane splitPane; private JPanel resultPanel; @@ -145,6 +146,11 @@ public StressPanel(Convex peerView) { optionPanel.add(repeatCheckBox); repeatCheckBox.setSelected(false); + optionPanel.add(new JLabel("Query")); + queryCheckBox=new JCheckBox(); + optionPanel.add(queryCheckBox); + queryCheckBox.setSelected(false); + optionPanel.add(new JLabel("Repeat timeout")); repeatTimeSpinner = new JSpinner(); repeatTimeSpinner.setModel(new SpinnerNumberModel(60, 0, 3600, 1)); @@ -259,11 +265,20 @@ protected String doStressRun() throws Exception { ATransaction t = buildTransaction(origin, i); CompletableFuture fr; - if (syncCheckBox.isSelected()) { - Result r=cc.transactSync(t); - fr=CompletableFuture.completedFuture(r); - } else { - fr = cc.transact(t); + if (queryCheckBox.isSelected()) { + if (syncCheckBox.isSelected()) { + Result r=cc.querySync(t); + fr=CompletableFuture.completedFuture(r); + } else { + fr = cc.query(t); + } + } else { + if (syncCheckBox.isSelected()) { + Result r=cc.transactSync(t); + fr=CompletableFuture.completedFuture(r); + } else { + fr = cc.transact(t); + } } synchronized(frs) { // synchronised so we don't collide with other threads