Skip to content

Commit 38b2343

Browse files
author
Mykola Mokhnach
committed
Merge branch 'master' of https://github.com/mykola-mokhnach/java-client into lock
# Conflicts: # src/main/java/io/appium/java_client/android/AndroidMobileCommandHelper.java # src/main/java/io/appium/java_client/android/LocksAndroidDevice.java
2 parents 2ef45ee + eecd044 commit 38b2343

File tree

119 files changed

+810
-497
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

119 files changed

+810
-497
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# java-client
22

33
[![Maven Central](https://maven-badges.herokuapp.com/maven-central/io.appium/java-client/badge.svg)](https://maven-badges.herokuapp.com/maven-central/io.appium/java-client)
4-
[![Javadoc](https://javadoc-emblem.rhcloud.com/doc/io.appium/java-client/badge.svg)](http://www.javadoc.io/doc/io.appium/java-client)
4+
[![Javadoc](https://www.javadoc.io/badge/io.appium/java-client.svg)](http://www.javadoc.io/doc/io.appium/java-client)
55
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/f365c5e9458b42bf8a5b1d928d7e4f48)](https://www.codacy.com/app/appium/java-client)
66
[![Build Status](https://travis-ci.org/appium/java-client.svg?branch=master)](https://travis-ci.org/appium/java-client)
77

@@ -24,6 +24,7 @@ This is the Java language binding for writing Appium Tests, conforms to [Mobile
2424
- **[DEPENDENCY UPDATES]**
2525
- `org.seleniumhq.selenium:selenium-java` was updated to 3.8.1
2626
- **[BREAKING CHANGE]** Removal of deprecated listener-methods from the AlertEventListener. [#797](https://github.com/appium/java-client/pull/797)
27+
- **[BUG FIX]**. Fix the `pushFile` command. [#812](https://github.com/appium/java-client/pull/812) [#816](https://github.com/appium/java-client/pull/816)
2728

2829
*6.0.0-BETA2*
2930
- **[ENHANCEMENT]** The `fingerPrint` ability was added. It is supported by Android for now. [#473](https://github.com/appium/java-client/pull/473) [#786](https://github.com/appium/java-client/pull/786)

build.gradle

Lines changed: 7 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -12,21 +12,17 @@ version '6.0.0-BETA2'
1212

1313
repositories {
1414
jcenter()
15-
maven {
16-
url 'http://repo.maven.apache.org/maven2'
17-
}
15+
mavenCentral()
1816
}
1917

2018
buildscript {
2119
repositories {
2220
jcenter()
23-
maven {
24-
url 'http://repo.maven.apache.org/maven2'
25-
}
21+
mavenCentral()
2622
}
2723
dependencies {
2824
classpath 'org.owasp:dependency-check-gradle:1.4.0'
29-
classpath 'com.github.jengelman.gradle.plugins:shadow:1.2.4'
25+
classpath 'com.github.jengelman.gradle.plugins:shadow:2.0.2'
3026
}
3127
}
3228

@@ -60,9 +56,7 @@ dependencies {
6056
compile ("org.seleniumhq.selenium:selenium-java:${seleniumVersion}") {
6157
force = true
6258

63-
exclude module: 'cglib'
6459
exclude group: 'com.google.code.gson'
65-
exclude module: 'phantomjsdriver'
6660
exclude module: 'htmlunit-driver'
6761
exclude group: 'net.sourceforge.htmlunit'
6862

@@ -93,22 +87,6 @@ ext {
9387
Docs = file("$buildDir/doc")
9488
}
9589

96-
sourceSets {
97-
main {
98-
java {
99-
srcDir('src/main/java')
100-
}
101-
resources {
102-
srcDir('src/main/resources')
103-
}
104-
}
105-
test {
106-
java {
107-
srcDir('src/test/java')
108-
}
109-
}
110-
}
111-
11290
dependencyCheck {
11391
failBuildOnCVSS=22
11492
}
@@ -128,19 +106,12 @@ tasks.withType(JacocoReport) {
128106
jacocoTestReport.dependsOn test
129107

130108
checkstyle {
131-
toolVersion = '7.0'
109+
toolVersion = '8.7'
110+
configFile = file("$projectDir/google-style.xml")
132111
showViolations = true
133-
}
134-
135-
dependencies {
136-
checkstyle( 'com.puppycrawl.tools:checkstyle:7.0' )
137-
}
138-
139-
tasks.withType(Checkstyle) {
140112
ignoreFailures = false
141-
configFile = file("$projectDir/google-style.xml")
142-
exclude '**/org/openqa/selenium/**'
143113
}
114+
checkstyleMain.excludes = ['**/org/openqa/selenium/**']
144115

145116
task javadocJar(type: Jar) {
146117
classifier = 'javadoc'
@@ -221,10 +192,7 @@ uploadArchives {
221192
}
222193
}
223194

224-
task wrapper(type: Wrapper) {
225-
gradleVersion = '4.3.1'
226-
description 'Generates the Gradle wrapper scripts.'
227-
}
195+
wrapper.gradleVersion = '4.4.1'
228196

229197
test {
230198
useJUnit()

docs/How-to-propose-a-PR.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,4 @@ with pasted java code samples or put them at a PR description using markdown. Ab
2121

2222
# Pull-request template
2323

24-
There is [PULL_REQUEST_TEMPLATE.md)](https://github.com/appium/java-client/blob/master/PULL_REQUEST_TEMPLATE.md) which should help you to make a good pull request.
24+
There is [PULL_REQUEST_TEMPLATE.md](https://github.com/appium/java-client/blob/master/PULL_REQUEST_TEMPLATE.md) which should help you to make a good pull request.

google-style.xml

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0"?>
22
<!DOCTYPE module PUBLIC
3-
"-//Puppy Crawl//DTD Check Configuration 1.3//EN"
4-
"http://www.puppycrawl.com/dtds/configuration_1_3.dtd">
3+
"-//Puppy Crawl//DTD Check Configuration 1.3//EN"
4+
"http://checkstyle.sourceforge.net/dtds/configuration_1_3.dtd">
55

66
<!-- Originally designed by:-->
77
<!--
@@ -46,19 +46,16 @@
4646
<property name="ignorePattern" value="^package.*|^import.*|a href|href|http://|https://|ftp://"/>
4747
</module>
4848
<module name="AvoidStarImport">
49-
<property name="severity" value="warning"/>
50-
</module>
49+
<property name="severity" value="warning"/>
50+
</module>
5151
<module name="OneTopLevelClass"/>
5252
<module name="NoLineWrap"/>
5353
<module name="EmptyBlock">
5454
<property name="option" value="TEXT"/>
5555
<property name="tokens" value="LITERAL_TRY, LITERAL_FINALLY, LITERAL_IF, LITERAL_ELSE, LITERAL_SWITCH"/>
5656
</module>
5757
<module name="NeedBraces"/>
58-
<module name="LeftCurly">
59-
<property name="maxLineLength" value="100"/>
60-
</module>
61-
<module name="RightCurly"/>
58+
<module name="LeftCurly" />
6259
<module name="RightCurly">
6360
<property name="option" value="alone"/>
6461
<property name="tokens" value="CLASS_DEF, METHOD_DEF, CTOR_DEF, LITERAL_FOR, LITERAL_WHILE, LITERAL_DO, STATIC_INIT, INSTANCE_INIT"/>
@@ -97,7 +94,7 @@
9794
value="Package name ''{0}'' must match pattern ''{1}''."/>
9895
</module>
9996
<module name="TypeName">
100-
<property name="format" value="^([*iOSFindBy*]||[*iOSXCUITFind*])||([A-Z][a-zA-Z0-9])*$"/>
97+
<property name="format" value="^([*iOSFindBy*]||[*iOSXCUITFind*])||([A-Z][a-zA-Z0-9])*$"/>
10198
<message key="name.invalidPattern"
10299
value="Type name ''{0}'' must match pattern ''{1}''."/>
103100
</module>
@@ -166,7 +163,7 @@
166163
<property name="specialImportsRegExp" value="com.google"/>
167164
<property name="sortImportsInGroupAlphabetically" value="true"/>
168165
<property name="customImportOrderRules" value="STATIC###SPECIAL_IMPORTS###THIRD_PARTY_PACKAGE###STANDARD_JAVA_PACKAGE"/>
169-
<property name="severity" value="warning"/>
166+
<property name="severity" value="warning"/>
170167
</module>
171168
<module name="MethodParamPad"/>
172169
<module name="OperatorWrap">
@@ -182,19 +179,19 @@
182179
</module>
183180
<module name="NonEmptyAtclauseDescription"/>
184181
<module name="JavadocTagContinuationIndentation">
185-
<property name="severity" value="warning"/>
186-
</module>
182+
<property name="severity" value="warning"/>
183+
</module>
187184
<module name="SummaryJavadoc">
188185
<property name="forbiddenSummaryFragments" value="^@return the *|^This method returns |^A [{]@code [a-zA-Z0-9]+[}]( is a )"/>
189-
<property name="severity" value="warning"/>
186+
<property name="severity" value="warning"/>
190187
</module>
191188
<module name="JavadocParagraph">
192-
<property name="severity" value="warning"/>
193-
</module>
189+
<property name="severity" value="warning"/>
190+
</module>
194191
<module name="AtclauseOrder">
195192
<property name="tagOrder" value="@param, @return, @throws, @deprecated"/>
196193
<property name="target" value="CLASS_DEF, INTERFACE_DEF, ENUM_DEF, METHOD_DEF, CTOR_DEF, VARIABLE_DEF"/>
197-
<property name="severity" value="warning"/>
194+
<property name="severity" value="warning"/>
198195
</module>
199196
<module name="JavadocMethod">
200197
<property name="scope" value="public"/>
@@ -215,8 +212,8 @@
215212
</module>
216213
<module name="EmptyCatchBlock">
217214
<property name="exceptionVariableName" value="expected"/>
218-
215+
219216
</module>
220217
<module name="CommentsIndentation"/>
221218
</module>
222-
</module>
219+
</module>

gradle/wrapper/gradle-wrapper.jar

-398 Bytes
Binary file not shown.

gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
33
zipStoreBase=GRADLE_USER_HOME
44
zipStorePath=wrapper/dists
5-
distributionUrl=https\://services.gradle.org/distributions/gradle-4.3.1-bin.zip
5+
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4.1-bin.zip

src/main/java/io/appium/java_client/AppiumDriver.java

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -53,14 +53,14 @@
5353
import java.util.Set;
5454

5555
/**
56-
* @param <T> the required type of class which implement {@link org.openqa.selenium.WebElement}.
56+
* Default Appium driver implementation.
57+
*
58+
* @param <T> the required type of class which implement {@link WebElement}.
5759
* Instances of the defined type will be returned via findElement* and findElements*
5860
* Warning (!!!). Allowed types:
59-
* {@link org.openqa.selenium.WebElement}
60-
* {@link org.openqa.selenium.remote.RemoteWebElement}
61-
* {@link io.appium.java_client.MobileElement} and its subclasses that designed
62-
* specifically
63-
* for each target mobile OS (still Android and iOS)
61+
* {@link WebElement}, {@link org.openqa.selenium.remote.RemoteWebElement},
62+
* {@link MobileElement} and its subclasses that designed
63+
* specifically for each target mobile OS (still Android and iOS)
6464
*/
6565
@SuppressWarnings("unchecked")
6666
public class AppiumDriver<T extends WebElement>
@@ -73,11 +73,12 @@ public class AppiumDriver<T extends WebElement>
7373
private ExecuteMethod executeMethod;
7474

7575
/**
76-
* @param executor is an instance of {@link org.openqa.selenium.remote.HttpCommandExecutor}
76+
* Creates a new instance based on command {@code executor} and {@code capabilities}.
77+
*
78+
* @param executor is an instance of {@link HttpCommandExecutor}
7779
* or class that extends it. Default commands or another vendor-specific
7880
* commands may be specified there.
79-
* @param capabilities take a look
80-
* at {@link org.openqa.selenium.Capabilities}
81+
* @param capabilities take a look at {@link Capabilities}
8182
*/
8283
public AppiumDriver(HttpCommandExecutor executor, Capabilities capabilities) {
8384
super(executor, capabilities);
@@ -129,6 +130,8 @@ public AppiumDriver(Capabilities desiredCapabilities) {
129130
}
130131

131132
/**
133+
* Changes platform name and returns new capabilities.
134+
*
132135
* @param originalCapabilities the given {@link Capabilities}.
133136
* @param newPlatform a {@link MobileCapabilityType#PLATFORM_NAME} value which has
134137
* to be set up

src/main/java/io/appium/java_client/AppiumExecutionMethod.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public Object execute(String commandName, Map<String, ?> parameters) {
4141
Response response;
4242

4343
if (parameters == null || parameters.isEmpty()) {
44-
response = driver.execute(commandName, ImmutableMap.<String, Object>of());
44+
response = driver.execute(commandName, ImmutableMap.of());
4545
} else {
4646
response = driver.execute(commandName, parameters);
4747
}

src/main/java/io/appium/java_client/AppiumFluentWait.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,13 +94,17 @@ public Duration getInterval() {
9494
}
9595

9696
/**
97+
* The input value to pass to the evaluated conditions.
98+
*
9799
* @param input The input value to pass to the evaluated conditions.
98100
*/
99101
public AppiumFluentWait(T input) {
100102
super(input);
101103
}
102104

103105
/**
106+
* Creates wait object based on {@code input} value, {@code clock} and {@code sleeper}.
107+
*
104108
* @param input The input value to pass to the evaluated conditions.
105109
* @param clock The clock to use when measuring the timeout.
106110
* @param sleeper Used to put the thread to sleep between evaluation loops.
@@ -211,10 +215,9 @@ public AppiumFluentWait<T> withPollingStrategy(Function<IterationInfo, Duration>
211215
* <ol>
212216
* <li>the function returns neither null nor false,</li>
213217
* <li>the function throws an unignored exception,</li>
214-
* <li>the timeout expires,
215-
* <li>
218+
* <li>the timeout expires,</li>
216219
* <li>the current thread is interrupted</li>
217-
* </ol>
220+
* </ol>.
218221
*
219222
* @param isTrue the parameter to pass to the expected condition
220223
* @param <V> The function's expected return type.

src/main/java/io/appium/java_client/CommandExecutionHelper.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,16 @@
2222

2323
public final class CommandExecutionHelper {
2424

25-
public static <T extends Object> T execute(ExecutesMethod executesMethod,
25+
public static <T> T execute(ExecutesMethod executesMethod,
2626
Map.Entry<String, Map<String, ?>> keyValuePair) {
2727
return handleResponse(executesMethod.execute(keyValuePair.getKey(), keyValuePair.getValue()));
2828
}
2929

30-
public static <T extends Object> T execute(ExecutesMethod executesMethod, String command) {
30+
public static <T> T execute(ExecutesMethod executesMethod, String command) {
3131
return handleResponse(executesMethod.execute(command));
3232
}
3333

34-
private static <T extends Object> T handleResponse(Response response) {
34+
private static <T> T handleResponse(Response response) {
3535
if (response != null) {
3636
return (T) response.getValue();
3737
}

0 commit comments

Comments
 (0)