Skip to content

Add wrappers for Android logcat broadcaster - #858

Merged
SrinivasanTarget merged 9 commits into
appium:masterfrom
mykola-mokhnach:ws
Apr 13, 2018
Merged

Add wrappers for Android logcat broadcaster#858
SrinivasanTarget merged 9 commits into
appium:masterfrom
mykola-mokhnach:ws

Conversation

@mykola-mokhnach

@mykola-mokhnachmykola-mokhnach commented Apr 2, 2018

Copy link
Copy Markdown
Contributor

Change list

Added basic classes to support web sockets interaction in general and to interact with logcat messages broadcaster that has been implemented for Android server.

Types of changes

  • No changes in production code.
  • 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)

@mykola-mokhnach

Copy link
Copy Markdown
ContributorAuthor

@KazuCocoa FYI

/**
* @return The list of web socket message handlers.
*/
List<T> messageHandlers();

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

messageHandlers() -> getMessageHandlers()

/**
* This is the basic interface for all web socket message handlers.
*/
public interface MessagesHandler {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's strange that messages handler can not handle messages.

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep, I'll make it generic

* @param reason connection close reason
*/
@OnClose
public void onClose(Session session, CloseReason reason) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

session parameter is never used.

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it is used in connect

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@OnClose
public void onClose(CloseReason reason) {

@mykola-mokhnach

Copy link
Copy Markdown
ContributorAuthor

I was also thinking about having separate callbacks for each event instead of interface implementation, which is more Java 8'ish. for example:

Instead of

driver.addLogcatListener(newMessagesHandler<String>() {
@OverridepublicvoidonMessage(Stringmessage) {
messageSemaphore.release();
}
@OverridepublicvoidonConnected() {
connectedSemaphore.release();
}
@OverridepublicvoidonDisconnected() {
// ignore
}
@OverridepublicvoidonError(Throwablecause) {
// ignore
}
});

it might look like

driver.addLogcatMessageListener(this::onMessage);
driver.addLogcatErrorListener(this::onError);

@appiumappium deleted a comment Apr 3, 2018
@mykola-mokhnach

Copy link
Copy Markdown
ContributorAuthor

Make sure the hotfix appium/appium#10496 is merged to appium server before testing this PR locally

@SrinivasanTarget

Copy link
Copy Markdown
Member

@mykola-mokhnach Unfortunately there is a conflict. Can you please resolve this? I will get this in.

… into ws
# Conflicts:
#	src/main/java/io/appium/java_client/android/AndroidDriver.java
@mykola-mokhnach

Copy link
Copy Markdown
ContributorAuthor

@SrinivasanTarget The conflict is resolved

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@mykola-mokhnach@SrinivasanTarget@vmaxim