Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migration to Java 8. API with default implementation. #470

Merged
merged 3 commits into from
Sep 17, 2016
Merged

Migration to Java 8. API with default implementation. #470

merged 3 commits into from
Sep 17, 2016

Conversation

TikhomirovSergey
Copy link
Contributor

@TikhomirovSergey TikhomirovSergey commented Sep 12, 2016

Change list

Epic: #399

  • each one interface extends the io.appium.java_client.ExecutesMethod
  • both AppiumDriver and MobileElement implement io.appium.java_client.ExecutesMethod
  • Current API has default implementation
  • AppiumDriver, MobileElement and subclasses just declare interfaces are implemented.

Types of changes

What types of changes are you proposing/introducing to Java client?

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Details

We have few targets:

  • We are going to support Windows Mobile automation. Some interesting things were found. It supports some functions which were declared as Android-specific. As well it may support some functions which were declared as iOS-only as well. So we need for very flexible API which allows to implement it easily and without copy-paste.
  • Some users need to use Android/iOS specific functions eventually. Now it should be possible in very pretty way:
import io.appium.java_client.android.StartsActivity;
...

private AppiumDriver<?> driver;

...
       StartsActivity startsActivity = new StartsActivity() {
            @Override
            public Response execute(String driverCommand, Map<String, ?> parameters) {
                return driver.execute(driverCommand, parameters);
            }

            @Override
            public Response execute(String driverCommand) {
                return driver.execute(driverCommand);
            }
        };
        startsActivity.startActivity("yourPackage", "yourActivity");

If somebody wants to use only Selenium and Appium interfaces when even this is possible:

import io.appium.java_client.ExecutesMethod;

public class ExtendedRemoteWebDriver extends RemoteWebDriver implements ExecutesMethod {
...
}

_______________________________________________________________________________________________

import io.appium.java_client.android.StartsActivity;
...

private ExtendedRemoteWebDriver driver;

...
       StartsActivity startsActivity = new StartsActivity() {
            @Override
            public Response execute(String driverCommand, Map<String, ?> parameters) {
                return driver.execute(driverCommand, parameters);
            }

            @Override
            public Response execute(String driverCommand) {
                return driver.execute(driverCommand);
            }
        };
        startsActivity.startActivity("yourPackage", "yourActivity");

- The new interface ExecutesMethod
- Refactoring of FindsBy* interfaces
Also:
- The new interface LocksAndroidDevice
- The new interface LocksIOSDevice
@TikhomirovSergey
Copy link
Contributor Author

It is just refactoring. API moving/restructuration is going after the merging.

Related issues/epics: #454, #471

@TikhomirovSergey
Copy link
Contributor Author

@SrinivasanTarget could you review this PR
FYI @HeloiseRD @pfoster-youitv @philgreenyouilabs @simongranger

@SrinivasanTarget
Copy link
Member

@TikhomirovSergey I like the changes. Its a great start 👍

@SrinivasanTarget
Copy link
Member

@TikhomirovSergey I see checkstyle failures due to last PR's https://gist.github.com/SrinivasanTarget/60573e85fc7a85822f4ecdb1720026ef. Otherwise LGTM 👍

@TikhomirovSergey
Copy link
Contributor Author

TikhomirovSergey commented Sep 17, 2016

@SrinivasanTarget ok will fix ASAP but it is not related to this PR.

@TikhomirovSergey TikhomirovSergey merged commit 0c8c43b into appium:master Sep 17, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants