Skip to content

Commit

Permalink
Issue provectus#1911 - Sonar - Blocker fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
ankitverma68688 committed Apr 30, 2023
1 parent da3932e commit 3949956
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,17 +72,14 @@ private void withJmxConnector(String jmxUrl,
KafkaCluster c,
Consumer<JMXConnector> consumer) {
var env = prepareJmxEnvAndSetThreadLocal(c);
try {
JMXConnector connector = null;
try (JMXConnector connector = JMXConnectorFactory.newJMXConnector(new JMXServiceURL(jmxUrl), env)) {
try {
connector = JMXConnectorFactory.newJMXConnector(new JMXServiceURL(jmxUrl), env);
connector.connect(env);
} catch (Exception exception) {
log.error("Error connecting to {}", jmxUrl, exception);
return;
}
consumer.accept(connector);
connector.close();
} catch (Exception e) {
log.error("Error getting jmx metrics from {}", jmxUrl, e);
} finally {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,10 @@ private static Mono<ApplicationPropertyValidationDTO> invalid(Throwable th) {
*/
public static Optional<String> validateTruststore(TruststoreConfig truststoreConfig) {
if (truststoreConfig.getTruststoreLocation() != null && truststoreConfig.getTruststorePassword() != null) {
try {
try (FileInputStream fileInputStream = new FileInputStream(
(ResourceUtils.getFile(truststoreConfig.getTruststoreLocation())))) {
KeyStore trustStore = KeyStore.getInstance(KeyStore.getDefaultType());
trustStore.load(
new FileInputStream((ResourceUtils.getFile(truststoreConfig.getTruststoreLocation()))),
truststoreConfig.getTruststorePassword().toCharArray()
);
trustStore.load(fileInputStream, truststoreConfig.getTruststorePassword().toCharArray());
TrustManagerFactory trustManagerFactory = TrustManagerFactory.getInstance(
TrustManagerFactory.getDefaultAlgorithm()
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ public void shouldCalculateCorrectPageCountForNonDivisiblePageSize() {

assertThat(topics.getBody().getPageCount()).isEqualTo(4);
assertThat(topics.getBody().getTopics()).hasSize(1);
assertThat(topics.getBody().getTopics().get(0).getName().equals("99"));
assertThat(topics.getBody().getTopics().get(0).getName()).isEqualTo("99");
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public class SchemaDetails extends BasePage {
protected SelenideElement compatibilityField = $x("//h4[contains(text(),'Compatibility')]/../p");
protected SelenideElement editSchemaBtn = $x("//button[contains(text(),'Edit Schema')]");
protected SelenideElement removeBtn = $x("//*[contains(text(),'Remove')]");
protected SelenideElement confirmBtn = $x("//div[@role='dialog']//button[contains(text(),'Confirm')]");
protected SelenideElement schemaConfirmBtn = $x("//div[@role='dialog']//button[contains(text(),'Confirm')]");
protected SelenideElement schemaTypeField = $x("//h4[contains(text(),'Type')]/../p");
protected SelenideElement latestVersionField = $x("//h4[contains(text(),'Latest version')]/../p");
protected SelenideElement compareVersionBtn = $x("//button[text()='Compare Versions']");
Expand Down Expand Up @@ -62,8 +62,8 @@ public SchemaDetails openCompareVersionMenu() {
public SchemaDetails removeSchema() {
clickByJavaScript(dotMenuBtn);
removeBtn.shouldBe(Condition.enabled).click();
confirmBtn.shouldBe(Condition.visible).click();
confirmBtn.shouldBe(Condition.disappear);
schemaConfirmBtn.shouldBe(Condition.visible).click();
schemaConfirmBtn.shouldBe(Condition.disappear);
return this;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public class ProduceMessagePanel extends BasePage {
protected SelenideElement keyTextArea = $x("//div[@id='key']/textarea");
protected SelenideElement valueTextArea = $x("//div[@id='content']/textarea");
protected SelenideElement headersTextArea = $x("//div[@id='headers']/textarea");
protected SelenideElement submitBtn = headersTextArea.$x("../../../..//button[@type='submit']");
protected SelenideElement submitProduceMessageBtn = headersTextArea.$x("../../../..//button[@type='submit']");
protected SelenideElement partitionDdl = $x("//ul[@name='partition']");
protected SelenideElement keySerdeDdl = $x("//ul[@name='keySerde']");
protected SelenideElement contentSerdeDdl = $x("//ul[@name='valueSerde']");
Expand Down Expand Up @@ -48,8 +48,8 @@ public ProduceMessagePanel setHeadersFld(String value) {

@Step
public ProduceMessagePanel submitProduceMessage() {
clickByActions(submitBtn);
submitBtn.shouldBe(Condition.disappear);
clickByActions(submitProduceMessageBtn);
submitProduceMessageBtn.shouldBe(Condition.disappear);
refresh();
return this;
}
Expand Down

0 comments on commit 3949956

Please sign in to comment.