Skip to content

Commit

Permalink
EPMRPP-94504 improve rd jobs (#31)
Browse files Browse the repository at this point in the history
* EPMRPP-94504 improve saucelabs plugin
  • Loading branch information
grabsefx authored Oct 24, 2024
1 parent 4b8e13f commit 689a96c
Show file tree
Hide file tree
Showing 24 changed files with 571 additions and 519 deletions.
27 changes: 10 additions & 17 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,10 @@ sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11

repositories {
maven { url "https://m2proxy.atlassian.com/repository/public" }
mavenCentral { url "https://repo1.maven.org/maven2" }

if (!releaseMode) {
maven { url 'https://jitpack.io' }
}
mavenCentral { url "https://repo1.maven.org/maven2" }
}

dependencyManagement {
Expand All @@ -48,12 +46,8 @@ dependencies {
}
implementation 'org.hibernate:hibernate-core:5.6.15.Final'

// TODO: 2.5.3+ switched to camel-case models. UI updates required
implementation 'com.saucelabs:saucerest:2.5.1'
implementation 'dev.failsafe:failsafe:3.3.2'
implementation 'org.awaitility:awaitility:4.2.2'
implementation 'org.hamcrest:hamcrest-core:2.2'
runtimeOnly 'com.squareup.moshi:moshi:1.15.1'
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.7.2'
testImplementation 'org.junit.jupiter:junit-jupiter-engine:5.7.2'

// add lombok support
compileOnly "org.projectlombok:lombok:${lombokVersion}"
Expand All @@ -63,6 +57,11 @@ dependencies {

}

test {
useJUnitPlatform()
onlyIf { Boolean.getBoolean(testsEnabled) } // enable for debugging purposes only
}

generatePomFileForShadowPublication { pom.packaging = "jar" }

jar {
Expand All @@ -73,7 +72,7 @@ jar {
"Plugin-Version": "${project.version}",
"Plugin-Provider": "Pavel Bortnik",
"Plugin-Class": "com.epam.reportportal.saucelabs.SaucelabsPlugin",
// "Plugin-Dependencies": ""
// "Plugin-Dependencies": ""
)
}
}
Expand All @@ -82,13 +81,7 @@ shadowJar {
archiveClassifier.set(null)
zip64 true
dependencies {
include(dependency('com.saucelabs:saucerest:2.5.1'))
include(dependency('org.json:json:20240303'))
include(dependency('org.awaitility:awaitility:4.2.2'))
include(dependency('org.hamcrest:hamcrest:2.2'))
include(dependency('com.squareup.moshi:moshi:1.15.1'))
include(dependency('net.jodah:failsafe:2.4.4'))

include(dependency('org.hibernate:hibernate-core:5.6.15.Final'))
}
}

Expand Down
1 change: 1 addition & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
version=5.11.0
lombokVersion=1.18.34
testsEnabled=false
108 changes: 0 additions & 108 deletions src/main/java/com/epam/reportportal/saucelabs/AssetsCommand.java

This file was deleted.

89 changes: 0 additions & 89 deletions src/main/java/com/epam/reportportal/saucelabs/JobInfoCommand.java

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -13,41 +13,42 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.epam.reportportal.saucelabs;

import static com.google.common.base.Preconditions.checkNotNull;

import java.util.concurrent.atomic.AtomicBoolean;
import java.util.function.Supplier;

import static com.google.common.base.Preconditions.checkNotNull;

/**
* @author <a href="mailto:[email protected]">Ivan Budayeu</a>
*/
public class MemoizingSupplier<T> implements Supplier<T> {

private final Supplier<T> delegate;

private AtomicBoolean initialized = new AtomicBoolean(false);

private T value;

public MemoizingSupplier(Supplier<T> delegate) {
this.delegate = checkNotNull(delegate);
}

@Override
public T get() {
if (!initialized.get()) {
synchronized (this) {
if (!initialized.get()) {
T t = delegate.get();
value = t;
initialized.set(true);
return t;
}
}
}
return value;
}
private final Supplier<T> delegate;

private AtomicBoolean initialized = new AtomicBoolean(false);

private T value;

public MemoizingSupplier(Supplier<T> delegate) {
this.delegate = checkNotNull(delegate);
}

@Override
public T get() {
if (!initialized.get()) {
synchronized (this) {
if (!initialized.get()) {
T t = delegate.get();
value = t;
initialized.set(true);
return t;
}
}
}
return value;
}

}
Loading

0 comments on commit 689a96c

Please sign in to comment.