Skip to content

Commit

Permalink
fix bug for rendering connection reject (Authentication failed)
Browse files Browse the repository at this point in the history
  • Loading branch information
dzmipt committed Mar 15, 2024
1 parent 0ad7d21 commit 81aec2f
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/kx/K4AccessException.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package kx;

public class K4AccessException extends K4Exception {
K4AccessException() {
public K4AccessException() {
super("Authentication failed");
}
}
2 changes: 1 addition & 1 deletion src/studio/ui/TabPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public class TabPanel extends JPanel {
public TabPanel(StudioWindow studioWindow, QueryResult queryResult) {
this.studioWindow = studioWindow;
this.queryResult = queryResult;
if (queryResult != null) {
if (queryResult != null && queryResult.getError() == null ) {
this.result = queryResult.getResult();
}
initComponents();
Expand Down
11 changes: 11 additions & 0 deletions test-integration/studio/ui/ResultTest.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package studio.ui;

import kx.K4AccessException;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.assertj.swing.data.TableCell;
Expand All @@ -13,6 +14,7 @@

import java.awt.*;
import java.util.Arrays;
import java.util.regex.Pattern;

public class ResultTest extends StudioTest {

Expand Down Expand Up @@ -99,7 +101,16 @@ public void testTableConnExtractor() {
String[] labels = popupMenu.menuLabels();
log.info("Got the following menu items {}", Arrays.toString(labels));
Assert.assertEquals("Open b:3", labels[0]);
}

@Test
public void testAuthenticationException() {
MockQSession.setResponse(new K4AccessException());
execute();

JTextComponentFixture textArea = frameFixture.panel("resultPanel0").textBox();
textArea.requireText(Pattern.compile(".*error.*Authentication failed.*", Pattern.DOTALL));
}


}

0 comments on commit 81aec2f

Please sign in to comment.