Issue #1911 - Sonar - Blocker fixes
This commit is contained in:
parent
da3932e342
commit
39499564e8
5 changed files with 11 additions and 16 deletions
|
@ -72,17 +72,14 @@ class JmxMetricsRetriever implements MetricsRetriever, Closeable {
|
||||||
KafkaCluster c,
|
KafkaCluster c,
|
||||||
Consumer<JMXConnector> consumer) {
|
Consumer<JMXConnector> consumer) {
|
||||||
var env = prepareJmxEnvAndSetThreadLocal(c);
|
var env = prepareJmxEnvAndSetThreadLocal(c);
|
||||||
|
try (JMXConnector connector = JMXConnectorFactory.newJMXConnector(new JMXServiceURL(jmxUrl), env)) {
|
||||||
try {
|
try {
|
||||||
JMXConnector connector = null;
|
|
||||||
try {
|
|
||||||
connector = JMXConnectorFactory.newJMXConnector(new JMXServiceURL(jmxUrl), env);
|
|
||||||
connector.connect(env);
|
connector.connect(env);
|
||||||
} catch (Exception exception) {
|
} catch (Exception exception) {
|
||||||
log.error("Error connecting to {}", jmxUrl, exception);
|
log.error("Error connecting to {}", jmxUrl, exception);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
consumer.accept(connector);
|
consumer.accept(connector);
|
||||||
connector.close();
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("Error getting jmx metrics from {}", jmxUrl, e);
|
log.error("Error getting jmx metrics from {}", jmxUrl, e);
|
||||||
} finally {
|
} finally {
|
||||||
|
|
|
@ -45,12 +45,10 @@ public final class KafkaServicesValidation {
|
||||||
*/
|
*/
|
||||||
public static Optional<String> validateTruststore(TruststoreConfig truststoreConfig) {
|
public static Optional<String> validateTruststore(TruststoreConfig truststoreConfig) {
|
||||||
if (truststoreConfig.getTruststoreLocation() != null && truststoreConfig.getTruststorePassword() != null) {
|
if (truststoreConfig.getTruststoreLocation() != null && truststoreConfig.getTruststorePassword() != null) {
|
||||||
try {
|
try (FileInputStream fileInputStream = new FileInputStream(
|
||||||
|
(ResourceUtils.getFile(truststoreConfig.getTruststoreLocation())))) {
|
||||||
KeyStore trustStore = KeyStore.getInstance(KeyStore.getDefaultType());
|
KeyStore trustStore = KeyStore.getInstance(KeyStore.getDefaultType());
|
||||||
trustStore.load(
|
trustStore.load(fileInputStream, truststoreConfig.getTruststorePassword().toCharArray());
|
||||||
new FileInputStream((ResourceUtils.getFile(truststoreConfig.getTruststoreLocation()))),
|
|
||||||
truststoreConfig.getTruststorePassword().toCharArray()
|
|
||||||
);
|
|
||||||
TrustManagerFactory trustManagerFactory = TrustManagerFactory.getInstance(
|
TrustManagerFactory trustManagerFactory = TrustManagerFactory.getInstance(
|
||||||
TrustManagerFactory.getDefaultAlgorithm()
|
TrustManagerFactory.getDefaultAlgorithm()
|
||||||
);
|
);
|
||||||
|
|
|
@ -131,7 +131,7 @@ class TopicsServicePaginationTest {
|
||||||
|
|
||||||
assertThat(topics.getBody().getPageCount()).isEqualTo(4);
|
assertThat(topics.getBody().getPageCount()).isEqualTo(4);
|
||||||
assertThat(topics.getBody().getTopics()).hasSize(1);
|
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
|
@Test
|
||||||
|
|
|
@ -13,7 +13,7 @@ public class SchemaDetails extends BasePage {
|
||||||
protected SelenideElement compatibilityField = $x("//h4[contains(text(),'Compatibility')]/../p");
|
protected SelenideElement compatibilityField = $x("//h4[contains(text(),'Compatibility')]/../p");
|
||||||
protected SelenideElement editSchemaBtn = $x("//button[contains(text(),'Edit Schema')]");
|
protected SelenideElement editSchemaBtn = $x("//button[contains(text(),'Edit Schema')]");
|
||||||
protected SelenideElement removeBtn = $x("//*[contains(text(),'Remove')]");
|
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 schemaTypeField = $x("//h4[contains(text(),'Type')]/../p");
|
||||||
protected SelenideElement latestVersionField = $x("//h4[contains(text(),'Latest version')]/../p");
|
protected SelenideElement latestVersionField = $x("//h4[contains(text(),'Latest version')]/../p");
|
||||||
protected SelenideElement compareVersionBtn = $x("//button[text()='Compare Versions']");
|
protected SelenideElement compareVersionBtn = $x("//button[text()='Compare Versions']");
|
||||||
|
@ -62,8 +62,8 @@ public class SchemaDetails extends BasePage {
|
||||||
public SchemaDetails removeSchema() {
|
public SchemaDetails removeSchema() {
|
||||||
clickByJavaScript(dotMenuBtn);
|
clickByJavaScript(dotMenuBtn);
|
||||||
removeBtn.shouldBe(Condition.enabled).click();
|
removeBtn.shouldBe(Condition.enabled).click();
|
||||||
confirmBtn.shouldBe(Condition.visible).click();
|
schemaConfirmBtn.shouldBe(Condition.visible).click();
|
||||||
confirmBtn.shouldBe(Condition.disappear);
|
schemaConfirmBtn.shouldBe(Condition.disappear);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,7 @@ public class ProduceMessagePanel extends BasePage {
|
||||||
protected SelenideElement keyTextArea = $x("//div[@id='key']/textarea");
|
protected SelenideElement keyTextArea = $x("//div[@id='key']/textarea");
|
||||||
protected SelenideElement valueTextArea = $x("//div[@id='content']/textarea");
|
protected SelenideElement valueTextArea = $x("//div[@id='content']/textarea");
|
||||||
protected SelenideElement headersTextArea = $x("//div[@id='headers']/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 partitionDdl = $x("//ul[@name='partition']");
|
||||||
protected SelenideElement keySerdeDdl = $x("//ul[@name='keySerde']");
|
protected SelenideElement keySerdeDdl = $x("//ul[@name='keySerde']");
|
||||||
protected SelenideElement contentSerdeDdl = $x("//ul[@name='valueSerde']");
|
protected SelenideElement contentSerdeDdl = $x("//ul[@name='valueSerde']");
|
||||||
|
@ -48,8 +48,8 @@ public class ProduceMessagePanel extends BasePage {
|
||||||
|
|
||||||
@Step
|
@Step
|
||||||
public ProduceMessagePanel submitProduceMessage() {
|
public ProduceMessagePanel submitProduceMessage() {
|
||||||
clickByActions(submitBtn);
|
clickByActions(submitProduceMessageBtn);
|
||||||
submitBtn.shouldBe(Condition.disappear);
|
submitProduceMessageBtn.shouldBe(Condition.disappear);
|
||||||
refresh();
|
refresh();
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue