Skip to content

Commit 9869cb1

Browse files
authored
Merge pull request #410 from Xceptance/update-release-plugin
Update release plugin
2 parents 4053c93 + 6473661 commit 9869cb1

File tree

7 files changed

+99
-89
lines changed

7 files changed

+99
-89
lines changed

pom.xml

Lines changed: 57 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -58,28 +58,6 @@
5858
<junit.vintage.version>6.0.0-M2</junit.vintage.version>
5959
</properties>
6060

61-
<repositories>
62-
<repository>
63-
<id>xceptance-public</id>
64-
<url>https://lab.xceptance.de/nexus/content/repositories/public/</url>
65-
</repository>
66-
<repository>
67-
<id>qameta</id>
68-
<url>https://dl.bintray.com/qameta/maven</url>
69-
</repository>
70-
</repositories>
71-
72-
<distributionManagement>
73-
<repository>
74-
<id>ossrh</id>
75-
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
76-
</repository>
77-
<snapshotRepository>
78-
<id>ossrh</id>
79-
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
80-
</snapshotRepository>
81-
</distributionManagement>
82-
8361
<build>
8462
<plugins>
8563
<plugin>
@@ -181,26 +159,63 @@
181159
<forkCount>1</forkCount>
182160
</configuration>
183161
</plugin>
184-
<plugin>
185-
<groupId>org.apache.maven.plugins</groupId>
186-
<artifactId>maven-gpg-plugin</artifactId>
187-
<version>3.2.8</version>
188-
<configuration>
189-
<gpgArguments>
190-
<arg>--pinentry-mode</arg>
191-
<arg>loopback</arg>
192-
</gpgArguments>
193-
</configuration>
194-
<executions>
195-
<execution>
196-
<id>sign-artifacts</id>
197-
<phase>verify</phase>
198-
<goals>
199-
<goal>sign</goal>
200-
</goals>
201-
</execution>
202-
</executions>
203-
</plugin>
162+
<plugin>
163+
<groupId>org.codehaus.mojo</groupId>
164+
<artifactId>build-helper-maven-plugin</artifactId>
165+
<version>3.6.1</version>
166+
<configuration>
167+
<artifacts>
168+
<artifact>
169+
<file>target/${project.artifactId}-${project.version}-javadoc.jar</file>
170+
<classifier>javadoc</classifier>
171+
</artifact>
172+
<artifact>
173+
<file>target/${project.artifactId}-${project.version}-sources.jar</file>
174+
<classifier>sources</classifier>
175+
</artifact>
176+
</artifacts>
177+
</configuration>
178+
<executions>
179+
<execution>
180+
<id>attach-artifacts</id>
181+
<phase>package</phase>
182+
<goals>
183+
<goal>attach-artifact</goal>
184+
</goals>
185+
</execution>
186+
</executions>
187+
</plugin>
188+
<plugin>
189+
<groupId>org.apache.maven.plugins</groupId>
190+
<artifactId>maven-gpg-plugin</artifactId>
191+
<version>3.2.8</version>
192+
<configuration>
193+
<gpgArguments>
194+
<arg>--pinentry-mode</arg>
195+
<arg>loopback</arg>
196+
</gpgArguments>
197+
</configuration>
198+
<executions>
199+
<execution>
200+
<id>sign-artifacts</id>
201+
<phase>verify</phase>
202+
<goals>
203+
<goal>sign</goal>
204+
</goals>
205+
</execution>
206+
</executions>
207+
</plugin>
208+
<plugin>
209+
<groupId>org.sonatype.central</groupId>
210+
<artifactId>central-publishing-maven-plugin</artifactId>
211+
<version>0.8.0</version>
212+
<extensions>true</extensions>
213+
<configuration>
214+
<publishingServerId>central</publishingServerId>
215+
<autoPublish>true</autoPublish>
216+
<waitUntil>published</waitUntil>
217+
</configuration>
218+
</plugin>
204219
</plugins>
205220
</build>
206221
</profile>

src/main/java/com/xceptance/neodymium/common/browser/BrowserRunnerHelper.java

Lines changed: 18 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
import org.openqa.selenium.chrome.ChromeOptions;
2929
import org.openqa.selenium.edge.EdgeDriver;
3030
import org.openqa.selenium.edge.EdgeOptions;
31-
import org.openqa.selenium.firefox.FirefoxBinary;
3231
import org.openqa.selenium.firefox.FirefoxDriver;
3332
import org.openqa.selenium.firefox.FirefoxOptions;
3433
import org.openqa.selenium.firefox.FirefoxProfile;
@@ -161,37 +160,18 @@ else if (windowWidth > 0 && windowHeight > 0)
161160
}
162161
}
163162

