Skip to content

Commit 461fdfd

Browse files
committed
Improve interop with RemoteWebDriver
Also included: * now logging with slf4j * improve error messages * bump dep versions
1 parent f7c9fd5 commit 461fdfd

File tree

6 files changed

+299
-53
lines changed

6 files changed

+299
-53
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@ Add the following line(s) to the dependencies section in your
2222
<dependency>
2323
<groupId>ai.test.sdk</groupId>
2424
<artifactId>test-ai-selenium</artifactId>
25-
<version>0.0.2</version>
25+
<version>0.1.0</version>
2626
</dependency>
2727
````
2828

2929
**build.gradle (Gradle)**
3030
```groovy
31-
implementation 'ai.test.sdk:test-ai-selenium:0.0.2'
31+
implementation 'ai.test.sdk:test-ai-selenium:0.1.0'
3232
```
3333

3434
## Tutorial

build.gradle

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,19 @@ plugins {
88

99
description="${project.name} build script"
1010
group="ai.test.sdk"
11-
version="0.0.2"
11+
version="0.1.0"
1212

1313

1414
repositories {
15+
mavenLocal()
1516
mavenCentral()
1617
}
1718

1819
dependencies {
20+
api 'com.google.code.gson:gson:2.9.0'
1921
api 'com.squareup.okhttp3:okhttp:4.9.3'
20-
api 'com.google.code.gson:gson:2.8.9'
2122
api 'org.seleniumhq.selenium:selenium-java:3.141.59'
23+
api 'org.slf4j:slf4j-api:1.7.36'
2224

2325
testImplementation 'org.junit.jupiter:junit-jupiter:5.7.2'
2426
}

src/main/java/ai/test/sdk/CollectionUtils.java

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -25,37 +25,4 @@ public static HashMap<String, String> keyValuesToHM(String... sl)
2525

2626
return m;
2727
}
28-
29-
/**
30-
* Simple Tuple implementation. A Tuple is an immutable two-pair of values. It may consist of any two Objects, which may or may not be in of the same type.
31-
*
32-
* @author Alexander Wu (alec@test.ai)
33-
*
34-
* @param <K> The type of Object allowed for the first Object in the tuple.
35-
* @param <V> The type of Object allowed for the second Object in the tuple.
36-
*/
37-
public static class Tuple<K, V>
38-
{
39-
/**
40-
* The k value of the tuple
41-
*/
42-
public final K k;
43-
44-
/**
45-
* The y value of the tuple
46-
*/
47-
public final V v;
48-
49-
/**
50-
* Constructor, creates a new Tuple from the specified values.
51-
*
52-
* @param k The first entry in the Tuple.
53-
* @param v The second entry in the Tuple.
54-
*/
55-
public Tuple(K k, V v)
56-
{
57-
this.k = k;
58-
this.v = v;
59-
}
60-
}
6128
}

src/main/java/ai/test/sdk/JsonUtils.java

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
package ai.test.sdk;
22

3+
import org.slf4j.Logger;
4+
import org.slf4j.LoggerFactory;
5+
36
import com.google.gson.JsonObject;
47
import com.google.gson.JsonParser;
58

@@ -13,6 +16,10 @@
1316
*/
1417
final class JsonUtils
1518
{
19+
/**
20+
* The logger for this class
21+
*/
22+
private static Logger log = LoggerFactory.getLogger(JsonUtils.class);
1623

1724
/**
1825
* Convenience method, extract the body of a {@code Response} as a {@code JsonObject}.
@@ -24,10 +31,10 @@ public static JsonObject responseAsJson(Response r)
2431
{
2532
try
2633
{
27-
String b = r.body().string();
28-
// System.err.printf("%d ---- %s%n", r.code(), b);
34+
String body = r.body().string();
35+
log.debug("Status: {} ----- Body: {}", r.code(), body);
2936

30-
return JsonParser.parseString(b).getAsJsonObject();
37+
return JsonParser.parseString(body).getAsJsonObject();
3138
}
3239
catch (Throwable e)
3340
{

0 commit comments

Comments
 (0)