diff --git a/pom.xml b/pom.xml
index f320ec2..259f14f 100644
--- a/pom.xml
+++ b/pom.xml
@@ -6,7 +6,7 @@
4.0.0
io.qameta.allure
allure-bamboo
- 1.18.1-SNAPSHOT
+ 1.18.2-SNAPSHOT
Allure for Bamboo
Allure reports right in deployment plans in Bamboo
atlassian-plugin
diff --git a/src/main/java/io/qameta/allure/bamboo/AllureDownloader.java b/src/main/java/io/qameta/allure/bamboo/AllureDownloader.java
index 265b46d..33b5b8f 100644
--- a/src/main/java/io/qameta/allure/bamboo/AllureDownloader.java
+++ b/src/main/java/io/qameta/allure/bamboo/AllureDownloader.java
@@ -54,7 +54,7 @@ Optional downloadAndExtractAllureTo(final String allureHomeDir,
ZipUtil.unzip(zipFilePath, extractDir.toString());
if (homeDir.exists()) {
- LOGGER.info("Directory " + homeDir + " already exists, removing it..");
+ LOGGER.info("Directory {} already exists, removing it..", homeDir);
deleteQuietly(homeDir);
}
moveDirectory(extractDir.resolve(extractedDirName).toFile(), homeDir);
@@ -78,9 +78,7 @@ private Optional downloadAllure(final String version) {
LOGGER.info("Downloading allure.zip from {} to {}", url, downloadToFile);
return Downloader.download(url, downloadToFile);
} catch (Exception e) {
- LOGGER
- .warn("Failed to download from {}. Root cause : {}.",
- url, e.toString());
+ LOGGER.warn("Failed to download from {}. Root cause : {}.", url, e.toString());
}
}
} catch (Exception e) {
diff --git a/src/main/java/io/qameta/allure/bamboo/AllureExecutableProvider.java b/src/main/java/io/qameta/allure/bamboo/AllureExecutableProvider.java
index c8e3e4e..96bce50 100644
--- a/src/main/java/io/qameta/allure/bamboo/AllureExecutableProvider.java
+++ b/src/main/java/io/qameta/allure/bamboo/AllureExecutableProvider.java
@@ -15,7 +15,6 @@
*/
package io.qameta.allure.bamboo;
-import com.google.common.annotations.VisibleForTesting;
import org.jetbrains.annotations.NotNull;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -30,11 +29,12 @@
import static java.util.regex.Pattern.compile;
public class AllureExecutableProvider {
+
private static final Logger LOGGER = LoggerFactory.getLogger(AllureExecutableProvider.class);
- static final String DEFAULT_VERSION = "2.21.0";
- static final String DEFAULT_PATH = "/tmp/allure/2.21.0";
+ static final String DEFAULT_VERSION = "2.30.0";
+ static final String DEFAULT_PATH = "/tmp/allure/2.30.0";
+ static final String BIN = "bin";
private static final Pattern EXEC_NAME_PATTERN = compile("[^\\d]*(\\d[0-9\\.]{2,}[a-zA-Z0-9\\-]*)$");
- private static final String BINARY_SUBDIR = "binary";
private final BambooExecutablesManager bambooExecutablesManager;
private final AllureDownloader allureDownloader;
@@ -48,28 +48,22 @@ public AllureExecutableProvider(final BambooExecutablesManager bambooExecutables
this.cmdLine = requireNonNull(cmdLine);
}
- @VisibleForTesting
- public static String getAllureSubDir() {
- return BINARY_SUBDIR;
- }
-
Optional provide(final boolean isDownloadEnabled, final String executableName) {
return bambooExecutablesManager.getExecutableByName(executableName)
.map(allureHomeDir -> {
- LOGGER.debug("Found allure executable by name '{}': '{}'", executableName, allureHomeDir);
- final String allureHomeSubDir = Paths.get(allureHomeDir, BINARY_SUBDIR).toString();
- final Path cmdPath = Paths.get(allureHomeSubDir, "bin", getAllureExecutableName());
+ LOGGER.info("Found allure executable by name '{}': '{}'", executableName, allureHomeDir);
+ final Path cmdPath = Paths.get(allureHomeDir, BIN, getAllureExecutableName());
final AllureExecutable executable = new AllureExecutable(cmdPath, cmdLine);
- LOGGER.debug("Checking the existence of the command path for executable '{}': '{}'",
+ LOGGER.info("Checking the existence of the command path for executable '{}': '{}'",
executableName, cmdPath);
final boolean commandExists = cmdLine.hasCommand(cmdPath.toString());
- LOGGER.debug("System has command for executable '{}': {}, downloadEnabled={}",
+ LOGGER.info("System has command for executable '{}': {}, downloadEnabled={}",
executableName, commandExists, isDownloadEnabled);
if (commandExists) {
return executable;
} else if (isDownloadEnabled) {
final Matcher nameMatcher = EXEC_NAME_PATTERN.matcher(executableName);
- return allureDownloader.downloadAndExtractAllureTo(allureHomeSubDir,
+ return allureDownloader.downloadAndExtractAllureTo(allureHomeDir,
nameMatcher.matches() ? nameMatcher.group(1) : DEFAULT_VERSION)
.map(path -> executable).orElse(null);
}
diff --git a/src/test/java/io/qameta/allure/bamboo/AllureExecutableProviderTest.java b/src/test/java/io/qameta/allure/bamboo/AllureExecutableProviderTest.java
index 7410cda..277af3b 100644
--- a/src/test/java/io/qameta/allure/bamboo/AllureExecutableProviderTest.java
+++ b/src/test/java/io/qameta/allure/bamboo/AllureExecutableProviderTest.java
@@ -26,8 +26,8 @@
import java.nio.file.Paths;
import java.util.Optional;
+import static io.qameta.allure.bamboo.AllureExecutableProvider.BIN;
import static io.qameta.allure.bamboo.AllureExecutableProvider.DEFAULT_VERSION;
-import static io.qameta.allure.bamboo.AllureExecutableProvider.getAllureSubDir;
import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
@@ -35,11 +35,9 @@
public class AllureExecutableProviderTest {
- private static final String ALLURE_2_0_0 = "Allure 2.0.0";
- private static final String EXECUTABLE_NAME_2_0_0 = "2.0.0";
- private static final String BIN = "bin";
+ private static final String ALLURE_2_21_0 = "Allure 2.21.0";
+ private static final String EXECUTABLE_NAME_2_21_0 = "2.21.0";
private final String homeDir = "/home/allure";
- private final String binaryDir = Paths.get(this.homeDir, getAllureSubDir()).toString();
@Rule
public MockitoRule mockitoRule = rule();
@@ -58,39 +56,39 @@ public class AllureExecutableProviderTest {
@Before
public void setUp() throws Exception {
config = new AllureGlobalConfig();
- allureCmdPath = Paths.get(binaryDir, BIN, "allure");
- allureBatCmdPath = Paths.get(binaryDir, BIN, "allure.bat");
+ allureCmdPath = Paths.get(homeDir, BIN, "allure");
+ allureBatCmdPath = Paths.get(homeDir, BIN, "allure.bat");
when(downloader.downloadAndExtractAllureTo(anyString(), anyString())).thenReturn(Optional.empty());
}
@Test
public void itShouldProvideDefaultVersion() throws Exception {
provide("Allure WITHOUT VERSION");
- verify(downloader).downloadAndExtractAllureTo(binaryDir, DEFAULT_VERSION);
+ verify(downloader).downloadAndExtractAllureTo(homeDir, DEFAULT_VERSION);
}
@Test
public void itShouldProvideTheGivenVersionWithFullSemverWithoutName() throws Exception {
- provide(EXECUTABLE_NAME_2_0_0);
- verify(downloader).downloadAndExtractAllureTo(binaryDir, EXECUTABLE_NAME_2_0_0);
+ provide(EXECUTABLE_NAME_2_21_0);
+ verify(downloader).downloadAndExtractAllureTo(homeDir, EXECUTABLE_NAME_2_21_0);
}
@Test
public void itShouldProvideTheGivenVersionWithFullSemverWithoutMilestone() throws Exception {
- provide(ALLURE_2_0_0);
- verify(downloader).downloadAndExtractAllureTo(binaryDir, EXECUTABLE_NAME_2_0_0);
+ provide(ALLURE_2_21_0);
+ verify(downloader).downloadAndExtractAllureTo(homeDir, EXECUTABLE_NAME_2_21_0);
}
@Test
public void itShouldProvideTheGivenVersionWithMajorMinorWithoutMilestone() throws Exception {
- provide("Allure 2.0");
- verify(downloader).downloadAndExtractAllureTo(binaryDir, "2.0");
+ provide("Allure 2.13.7");
+ verify(downloader).downloadAndExtractAllureTo(homeDir, "2.13.7");
}
@Test
public void itShouldProvideTheGivenVersionWithMilestone() throws Exception {
provide("Allure 2.0-BETA4");
- verify(downloader).downloadAndExtractAllureTo(binaryDir, "2.0-BETA4");
+ verify(downloader).downloadAndExtractAllureTo(homeDir, "2.0-BETA4");
}
private Optional provide(String executableName) {
diff --git a/src/test/java/io/qameta/allure/bamboo/SecondAllureExecutableProviderTest.java b/src/test/java/io/qameta/allure/bamboo/SecondAllureExecutableProviderTest.java
index 4c69c64..28f6ae7 100644
--- a/src/test/java/io/qameta/allure/bamboo/SecondAllureExecutableProviderTest.java
+++ b/src/test/java/io/qameta/allure/bamboo/SecondAllureExecutableProviderTest.java
@@ -26,7 +26,7 @@
import java.nio.file.Paths;
import java.util.Optional;
-import static io.qameta.allure.bamboo.AllureExecutableProvider.getAllureSubDir;
+import static io.qameta.allure.bamboo.AllureExecutableProvider.BIN;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.mockito.Mockito.when;
@@ -34,11 +34,9 @@
public class SecondAllureExecutableProviderTest {
- private static final String ALLURE_2_0_0 = "Allure 2.0.0";
- private static final String EXECUTABLE_NAME_2_0_0 = "2.0.0";
- private static final String BIN = "bin";
+ private static final String ALLURE_2_21_0 = "Allure 2.21.0";
+ private static final String EXECUTABLE_NAME_2_21_0 = "2.21.0";
private final String homeDir = "/home/allure";
- private final String binaryDir = Paths.get(this.homeDir, getAllureSubDir()).toString();
@Rule
public MockitoRule mockitoRule = rule();
@@ -57,8 +55,8 @@ public class SecondAllureExecutableProviderTest {
@Before
public void setUp() throws Exception {
config = new AllureGlobalConfig();
- allureCmdPath = Paths.get(binaryDir, BIN, "allure");
- allureBatCmdPath = Paths.get(binaryDir, BIN, "allure.bat");
+ allureCmdPath = Paths.get(homeDir, BIN, "allure");
+ allureBatCmdPath = Paths.get(homeDir, BIN, "allure.bat");
}
@Test
@@ -77,7 +75,7 @@ public void itShouldProvideExecutableForWindows() throws Exception {
when(cmdLine.hasCommand(allureBatCmdPath.toString())).thenReturn(true);
when(cmdLine.isWindows()).thenReturn(true);
- final Optional res = provide(ALLURE_2_0_0);
+ final Optional res = provide(ALLURE_2_21_0);
assertThat(res.isPresent(), equalTo(true));
assertThat(res.get().getCmdPath(), equalTo(allureBatCmdPath));