Skip to content

Commit

Permalink
Small fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
kaicopilot committed Oct 13, 2021
1 parent 21b5174 commit 403fb31
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 20 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ plugins {
}

group 'io.github'
version '1.6.1'
version '1.6.2'
sourceCompatibility = JavaVersion.VERSION_11

repositories {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,28 +36,22 @@ public void createUI(Project project) {
}

private void handleTestButton() {
Optional<String> username = getTestRailUser();
if (username.isPresent()) {
statusField.setText(String.format("authorized as '%s'", username.get()));
} else {
statusField.setText("Bad credentials");
}
}

private boolean isEmpty(final JTextField field) {
return StringUtils.isBlank(field.getText());
}

private Optional<String> getTestRailUser() {
if (isEmpty(url) && isEmpty(usernameTextField) && isEmpty(passwordPasswordField)) {
return Optional.empty();
statusField.setText("Please fill all required fields");
}

final TestRailClient client = getTestRailClient();
String connectionTest;
try {
return Optional.of(client.getUserByEmail(settings.getUserName()).getName());
connectionTest = client.getUserByEmail(settings.getUserName()).getName();
} catch (Exception e) {
return Optional.empty();
connectionTest = e.getMessage();
}
statusField.setText(connectionTest);
}

private boolean isEmpty(final JTextField field) {
return StringUtils.isBlank(field.getText());
}

private TestRailClient getTestRailClient() {
Expand Down
10 changes: 7 additions & 3 deletions src/main/resources/META-INF/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<idea-version since-build="192"/>
<change-notes><![CDATA[<html>
<ul>
<li>Authorization API update</li>
<li>Small bugfixes</li>
</ul>
</html>]]>
</change-notes>
Expand All @@ -17,7 +17,11 @@
<li><a href="https://docs.qameta.io/allure/" target="_blank">Allure</a></li>
</ul>
<a href="https://www.paypal.com/paypalme/andriikonovka1">Support me</a>
If you need support for other frameworks, please send pull requests or:
<p>
<a href="https://www.paypal.com/donate?hosted_button_id=375ZSZ64LQT7C">Support me</a>
<p>Please note: "Enable API" checkbox in TestRail settings should be enabled!
<li>How to use:</li>
<ul>
Expand Down Expand Up @@ -47,7 +51,7 @@
<depends>com.intellij.modules.java</depends>
<extensions defaultExtensionNs="com.intellij">
<!-- Add your extensions here -->
<projectConfigurable groupId="tools" displayName="Allure to TestRail Exporter Plugin"
<projectConfigurable groupId="tools" displayName="Allure to TestRail Exporter"
id="preferences.TestRailConfigurable"
instance="io.github.legionivo.plugin.TestRailConfigurable"/>
<projectService serviceImplementation="io.github.legionivo.plugin.Settings"/>
Expand Down

0 comments on commit 403fb31

Please sign in to comment.