diff --git a/ballerina/tests/additional_external_error_data_test.bal b/ballerina/tests/additional_external_error_data_test.bal index ad38300b..c837d26d 100644 --- a/ballerina/tests/additional_external_error_data_test.bal +++ b/ballerina/tests/additional_external_error_data_test.bal @@ -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 } diff --git a/ballerina/tests/basic_subscriber_test.bal b/ballerina/tests/basic_subscriber_test.bal index f232d93c..5dfa085a 100644 --- a/ballerina/tests/basic_subscriber_test.bal +++ b/ballerina/tests/basic_subscriber_test.bal @@ -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"); diff --git a/ballerina/tests/default_method_impl_test.bal b/ballerina/tests/default_method_impl_test.bal index ca975adc..4fbd6283 100644 --- a/ballerina/tests/default_method_impl_test.bal +++ b/ballerina/tests/default_method_impl_test.bal @@ -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? { diff --git a/ballerina/tests/subscriber_with_error_return_types.bal b/ballerina/tests/subscriber_with_error_return_types.bal index ab2d7e02..bbfb9d9c 100644 --- a/ballerina/tests/subscriber_with_error_return_types.bal +++ b/ballerina/tests/subscriber_with_error_return_types.bal @@ -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"); diff --git a/ballerina/tests/test_init.bal b/ballerina/tests/test_init.bal index f0b14aff..b176a527 100644 --- a/ballerina/tests/test_init.bal +++ b/ballerina/tests/test_init.bal @@ -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", "; rel=\"hub\""); + response.addHeader("Link", string `; rel=\"hub\"`); response.addHeader("Link", "; rel=\"self\""); check caller->respond(response); } diff --git a/ballerina/tests/test_ports.bal b/ballerina/tests/test_ports.bal index 31139ce4..b69dd9a4 100644 --- a/ballerina/tests/test_ports.bal +++ b/ballerina/tests/test_ports.bal @@ -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; @@ -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; diff --git a/ballerina/tests/utils_test.bal b/ballerina/tests/utils_test.bal index b76eb503..30aa34fa 100644 --- a/ballerina/tests/utils_test.bal +++ b/ballerina/tests/utils_test.bal @@ -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? { diff --git a/ballerina/tests/websub_config_manual_attach_test.bal b/ballerina/tests/websub_config_manual_attach_test.bal index 65071960..8a44c58f 100644 --- a/ballerina/tests/websub_config_manual_attach_test.bal +++ b/ballerina/tests/websub_config_manual_attach_test.bal @@ -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 };