forked from SonicCloudOrg/sonic-driver-core
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
272 additions
and
18 deletions.
There are no files selected for viewing
56 changes: 56 additions & 0 deletions
56
src/main/java/org/cloud/sonic/driver/android/service/UiaClient.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
/* | ||
* Copyright (C) [SonicCloudOrg] Sonic Project | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* | ||
*/ | ||
package org.cloud.sonic.driver.android.service; | ||
|
||
import com.alibaba.fastjson.JSONObject; | ||
import org.cloud.sonic.driver.tool.RespHandler; | ||
import org.cloud.sonic.driver.tool.Logger; | ||
import org.cloud.sonic.driver.tool.SonicRespException; | ||
|
||
/** | ||
* @author Eason | ||
* uia client interface | ||
*/ | ||
public interface UiaClient { | ||
//Client Setting | ||
void setGlobalTimeOut(int timeOut); | ||
|
||
RespHandler getRespHandler(); | ||
|
||
void setRespHandler(RespHandler respHandler); | ||
|
||
Logger getLogger(); | ||
|
||
void showLog(); | ||
|
||
void disableLog(); | ||
|
||
//Session handler. | ||
String getRemoteUrl(); | ||
|
||
void setRemoteUrl(String remoteUrl); | ||
|
||
String getSessionId(); | ||
|
||
void setSessionId(String sessionId); | ||
|
||
void newSession(JSONObject capabilities) throws SonicRespException; | ||
|
||
void closeSession() throws SonicRespException; | ||
|
||
void checkSessionId() throws SonicRespException; | ||
} |
102 changes: 102 additions & 0 deletions
102
src/main/java/org/cloud/sonic/driver/android/service/impl/UiaClientImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
/* | ||
* Copyright (C) [SonicCloudOrg] Sonic Project | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* | ||
*/ | ||
package org.cloud.sonic.driver.android.service.impl; | ||
|
||
import com.alibaba.fastjson.JSONObject; | ||
import org.cloud.sonic.driver.android.service.UiaClient; | ||
import org.cloud.sonic.driver.tool.RespHandler; | ||
import org.cloud.sonic.driver.ios.models.WindowSize; | ||
import org.cloud.sonic.driver.tool.Logger; | ||
import org.cloud.sonic.driver.tool.SonicRespException; | ||
|
||
public class UiaClientImpl implements UiaClient { | ||
private String remoteUrl; | ||
private String sessionId; | ||
private RespHandler respHandler; | ||
private Logger logger; | ||
private WindowSize size; | ||
|
||
public UiaClientImpl() { | ||
respHandler = new RespHandler(); | ||
logger = new Logger(); | ||
} | ||
|
||
@Override | ||
public void setGlobalTimeOut(int timeOut) { | ||
respHandler.setRequestTimeOut(timeOut); | ||
} | ||
|
||
@Override | ||
public RespHandler getRespHandler() { | ||
return null; | ||
} | ||
|
||
@Override | ||
public void setRespHandler(RespHandler respHandler) { | ||
|
||
} | ||
|
||
@Override | ||
public Logger getLogger() { | ||
return null; | ||
} | ||
|
||
@Override | ||
public void showLog() { | ||
|
||
} | ||
|
||
@Override | ||
public void disableLog() { | ||
|
||
} | ||
|
||
@Override | ||
public String getRemoteUrl() { | ||
return null; | ||
} | ||
|
||
@Override | ||
public void setRemoteUrl(String remoteUrl) { | ||
|
||
} | ||
|
||
@Override | ||
public String getSessionId() { | ||
return null; | ||
} | ||
|
||
@Override | ||
public void setSessionId(String sessionId) { | ||
|
||
} | ||
|
||
@Override | ||
public void newSession(JSONObject capabilities) throws SonicRespException { | ||
|
||
} | ||
|
||
@Override | ||
public void closeSession() throws SonicRespException { | ||
|
||
} | ||
|
||
@Override | ||
public void checkSessionId() throws SonicRespException { | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
92 changes: 92 additions & 0 deletions
92
src/main/java/org/cloud/sonic/driver/common/service/BaseClient.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
package org.cloud.sonic.driver.common.service; | ||
|
||
import com.alibaba.fastjson.JSONObject; | ||
import org.cloud.sonic.driver.ios.models.TouchActions; | ||
import org.cloud.sonic.driver.ios.models.WindowSize; | ||
import org.cloud.sonic.driver.ios.service.WebElement; | ||
import org.cloud.sonic.driver.tool.Logger; | ||
import org.cloud.sonic.driver.tool.RespHandler; | ||
import org.cloud.sonic.driver.tool.SonicRespException; | ||
|
||
import java.util.List; | ||
|
||
public interface BaseClient { | ||
//Client Setting | ||
void setGlobalTimeOut(int timeOut); | ||
|
||
RespHandler getRespHandler(); | ||
|
||
void setRespHandler(RespHandler respHandler); | ||
|
||
Logger getLogger(); | ||
|
||
void showLog(); | ||
|
||
void disableLog(); | ||
|
||
//Session handler. | ||
String getRemoteUrl(); | ||
|
||
void setRemoteUrl(String remoteUrl); | ||
|
||
String getSessionId(); | ||
|
||
void setSessionId(String sessionId); | ||
|
||
void newSession(JSONObject capabilities) throws SonicRespException; | ||
|
||
void closeSession() throws SonicRespException; | ||
|
||
void checkSessionId() throws SonicRespException; | ||
|
||
//window handler. | ||
WindowSize getWindowSize() throws SonicRespException; | ||
|
||
//lock handler. | ||
boolean isLocked() throws SonicRespException; | ||
|
||
void lock() throws SonicRespException; | ||
|
||
void unlock() throws SonicRespException; | ||
|
||
//perform handler. | ||
void performTouchAction(TouchActions touchActions) throws SonicRespException; | ||
|
||
//button handler. | ||
void pressButton(String buttonName) throws SonicRespException; | ||
|
||
//keyboard handler. | ||
void sendKeys(String text, Integer frequency) throws SonicRespException; | ||
|
||
void setPasteboard(String contentType, String content) throws SonicRespException; | ||
|
||
byte[] getPasteboard(String contentType) throws SonicRespException; | ||
|
||
//source handler. | ||
String pageSource() throws SonicRespException; | ||
|
||
//siri handler. | ||
void sendSiriCommand(String command) throws SonicRespException; | ||
|
||
//app handler. | ||
void appActivate(String bundleId) throws SonicRespException; | ||
|
||
boolean appTerminate(String bundleId) throws SonicRespException; | ||
|
||
void appRunBackground(int duration) throws SonicRespException; | ||
|
||
void appAuthReset(int resource) throws SonicRespException; | ||
|
||
//element handler. | ||
void setDefaultFindElementInterval(Integer retry, Integer interval); | ||
|
||
WebElement findElement(String selector, String value, Integer retry, Integer interval) throws SonicRespException; | ||
|
||
List<WebElement> findElementList(String selector, String value, Integer retry, Integer interval) throws SonicRespException; | ||
|
||
//screen handler. | ||
byte[] screenshot() throws SonicRespException; | ||
|
||
//appium setting handler. | ||
void setAppiumSettings(JSONObject settings) throws SonicRespException; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters