Skip to content

Commit 09140a2

Browse files
jkebingerclaude
andauthored
Update to reforge.com hosts and v2 API endpoints (#4)
* Update to reforge.com hosts * Update API endpoints from v1 to v2 and fix corresponding tests - Update HttpClient to use /api/v2/ endpoints for SSE config and configs - Fix HttpClientTest to expect v2 URLs instead of hardcoded v1 URLs - Remove unnecessary header mocks from 304 response tests 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent 828d501 commit 09140a2

5 files changed

Lines changed: 14 additions & 15 deletions

File tree

sdk/src/main/java/com/reforge/sdk/Options.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@
1919

2020
public class Options {
2121

22-
static final String DEFAULT_TELEMETRY_HOST = "https://telemetry.prefab.cloud";
22+
static final String DEFAULT_TELEMETRY_HOST = "https://telemetry.reforge.com";
2323
static final List<String> DEFAULT_API_HOSTS = List.of(
24-
"https://belt.prefab.cloud",
25-
"https://suspenders.prefab.cloud"
24+
"https://primary.reforge.com",
25+
"https://secondary.reforge.com"
2626
);
27-
static final List<String> DEFAULT_STREAM_HOSTS = List.of("https://stream.prefab.cloud");
27+
static final List<String> DEFAULT_STREAM_HOSTS = List.of("https://stream.reforge.com");
2828

2929
private List<String> apiHosts = DEFAULT_API_HOSTS;
3030
private String telemetryHost = DEFAULT_TELEMETRY_HOST;

sdk/src/main/java/com/reforge/sdk/internal/HttpClient.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ public CompletableFuture<HttpResponse<Void>> createSSEConfigConnection(
185185
) {
186186
return executeWithFailover(
187187
host -> {
188-
URI uri = URI.create(host + "/api/v1/sse/config");
188+
URI uri = URI.create(host + "/api/v2/sse/config");
189189
LOG.info("Requesting SSE from {}", uri);
190190
HttpRequest request = getClientBuilderWithStandardHeaders()
191191
.header("Accept", EVENT_STREAM_MEDIA_TYPE)
@@ -212,7 +212,7 @@ public CompletableFuture<HttpResponse<Supplier<Prefab.Configs>>> requestConfigs(
212212
) {
213213
return executeWithFailover(
214214
host -> {
215-
URI uri = URI.create(host + "/api/v1/configs/" + offset);
215+
URI uri = URI.create(host + "/api/v2/configs/" + offset);
216216
return requestConfigsFromURI(uri);
217217
},
218218
apiHosts

sdk/src/test/java/com/reforge/sdk/OptionsTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ public class OptionsTest {
1111
public void testTelemetryDomain() {
1212
Options options = new Options();
1313
assertThat(options.getPrefabTelemetryHost())
14-
.isEqualTo("https://telemetry.prefab.cloud");
14+
.isEqualTo("https://telemetry.reforge.com");
1515

1616
options = new Options().setPrefabTelemetryHost("http://staging-prefab.cloud");
1717
assertThat(options.getPrefabTelemetryHost()).isEqualTo("http://staging-prefab.cloud");

sdk/src/test/java/com/reforge/sdk/integration/BaseIntegrationTestCaseDescriptor.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,9 @@ private Sdk buildClient(IntegrationTestClientOverrides clientOverrides) {
8585

8686
Options options = new Options()
8787
.setApikey(apiKey)
88-
.setPrefabTelemetryHost("https://telemetry.staging-prefab.cloud")
89-
.setApiHosts(List.of("https://api.staging-prefab.cloud"))
90-
.setStreamHosts(List.of("https://stream.staging-prefab.cloud"))
88+
.setPrefabTelemetryHost("https://telemetry.goatsofreforge.com")
89+
.setApiHosts(List.of("https://api.goatsofreforge.com"))
90+
.setStreamHosts(List.of("https://stream.goatsofreforge.com"))
9191
.setInitializationTimeoutSec(2000);
9292
clientOverrides
9393
.getInitTimeoutSeconds()

sdk/src/test/java/com/reforge/sdk/internal/HttpClientTest.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ void testConditionalGet304() throws Exception {
180180
// Use a time far enough in the past to ensure expiration.
181181
long past = System.currentTimeMillis() - 10_000;
182182

183-
URI uri = URI.create("http://a.example.com/api/v1/configs/0");
183+
URI uri = URI.create("http://a.example.com/api/v2/configs/0");
184184
Field cacheField = HttpClient.class.getDeclaredField("configCache");
185185
cacheField.setAccessible(true);
186186
@SuppressWarnings("unchecked")
@@ -194,7 +194,7 @@ void testConditionalGet304() throws Exception {
194194
);
195195
cache.put(uri, expiredEntry);
196196

197-
// Mark the stubbing for sendAsync as lenient so that if its not invoked, we dont fail.
197+
// Mark the stubbing for sendAsync as lenient so that if it's not invoked, we don't fail.
198198
HttpResponse<byte[]> httpResponse304 = mock(HttpResponse.class);
199199
when(httpResponse304.statusCode()).thenReturn(304);
200200

@@ -305,7 +305,7 @@ void testNoCacheResponseAlwaysRevalidates() throws Exception {
305305
)
306306
.thenReturn(future200);
307307

308-
// Invoke the request (using offset 0L, yielding a URL like "http://a.example.com/api/v1/configs/0").
308+
// Invoke the request (using offset 0L, yielding a URL like "http://a.example.com/api/v2/configs/0").
309309
CompletableFuture<HttpResponse<Supplier<Prefab.Configs>>> firstCall = prefabHttpClient.requestConfigs(
310310
0L
311311
);
@@ -316,7 +316,7 @@ void testNoCacheResponseAlwaysRevalidates() throws Exception {
316316
assertThat(resp1.headers().firstValue("X-Cache")).contains("MISS");
317317

318318
// Retrieve the cached entry.
319-
URI uri = URI.create("http://a.example.com/api/v1/configs/0");
319+
URI uri = URI.create("http://a.example.com/api/v2/configs/0");
320320
Field cacheField = HttpClient.class.getDeclaredField("configCache");
321321
cacheField.setAccessible(true);
322322
@SuppressWarnings("unchecked")
@@ -331,7 +331,6 @@ void testNoCacheResponseAlwaysRevalidates() throws Exception {
331331
// Now simulate a 304 Not Modified response on a subsequent request.
332332
HttpResponse<byte[]> response304 = mock(HttpResponse.class);
333333
when(response304.statusCode()).thenReturn(304);
334-
HttpHeaders headers304 = HttpHeaders.of(Map.of(), (k, v) -> true);
335334
CompletableFuture<HttpResponse<byte[]>> future304 = CompletableFuture.completedFuture(
336335
response304
337336
);

0 commit comments

Comments
 (0)