Skip to content

Commit f91c412

Browse files
committed
update service registry client
1 parent a780297 commit f91c412

4 files changed

Lines changed: 70 additions & 3 deletions

File tree

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/*
2+
* Copyright 2025 Conductor Authors.
3+
* <p>
4+
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
5+
* the License. You may obtain a copy of the License at
6+
* <p>
7+
* http://www.apache.org/licenses/LICENSE-2.0
8+
* <p>
9+
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
10+
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
11+
* specific language governing permissions and limitations under the License.
12+
*/
13+
package com.netflix.conductor.common.model;
14+
15+
import lombok.AllArgsConstructor;
16+
import lombok.Data;
17+
import lombok.NoArgsConstructor;
18+
19+
@Data
20+
@AllArgsConstructor
21+
@NoArgsConstructor
22+
public class AuthMetadata {
23+
private String key;
24+
private String value;
25+
}

conductor-client/src/main/java/com/netflix/conductor/common/model/ServiceMethod.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,13 @@ public class ServiceMethod {
2323
private Long id;
2424
private String operationName;
2525
private String methodName;
26-
private String methodType; //GET, PUT, POST, UNARY, SERVER_STREAMING etc.
26+
private String methodType; // GET, PUT, POST, UNARY, SERVER_STREAMING etc.
2727
private String inputType;
2828
private String outputType;
29+
private Boolean deprecated;
30+
private String requestContentType;
31+
private String responseContentType;
32+
private String description;
2933

3034
// Add request parameters
3135
private List<RequestParam> requestParams = new ArrayList<>();

conductor-client/src/main/java/com/netflix/conductor/common/model/ServiceRegistry.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ public class ServiceRegistry {
3131
private List<RequestParam> requestParams = new ArrayList<>();
3232
private Config config = new Config();
3333
private boolean circuitBreakerEnabled = false;
34+
private AuthMetadata authMetadata;
35+
private List<ServerUrlConfig> servers = new ArrayList<>();
3436

3537
public enum Type {
3638
HTTP, gRPC, MCP_REMOTE
@@ -42,4 +44,17 @@ public enum Type {
4244
public static class Config {
4345
private OrkesCircuitBreakerConfig circuitBreakerConfig = new OrkesCircuitBreakerConfig();
4446
}
47+
48+
public enum ServerSource {
49+
OPENAPI_SPEC,
50+
USER_DEFINED
51+
}
52+
53+
@Data
54+
@AllArgsConstructor
55+
@NoArgsConstructor
56+
public static class ServerUrlConfig {
57+
private String url;
58+
private ServerSource type;
59+
}
4560
}

tests/src/test/java/io/orkes/conductor/client/http/ServiceRegistryClientTests.java

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,17 @@ void testBasicCRUDOperations() {
6565
service.setType(ServiceRegistry.Type.gRPC);
6666
service.setServiceURI(SERVICE_URI);
6767

68+
// Set AuthMetadata and Servers
69+
com.netflix.conductor.common.model.AuthMetadata authMetadata = new com.netflix.conductor.common.model.AuthMetadata();
70+
authMetadata.setKey("Authorization");
71+
authMetadata.setValue("Bearer token");
72+
service.setAuthMetadata(authMetadata);
73+
74+
ServiceRegistry.ServerUrlConfig serverUrlConfig = new ServiceRegistry.ServerUrlConfig();
75+
serverUrlConfig.setUrl("http://localhost:8080");
76+
serverUrlConfig.setType(ServiceRegistry.ServerSource.USER_DEFINED);
77+
service.setServers(List.of(serverUrlConfig));
78+
6879
serviceRegistryClient.addOrUpdateService(service);
6980

7081
// Get the service
@@ -74,6 +85,17 @@ void testBasicCRUDOperations() {
7485
Assertions.assertEquals(SERVICE_URI, retrieved.getServiceURI());
7586
Assertions.assertEquals(ServiceRegistry.Type.gRPC, retrieved.getType());
7687

88+
// Verify AuthMetadata
89+
Assertions.assertNotNull(retrieved.getAuthMetadata());
90+
Assertions.assertEquals("Authorization", retrieved.getAuthMetadata().getKey());
91+
Assertions.assertEquals("Bearer token", retrieved.getAuthMetadata().getValue());
92+
93+
// Verify Servers
94+
Assertions.assertNotNull(retrieved.getServers());
95+
Assertions.assertEquals(1, retrieved.getServers().size());
96+
Assertions.assertEquals("http://localhost:8080", retrieved.getServers().get(0).getUrl());
97+
Assertions.assertEquals(ServiceRegistry.ServerSource.USER_DEFINED, retrieved.getServers().get(0).getType());
98+
7799
// Verify it appears in list
78100
List<ServiceRegistry> services = serviceRegistryClient.getRegisteredServices();
79101
Assertions.assertTrue(services.stream().anyMatch(s -> s.getName().equals(SERVICE_NAME)));
@@ -167,6 +189,7 @@ void testServiceMethodOperations() {
167189
method.setMethodType("UNARY");
168190
method.setInputType("TestRequest");
169191
method.setOutputType("TestResponse");
192+
method.setDescription("Test method description");
170193

171194
// Add method
172195
serviceRegistryClient.addOrUpdateServiceMethod(SERVICE_NAME, method);
@@ -193,8 +216,8 @@ void testDiscoverMethods() {
193216
serviceRegistryClient.addOrUpdateService(service);
194217

195218
byte[] protoData = getClass().getClassLoader()
196-
.getResourceAsStream("compiled.bin")
197-
.readAllBytes();
219+
.getResourceAsStream("compiled.bin")
220+
.readAllBytes();
198221

199222
serviceRegistryClient.addOrUpdateService(service);
200223
serviceRegistryClient.setProtoData(SERVICE_NAME, PROTO_FILENAME, protoData);

0 commit comments

Comments
 (0)