Skip to content

Commit

Permalink
Restructure common-service port usage
Browse files Browse the repository at this point in the history
  • Loading branch information
ayeshLK committed Aug 7, 2024
1 parent e5132d8 commit 4dfbdc8
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 10 deletions.
2 changes: 1 addition & 1 deletion ballerina/tests/additional_external_error_data_test.bal
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import ballerina/test;
listener Listener additionalErrorDetailsListener = new (SUB_WITH_ADDITIONAL_ERRDETAILS_PORT);

SubscriberService serviceWithAdditionalErrorDetails = @SubscriberServiceConfig {
target: "http://0.0.0.0:9191/common/discovery",
target: string `http://0.0.0.0:${COMMON_HUB_SVC_PORT}/common/discovery`,
leaseSeconds: 36000,
unsubscribeOnShutdown: false
}
Expand Down
2 changes: 1 addition & 1 deletion ballerina/tests/basic_subscriber_test.bal
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import ballerina/mime;

listener Listener basicSubscriberListener = new (BASIC_SUB_PORT);

SubscriberService simpleSubscriberService = @SubscriberServiceConfig { target: "http://0.0.0.0:9191/common/discovery", leaseSeconds: 36000, unsubscribeOnShutdown: false }
SubscriberService simpleSubscriberService = @SubscriberServiceConfig { target: string `http://0.0.0.0:${COMMON_HUB_SVC_PORT}/common/discovery`, leaseSeconds: 36000, unsubscribeOnShutdown: false }
service object {
isolated remote function onSubscriptionValidationDenied(SubscriptionDeniedError msg) returns Acknowledgement? {
log:printDebug("onSubscriptionValidationDenied invoked");
Expand Down
2 changes: 1 addition & 1 deletion ballerina/tests/default_method_impl_test.bal
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import ballerina/http;

listener Listener serviceWithDefaultImplListener = new (SUB_WITH_DFLT_METHODS_PORT);

SubscriberService serviceWithDefaultImpl = @SubscriberServiceConfig { target: "http://0.0.0.0:9191/common/discovery", leaseSeconds: 36000, secret: "Kslk30SNF2AChs2", unsubscribeOnShutdown: false }
SubscriberService serviceWithDefaultImpl = @SubscriberServiceConfig { target: string `http://0.0.0.0:${COMMON_HUB_SVC_PORT}/common/discovery`, leaseSeconds: 36000, secret: "Kslk30SNF2AChs2", unsubscribeOnShutdown: false }
service object {
isolated remote function onEventNotification(ContentDistributionMessage event)
returns Acknowledgement|SubscriptionDeletedError? {
Expand Down
2 changes: 1 addition & 1 deletion ballerina/tests/subscriber_with_error_return_types.bal
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import ballerina/mime;

listener Listener errorReturnsSubscriberListener = new (SUB_WITH_ERROR_RTRN_PORT);

SubscriberService subscriberWithErrorReturns = @SubscriberServiceConfig { target: "http://0.0.0.0:9191/common/discovery", leaseSeconds: 36000, unsubscribeOnShutdown: false }
SubscriberService subscriberWithErrorReturns = @SubscriberServiceConfig { target: string `http://0.0.0.0:${COMMON_HUB_SVC_PORT}/common/discovery`, leaseSeconds: 36000, unsubscribeOnShutdown: false }
service object {
isolated remote function onSubscriptionValidationDenied(SubscriptionDeniedError msg) returns error? {
return error ("Error occured while processing request");
Expand Down
4 changes: 2 additions & 2 deletions ballerina/tests/test_init.bal
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@
import ballerina/test;
import ballerina/http;

listener http:Listener simpleHttpServiceListener = new (9191);
listener http:Listener simpleHttpServiceListener = new (COMMON_HUB_SVC_PORT);

http:Service simpleHttpService = service object {
isolated resource function get discovery(http:Caller caller, http:Request request) returns error? {
http:Response response = new;
response.addHeader("Link", "<http://127.0.0.1:9191/common/hub>; rel=\"hub\"");
response.addHeader("Link", string `<http://127.0.0.1:${COMMON_HUB_SVC_PORT}/common/hub>; rel=\"hub\"`);
response.addHeader("Link", "<https://sample.topic.com>; rel=\"self\"");
check caller->respond(response);
}
Expand Down
6 changes: 4 additions & 2 deletions ballerina/tests/test_ports.bal
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@
// specific language governing permissions and limitations
// under the License.

const int COMMON_HUB_SVC_PORT = 1;

// Ports related to subscriber services
const int BASE_PORT = 9400;
const int BASIC_SUB_PORT = BASE_PORT + 1;
const int SUB_WITH_DFLT_METHODS_PORT = BASE_PORT + 2;
Expand All @@ -32,3 +31,6 @@ const int ISOLATED_SUB_PORT = BASE_PORT + 12;
const int SUB_WITH_RO_PARAMS_PORT = BASE_PORT + 13;
const int SUB_INIT_RCS_DISCOVERY_PORT = BASE_PORT + 14;
const int SUB_INIT_FAILURE_PORT = BASE_PORT + 15;

// Ports related to hub services
const int COMMON_HUB_SVC_PORT = 9500;
2 changes: 1 addition & 1 deletion ballerina/tests/utils_test.bal
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ isolated function testContentHashError() returns error? {
}
}

SubscriberService validSubscriberServiceDeclaration = @SubscriberServiceConfig { target: "http://0.0.0.0:9191/common/discovery", leaseSeconds: 36000, unsubscribeOnShutdown: false }
SubscriberService validSubscriberServiceDeclaration = @SubscriberServiceConfig { target: string `http://0.0.0.0:${COMMON_HUB_SVC_PORT}/common/discovery`, leaseSeconds: 36000, unsubscribeOnShutdown: false }
service object {
isolated remote function onEventNotification(ContentDistributionMessage event)
returns Acknowledgement|SubscriptionDeletedError? {
Expand Down
2 changes: 1 addition & 1 deletion ballerina/tests/websub_config_manual_attach_test.bal
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ SimpleWebsubService simpleSubscriberServiceInstace = new;
@test:BeforeGroups { value:["manualConfigAttach"] }
function beforeManualConfigAttachTest() returns error? {
SubscriberServiceConfiguration config = {
target: "http://0.0.0.0:9191/common/discovery",
target: string `http://0.0.0.0:${COMMON_HUB_SVC_PORT}/common/discovery`,
leaseSeconds: 36000,
unsubscribeOnShutdown: false
};
Expand Down

0 comments on commit 4dfbdc8

Please sign in to comment.