Skip to content
Prev Previous commit
Next Next commit
Code Changes for Lombok Plugin
  • Loading branch information
jayandran-Sampath committed Jul 19, 2019
commit 59f8ccf9129c94c2bdeea57d1446edbbeb0d62bb
16 changes: 12 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,13 @@ apply plugin: 'jacoco'
apply plugin: 'checkstyle'
apply plugin: 'signing'


import org.apache.tools.ant.filters.*

group 'io.appium'
version '7.0.0'


repositories {
jcenter()
mavenCentral()
Expand All @@ -34,6 +36,11 @@ configurations {
ecj
}

dependencies {
compileOnly 'org.projectlombok:lombok:1.18.8'
annotationProcessor 'org.projectlombok:lombok:1.18.8'
}

dependencies {
ecj 'org.eclipse.jdt:ecj:3.16.0'
}
Expand All @@ -51,6 +58,7 @@ compileJava {
]
}


dependencies {
compile ("org.seleniumhq.selenium:selenium-java:${project.property('selenium.version')}") {
force = true
Expand Down Expand Up @@ -129,14 +137,14 @@ artifacts {
archives javadocJar, sourcesJar
}

signing {
sign configurations.archives
}
//signing {
// sign configurations.archives
//}

uploadArchives {
repositories {
mavenDeployer {
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
// beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }

repository(url: 'https://oss.sonatype.org/service/local/staging/deploy/maven2/') {
authentication(userName: ossrhUsername, password: ossrhPassword)
Expand Down
13 changes: 3 additions & 10 deletions src/main/java/io/appium/java_client/AppiumCommandInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,13 @@

package io.appium.java_client;

import lombok.Getter;
import org.openqa.selenium.remote.CommandInfo;
import org.openqa.selenium.remote.http.HttpMethod;

public class AppiumCommandInfo extends CommandInfo {
private final String url;
private final HttpMethod method;
@Getter private final String url;
@Getter private final HttpMethod method;

/**
* It conntains method and URL of the command.
Expand All @@ -34,12 +35,4 @@ public AppiumCommandInfo(String url, HttpMethod method) {
this.url = url;
this.method = method;
}

public String getUrl() {
return url;
}

public HttpMethod getMethod() {
return method;
}
}
55 changes: 20 additions & 35 deletions src/main/java/io/appium/java_client/AppiumFluentWait.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

import com.google.common.base.Throwables;

import lombok.Getter;
import org.openqa.selenium.TimeoutException;
import org.openqa.selenium.WebDriverException;
import org.openqa.selenium.support.ui.FluentWait;
Expand All @@ -35,61 +36,45 @@ public class AppiumFluentWait<T> extends FluentWait<T> {
private Function<IterationInfo, Duration> pollingStrategy = null;

public static class IterationInfo {
private final long number;
private final Duration elapsed;
private final Duration total;
private final Duration interval;

/**
* The class is used to represent information about a single loop iteration in {@link #until(Function)}
* method.
*
* @param number loop iteration number, starts from 1
* @param elapsed the amount of elapsed time since the loop started
* @param total the amount of total time to run the loop
* @param interval the default time interval for each loop iteration
*/
public IterationInfo(long number, Duration elapsed, Duration total, Duration interval) {
this.number = number;
this.elapsed = elapsed;
this.total = total;
this.interval = interval;
}

/**
* The current iteration number.
*
* @return current iteration number. It starts from 1
*/
public long getNumber() {
return number;
}

@Getter private final long number;
/**
* The amount of elapsed time.
*
* @return the amount of elapsed time
*/
public Duration getElapsed() {
return elapsed;
}

@Getter private final Duration elapsed;
/**
* The amount of total time.
*
* @return the amount of total time
*/
public Duration getTotal() {
return total;
}

@Getter private final Duration total;
/**
* The current interval.
*
* @return The actual value of current interval or the default one if it is not set
*/
public Duration getInterval() {
return interval;
@Getter private final Duration interval;

/**
* The class is used to represent information about a single loop iteration in {@link #until(Function)}
* method.
*
* @param number loop iteration number, starts from 1
* @param elapsed the amount of elapsed time since the loop started
* @param total the amount of total time to run the loop
* @param interval the default time interval for each loop iteration
*/
public IterationInfo(long number, Duration elapsed, Duration total, Duration interval) {
this.number = number;
this.elapsed = elapsed;
this.total = total;
this.interval = interval;
}
}

Expand Down
9 changes: 3 additions & 6 deletions src/main/java/io/appium/java_client/MobileBy.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

package io.appium.java_client;

import lombok.Getter;
import org.apache.commons.lang3.StringUtils;
import org.openqa.selenium.By;
import org.openqa.selenium.SearchContext;
Expand All @@ -31,7 +32,7 @@ public abstract class MobileBy extends By {
private static final String ERROR_TEXT = "The class %s of the given context "
+ "doesn't implement %s nor %s. Sorry. It is impossible to find something.";

private final String locatorString;
@Getter private final String locatorString;
private final MobileSelector selector;

private static IllegalArgumentException formIllegalArgumentException(Class<?> givenClass,
Expand All @@ -48,13 +49,9 @@ protected MobileBy(MobileSelector selector, String locatorString) {
this.selector = selector;
}

protected String getLocatorString() {
return locatorString;
}

@SuppressWarnings("unchecked")
@Override public List<WebElement> findElements(SearchContext context) {
return (List<WebElement>) ((FindsByFluentSelector<?>) context)
return (List<WebElement>) ((FindsByFluentSelector<?>) context)
.findElements(selector.toString(), getLocatorString());
}

Expand Down
34 changes: 12 additions & 22 deletions src/main/java/io/appium/java_client/ScreenshotState.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@

package io.appium.java_client;

import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;

import static com.google.common.base.Preconditions.checkNotNull;
import static java.util.Optional.ofNullable;

Expand All @@ -29,15 +33,20 @@
import java.util.function.Supplier;

import javax.imageio.ImageIO;

@Accessors(chain = true)
public class ScreenshotState {
private static final Duration DEFAULT_INTERVAL_MS = Duration.ofMillis(500);

private BufferedImage previousScreenshot;
private final Supplier<BufferedImage> stateProvider;
private final ComparesImages comparator;

private Duration comparisonInterval = DEFAULT_INTERVAL_MS;
/**
* Gets the interval value in ms between similarity verification rounds in <em>verify*</em> methods.
*
* @param comparisonInterval interval value. 500 ms by default
* @return current interval value in ms
*/
@Getter @Setter private Duration comparisonInterval = DEFAULT_INTERVAL_MS;

/**
* The class constructor accepts two arguments. The first one is image comparator, the second
Expand Down Expand Up @@ -79,25 +88,6 @@ public ScreenshotState(ComparesImages comparator) {
this(comparator, null);
}

/**
* Gets the interval value in ms between similarity verification rounds in <em>verify*</em> methods.
*
* @return current interval value in ms
*/
public Duration getComparisonInterval() {
return comparisonInterval;
}

/**
* Sets the interval between similarity verification rounds in <em>verify*</em> methods.
*
* @param comparisonInterval interval value. 500 ms by default
* @return self instance for chaining
*/
public ScreenshotState setComparisonInterval(Duration comparisonInterval) {
this.comparisonInterval = comparisonInterval;
return this;
}

/**
* Call this method to save the initial screenshot state.
Expand Down
Loading