Skip to content

deleteStorageFile: accept tb:// URL; fix README snippets that don't compile - #26

Merged
jochen-testingbot merged 1 commit into
masterfrom
fix/delete-storage-tb-url
Nov 10, 2026
Merged

jochen-testingbot merged 1 commit into
masterfrom
fix/delete-storage-tb-url

Conversation

@jochen-testingbot

Copy link
Copy Markdown
Contributor

Part of https://testingbot-team.atlassian.net/browse/TB-1008 (docs audit: run every SDK README snippet).

README walkthrough against Maven Central 1.1.0

I compiled a program that uses the README snippets and ran it against the live API (maven:3.9-eclipse-temurin-21).

Doesn't compile as written:

  • ArrayList<TestingbotDevice> devices = restApi.getDevices();: there is no zero-arg getDevices (only (int offset, int count) and (String platform, Boolean web)).
  • ArrayList<TestingbotDevice> devices = restApi.getAvailableDevices();: the method returns List.
  • TestingbotUser user = restApi.updateUserInfo(...): the method returns boolean.
  • The Maven snippet pins 1.0.8 (current is 1.1.0) and ends with </dependencies (no >).

Runtime bug: uploadToStorage(url) → getStorageFile(appUrl) works, but deleteStorageFile(appUrl) with the same tb://… URL fails:

TestingbotApiException: {"error":"Nothing found for tb://774a9a71e0b93321fcfb911d"}

getStorageFile strips tb://, but deleteStorageFile URL-encoded it into the path.

Changes

  • deleteStorageFile strips tb://, like getStorageFile. Bare ids still work. Added a mock test for the tb:// form.
  • README: corrected the three signatures, Maven snippet → 1.1.0 with valid XML, Java badge 1.7+ → 8+ (the pom targets 1.8).

Verification

mvn test -Dtest=TestingbotRestMockTest   -> Tests run: 79, Failures: 0
mvn install (this branch, 1.0.11-SNAPSHOT) + README walkthrough -> SUMMARY 25 ok / 25
  (getBrowsers, getDevices(0,10), getAvailableDevices, getDevice, getTests, getTest, TestingbotApiException on a bad id,
   getBuilds, getTestsForBuild, getUserInfo, getTunnels, uploadToStorage(url), getStorageFile, deleteStorageFile(tb://…),
   getStorageFiles, getAuthenticationHash, getUserKeys, getIpRanges, getTeam, getTeamMembers, getScreenshots,
   getLabTests, getLabSuites, isTunnelAlive, createTest(Map with test_environment_id))
Against 1.1.0 the same program gives 24/25: only deleteStorageFile(tb://…) fails.

I deleted the test and storage entries the walkthrough created.

Release needed (Maven Central) for the deleteStorageFile fix. That is needs-jochen. Side note: the pom on master says 1.0.11-SNAPSHOT although testingbotrest-1.1.0 is tagged and published.

deleteStorageFile(appUrl) sent DELETE /v1/storage/tb%3A%2F%2F<id> and
the API answered 'Nothing found for tb://<id>', while getStorageFile
already strips the tb:// prefix. Strip it here too (plain ids still work).

README: getDevices() has no zero-arg overload (use offset/count),
getAvailableDevices() returns List, updateUserInfo returns boolean,
the Maven snippet pinned 1.0.8 and was missing '>' on </dependencies>,
and the badge said Java 1.7+ while the build targets Java 8.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

The README contains two active code-snippet issues that prevent the documented Java examples from compiling as written.

2 open issues
What changed in this PR

Updates the Java client to support deleting storage files via tb:// URLs and refreshes README examples and dependency metadata.

Changes:

  • Normalize tb:// URLs before constructing storage deletion requests.
  • Add mock coverage for deletion using a tb:// URL.
  • Update README API examples, Java compatibility information, and Maven dependency configuration.
File Summary
src/​test/​java/​com/​testingbot/​testingbotrest/​TestingbotRestMockTest.java Adds regression coverage for deleting a storage file through a tb:// URL.
src/​main/​java/​com/​testingbot/​testingbotrest/​TestingbotREST.java Strips the tb:// prefix when building storage deletion requests.
README.md Refreshes API signatures, Java version information, and Maven metadata; two minor snippet nits remain regarding argument expressions and the undeclared user variable.

Review effort: Lite

Comment thread README.md

```java
ArrayList<TestingbotDevice> devices = restApi.getDevices();
List<TestingbotDevice> devices = restApi.getDevices(int offset, int count);

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Intentional. This README documents each method in signature style, e.g. getDevice(int deviceId), stopTest(String sessionId), getTests(int offset, int count) and getStorageFiles(int offset, int count), and this line now follows that convention. The bug fixed here is that the zero-arg getDevices() it showed does not exist at all. Converting the whole README to runnable snippets is out of scope for this PR.

Comment thread README.md

```java
TestingbotUser user = restApi.updateUserInfo(TestingBotUser);
boolean success = restApi.updateUserInfo(TestingbotUser user);

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Same as above: signature-style documentation, consistent with the rest of the README (e.g. updateTest(TestingbotTest test)). The fix is the return type (boolean, not TestingbotUser) and the class-name casing (TestingbotUser).

@jochen-testingbot
jochen-testingbot merged commit b5c0cb3 into master Nov 10, 2026
9 checks passed
Sign up for free to 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.

2 participants