164-
/**
165-
* Creates a {@link FirefoxBinary} object and sets the path, but only if the path is not blank.
166-
*
167-
* @param pathToBrowser
168-
* the path to the browser binary
169-
* @return the Firefox binary
170-
*/
171-
private static FirefoxBinary createFirefoxBinary(final String pathToBrowser)
172-
{
173-
if (StringUtils.isNotBlank(pathToBrowser))
174-
{
175-
return new FirefoxBinary(new File(pathToBrowser));
176-
}
177-
else
178-
{
179-
return new FirefoxBinary();
180-
}
181-
}
182-
183163
/**
184164
* Instantiate the {@link WebDriver} according to the configuration read from {@link Browser} annotations.
185165
*
186166
* @param config
187167
* {@link BrowserConfiguration} that describes the desired browser instance
188168
* @param testClassInstance
189169
* {@link String} name of the test to display on test environment
190-
* @return {@link WebDriverStateContainer} the instance of the browser described in {@link BrowserConfiguration} and in
191-
* {@link NeodymiumConfiguration}
170+
* @return {@link WebDriverStateContainer} the instance of the browser described in {@link BrowserConfiguration} and
171+
* in {@link NeodymiumConfiguration}
192172
* @throws MalformedURLException
193-
* if <a href="https://github.com/Xceptance/neodymium/wiki/Selenium-grid">Selenium grid</a> is used and the
194-
* given grid URL is invalid
173+
* if <a href="https://github.com/Xceptance/neodymium/wiki/Selenium-grid">Selenium grid</a> is used and
174+
* the given grid URL is invalid
195175
*/
196176
public static WebDriverStateContainer createWebDriverStateContainer(final BrowserConfiguration config, final String testClassInstance)
197177
throws MalformedURLException
@@ -221,10 +201,11 @@ else if (Neodymium.configuration().enableSelenideProxy())
221201
final SelenideProxyServerFactory selenideProxyServerFactory = Plugins.inject(SelenideProxyServerFactory.class);
222202
selenideProxyServer = selenideProxyServerFactory.create(new SelenideConfig(),
223203
(Proxy) capabilities.getCapability(CapabilityType.PROXY));
224-
final var proxy = selenideProxyServer.getSeleniumProxy();
204+
final Proxy proxy = selenideProxyServer.getSeleniumProxy();
225205
capabilities.setCapability(CapabilityType.PROXY, proxy);
226206
}
227-
else {
207+
else
208+
{
228209
// no proxy should be used, so set the proxy to null
229210
// makes it possible to run some test with temp proxy and some without during a single test run
230211
capabilities.setCapability(CapabilityType.PROXY, (Object) null);
@@ -251,7 +232,7 @@ else if (Neodymium.configuration().enableSelenideProxy())
251232
}
252233

253234
// find a free port for each chrome session (important for lighthouse)
254-
var remoteDebuggingPort = PortProber.findFreePort();
235+
int remoteDebuggingPort = PortProber.findFreePort();
255236
Neodymium.setRemoteDebuggingPort(remoteDebuggingPort);
256237
options.addArguments("--remote-debugging-port=" + remoteDebuggingPort);
257238

@@ -296,8 +277,17 @@ else if (Neodymium.configuration().enableSelenideProxy())
296277
else if (firefoxBrowsers.contains(browserName))
297278
{
298279
final FirefoxOptions options = new FirefoxOptions();
280+
new ExecutableFinder().find("firefox");
299281
final String driverInPathPath = new ExecutableFinder().find("geckodriver");
300-
options.setBinary(createFirefoxBinary(Neodymium.configuration().getFirefoxBrowserPath()));
282+
283+
if (StringUtils.isNotBlank(Neodymium.configuration().getFirefoxBrowserPath()))
284+
{
285+
options.setBinary(new File(Neodymium.configuration().getFirefoxBrowserPath()).toPath());
286+
}
287+
else
288+
{
289+
options.setBinary(new ExecutableFinder().find("firefox"));
290+
}
301291
if (config.isHeadless())
302292
{
303293
options.addArguments("--headless");

src/main/java/com/xceptance/neodymium/common/browser/configuration/BrowserConfigurationMapper.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ else if (!StringUtils.isEmpty(globalHeadless))
334334
final String driverArgs = browserProfileConfiguration.get(DRIVER_ARGS);
335335
if (!StringUtils.isEmpty(driverArgs))
336336
{
337-
final var argsList = new ArrayList<>(List.of(driverArgs.split(";")));
337+
final ArrayList<String> argsList = new ArrayList<>(List.of(driverArgs.split(";")));
338338
argsList.removeIf(arg -> arg == null || arg.trim().equals(""));
339339
argsList.replaceAll(String::trim);
340340
browserConfiguration.setDriverArguments(argsList);

src/main/java/com/xceptance/neodymium/common/retry/Retry.java

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,16 @@
99

1010
/**
1111
* Annotation to mark flaky tests that often fail due to the same error but for which there is a hope that they may
12-
* succeed on retry. </br>
13-
* Use it as the following: @Retry(maxNumberOfRetries = 4, exceptions = { "HERE" })</br>
14-
* </br>
15-
* It's possible to let the definition of maxNumberOfRetries out, then it will be set to the default value - 3. </br>
12+
* succeed on retry.
13+
* <p>
14+
* Use it as the following: {@code @Retry(maxNumberOfRetries = 4, exceptions = { "HERE" })}
15+
* </p>
16+
* <p>
17+
* It's possible to let the definition of maxNumberOfRetries out, then it will be set to the default value - 3.
18+
* </p>
19+
* <p>
1620
* If you let out the definition of exceptions, test will be retried on every error
21+
* </p>
1722
*/
1823
@Retention(RetentionPolicy.RUNTIME)
1924
@Target(

src/main/java/com/xceptance/neodymium/common/retry/RetryData.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ public class RetryData
2525
*/
2626
public RetryData(Method templateMethod)
2727
{
28-
var testClassRetryAnnotations = getDeclaredAnnotations(templateMethod.getDeclaringClass(), Retry.class);
29-
var methodRetryAnnotations = Data.getAnnotations(templateMethod, Retry.class);
28+
List<Retry> testClassRetryAnnotations = getDeclaredAnnotations(templateMethod.getDeclaringClass(), Retry.class);
29+
List<Retry> methodRetryAnnotations = Data.getAnnotations(templateMethod, Retry.class);
3030

3131
exceptions = new ArrayList<String>();
3232
if (!testClassRetryAnnotations.isEmpty())
@@ -78,7 +78,7 @@ private <T extends Annotation> List<T> getDeclaredAnnotations(Class<?> type, Cla
7878
List<T> annotations = new ArrayList<T>();
7979
while (type != null)
8080
{
81-
var annotationsOfCurrentType = type.getDeclaredAnnotation(annotationClass);
81+
T annotationsOfCurrentType = type.getDeclaredAnnotation(annotationClass);
8282
if (annotationsOfCurrentType != null)
8383
{
8484
annotations.addAll(List.of(annotationsOfCurrentType));

src/main/java/com/xceptance/neodymium/common/testdata/DataSet.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@
1818
* then it will override suppression and enforce the method to run with <b>all</b> data sets
1919
* <p>
2020
* Examples:
21-
* <pre>
22-
* @DataSet(1) -> executes only the first data set
23-
* @DataSet({1, 5}) -> executes the first 5 data sets
24-
* </pre>
21+
* <p>
22+
* {@code @DataSet(1)} -> executes only the first data set
23+
* {@code @DataSet({1, 5})} -> executes the first 5 data sets
24+
* </p>
2525
*/
2626
@Retention(RUNTIME)
2727
@Target(

src/main/java/com/xceptance/neodymium/util/AllureAddons.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@
5757
import io.qameta.allure.AllureLifecycle;
5858
import io.qameta.allure.Step;
5959
import io.qameta.allure.internal.AllureStorage;
60+
import io.qameta.allure.model.Attachment;
6061
import io.qameta.allure.model.StepResult;
6162

6263
/**
@@ -204,8 +205,8 @@ public static void removeAttachmentFromStepByName(final String name)
204205
if (canUpdateAllureTest())
205206
{
206207
lifecycle.updateTestCase((result) -> {
207-
var stepResult = findLastStep(result.getSteps());
208-
var attachments = stepResult.getAttachments();
208+
StepResult stepResult = findLastStep(result.getSteps());
209+
List<Attachment> attachments = stepResult.getAttachments();
209210
for (int i = 0; i < attachments.size(); i++)
210211
{
211212
io.qameta.allure.model.Attachment attachment = attachments.get(i);
@@ -230,7 +231,6 @@ public static void removeAttachmentFromStepByName(final String name)
230231
* In before methods we will get a lot of error messages since internally Allure is has the current test not
231232
* available.
232233
*
233-
* @param lifecycle
234234
* @return whether or not we can update the allure test case
235235
*/
236236
public static boolean canUpdateAllureTest()
@@ -293,7 +293,7 @@ public static boolean addAttachmentToStep(final String name, final String type,
293293
lifecycle.addAttachment(name, type, fileExtension, stream);
294294

295295
lifecycle.updateTestCase((result) -> {
296-
var stepResult = findLastStep(result.getSteps());
296+
StepResult stepResult = findLastStep(result.getSteps());
297297
Optional<io.qameta.allure.model.Attachment> addedAttachmentInOuterStep = result.getAttachments().stream().filter(a -> a.getName().equals(name))
298298
.findFirst();
299299

@@ -365,9 +365,9 @@ public static void addInfoAsFirstStep(final String info)
365365
*/
366366
private static StepResult findLastStep(List<StepResult> steps)
367367
{
368-
var lastStep = steps.get(steps.size() - 1);
369-
List<StepResult> childStepts = lastStep.getSteps();
370-
if (childStepts != null && childStepts.isEmpty() == false)
368+
StepResult lastStep = steps.get(steps.size() - 1);
369+
List<StepResult> childStepts = lastStep.getSteps();
370+
if (childStepts != null && childStepts.isEmpty() == false)
371371
{
372372
return findLastStep(childStepts);
373373
}

0 commit comments

Comments
 (0)