Skip to content

Commit 4c15e2f

Browse files
authored
Merge branch 'master' into patch-2
2 parents 83cdc34 + 5b1f5c4 commit 4c15e2f

5 files changed

Lines changed: 21 additions & 4 deletions

File tree

src/main/java/com/appium/android/AndroidDeviceConfiguration.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public AndroidDeviceConfiguration() {
2626
}
2727

2828
/*
29-
* This method gets the device model name
29+
* This method gets the device model name..
3030
*/
3131
public String getDeviceModel() {
3232
AppiumDevice getModel = getDevice();

src/main/java/com/appium/manager/AppiumDevice.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,10 +76,13 @@ public boolean isLocalDevice() {
7676
}
7777

7878
public boolean isAvailable() {
79+
System.out.println("inside isAvailable");
7980
return deviceState.equalsIgnoreCase(AVAILABLE);
8081
}
8182

8283
public void blockDevice() {
84+
System.out.println("inside blockDevice");
85+
8386
deviceState = BUSY;
8487
}
8588

src/main/java/com/appium/manager/AppiumDriverManager.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ private AppiumDriver<MobileElement> initialiseDriver(DesiredCapabilities desired
5959
private AppiumDriver createAppiumDriver(DesiredCapabilities desiredCapabilities,
6060
String remoteWDHubIP)
6161
throws MalformedURLException {
62+
System.out.println("inside createAppiumDriver");
6263
AppiumDriver currentDriverSession;
6364
MobilePlatform mobilePlatform = getMobilePlatform();
6465
switch (mobilePlatform) {
@@ -95,6 +96,8 @@ private AppiumDriver<MobileElement> startAppiumDriverInstance(
9596
Optional<DesiredCapabilities> desiredCapabilities)
9697
throws Exception {
9798
LOGGER.info("startAppiumDriverInstance");
99+
System.out.println("inside ATD:beforeInvocation");
100+
LOGGER.info("startAppiumDriverInstance: capabilities: " + desiredCapabilities);
98101
AppiumDriver<MobileElement> currentDriverSession =
99102
initialiseDriver(desiredCapabilities.get());
100103
AppiumDriverManager.setDriver(currentDriverSession);
@@ -105,6 +108,7 @@ private AppiumDriver<MobileElement> startAppiumDriverInstance(
105108
public AppiumDriver<MobileElement> startAppiumDriverInstance(String testMethodName)
106109
throws Exception {
107110
LOGGER.info("startAppiumDriverInstance");
111+
System.out.println("inside startAppiumDriverInstance");
108112
return startAppiumDriverInstance(
109113
Optional.ofNullable(buildDesiredCapabilities(testMethodName, CAPS.get())));
110114
}
@@ -152,4 +156,4 @@ public void stopAppiumDriver() throws Exception {
152156
AppiumDriverManager.getDriver().quit();
153157
}
154158
}
155-
}
159+
}

src/main/java/com/appium/manager/AppiumParallelMethodTestListener.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ private void startReportLogging(ITestResult iTestResult) throws IOException,
9393
*/
9494
@Override
9595
public void beforeInvocation(IInvokedMethod iInvokedMethod, ITestResult iTestResult) {
96+
System.out.println("inside ATD:beforeInvocation");
9697
String testMethodName = iInvokedMethod.getTestMethod().getMethodName();
9798
allocateDeviceAndStartDriver(testMethodName, iTestResult);
9899
if (!isCloudExecution()) {
@@ -121,6 +122,7 @@ public void beforeInvocation(IInvokedMethod iInvokedMethod, ITestResult iTestRes
121122

122123
private void allocateDeviceAndStartDriver(String testMethodName, ITestResult iTestResult) {
123124
try {
125+
System.out.println("inside start of ATD:allocateDeviceAndStartDriver");
124126
AppiumDriver driver = AppiumDriverManager.getDriver();
125127
if (driver == null || driver.getSessionId() == null) {
126128
deviceAllocationManager.allocateDevice(deviceAllocationManager
@@ -133,6 +135,8 @@ private void allocateDeviceAndStartDriver(String testMethodName, ITestResult iTe
133135
} catch (Exception e) {
134136
e.printStackTrace();
135137
}
138+
System.out.println("inside end of ATD:allocateDeviceAndStartDriver");
139+
136140
}
137141

138142
/*
@@ -158,8 +162,10 @@ public void afterInvocation(IInvokedMethod iInvokedMethod, ITestResult iTestResu
158162
}
159163
}
160164
if (iInvokedMethod.isTestMethod()) {
161-
AppiumDriverManager.getDriver().quit();
165+
System.out.println("Releasing the Device");
162166
deviceAllocationManager.freeDevice();
167+
AppiumDriverManager.getDriver().quit();
168+
System.out.println("Releasing the Device Done");
163169
if (!isCloudExecution()) {
164170
appiumDriverManager.stopAppiumDriver();
165171
}

src/main/java/com/appium/manager/DeviceAllocationManager.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,15 @@ public List<AppiumDevice> getDevices() {
4848

4949
public synchronized AppiumDevice getNextAvailableDevice() {
5050
int i = 0;
51+
System.out.println("inside getNextAvailableDevice");
52+
5153
for (AppiumDevice device : allDevices) {
5254
Thread t = Thread.currentThread();
5355
t.setName("Thread_" + i);
5456
i++;
55-
if (device.isAvailable()) {
57+
boolean flag =device.isAvailable();
58+
System.out.println("isDevice available : "+flag);
59+
if (flag) {
5660
device.blockDevice();
5761
return device;
5862
}

0 commit comments

Comments
 (0)