Skip to content

Commit

Permalink
Fix examples
Browse files Browse the repository at this point in the history
  • Loading branch information
ldclakmal committed Jul 31, 2023
1 parent fe69838 commit 94f6391
Show file tree
Hide file tree
Showing 13 changed files with 18 additions and 19 deletions.
2 changes: 1 addition & 1 deletion examples/email/scripts/email.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ source scripts/assert.sh
docker-compose -f resources/docker-compose.yml up &
sleep 30s
bal run imap_email_listener_tls.bal &
sleep 10s
sleep 20s
response=$(bal run smtp_email_client_tls.bal 2>&1 | tail -n 1)
assertNotEmpty "$response"
assertEquals "$response" "Email sent successfully."
2 changes: 1 addition & 1 deletion examples/ftp/scripts/ftp.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ source scripts/assert.sh
docker-compose -f resources/docker-compose.yml up &
sleep 30s
bal run sftp_listener_credentials_auth.bal &
sleep 10s
sleep 20s
response=$(bal run sftp_client_credentials_auth.bal 2>&1 | tail -n 1)
assertNotEmpty "$response"
assertEquals "$response" "File: /upload/sample.txt"
2 changes: 1 addition & 1 deletion examples/grpc/scripts/grpc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ bal grpc --input resources/grpc.proto --output client/

bal build service
bal run service/target/bin/service.jar &
sleep 10s
sleep 20s
bal build client
response=$(bal run client/target/bin/client.jar 2>&1 | tail -n 1)
assertNotEmpty "$response"
Expand Down
5 changes: 2 additions & 3 deletions examples/grpc/service/grpc_service_jwt_auth.bal
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,8 @@ listener grpc:Listener securedEP = new (9090,
}
]
}
@grpc:ServiceDescriptor {
descriptor: ROOT_DESCRIPTOR_GRPC,
descMap: getDescriptorMapGrpc()
@grpc:Descriptor {
value: GRPC_DESC
}
isolated service "HelloWorld" on securedEP {
isolated remote function hello() returns string {
Expand Down
2 changes: 1 addition & 1 deletion examples/http/scripts/http.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
source scripts/assert.sh

bal run http_service_jwt_auth.bal &
sleep 10s
sleep 20s
response=$(bal run http_client_self_signed_jwt_auth.bal 2>&1 | tail -n 1)
assertNotEmpty "$response"
assertEquals "$response" "Hello, World!"
2 changes: 1 addition & 1 deletion examples/kafka/scripts/kafka.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ source scripts/assert.sh
docker-compose -f resources/docker-compose.yml up &
sleep 60s
bal run kafka_consumer_sasl_plain_auth.bal &
sleep 10s
sleep 20s
response=$(bal run kafka_producer_sasl_plain_auth.bal 2>&1 | tail -n 1)
assertNotEmpty "$response"
assertEquals "$response" "Message published successfully."
2 changes: 1 addition & 1 deletion examples/nats/scripts/nats.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ source scripts/assert.sh
docker-compose -f resources/docker-compose.yml up &
sleep 30s
bal run nats_subscriber_credentials_auth.bal &
sleep 10s
sleep 20s
response=$(bal run nats_publisher_credentials_auth.bal 2>&1 | tail -n 1)
assertNotEmpty "$response"
assertEquals "$response" "Message published successfully."
2 changes: 1 addition & 1 deletion examples/rabbitmq/scripts/rabbitmq.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ source scripts/assert.sh
docker-compose -f resources/docker-compose.yml up &
sleep 60s
bal run rabbitmq_consumer_credentials_auth.bal &
sleep 10s
sleep 20s
response=$(bal run rabbitmq_producer_credentials_auth.bal 2>&1 | tail -n 1)
assertNotEmpty "$response"
assertEquals "$response" "Message published successfully."
2 changes: 1 addition & 1 deletion examples/stan/scripts/stan.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ source scripts/assert.sh
docker-compose -f resources/docker-compose.yml up &
sleep 30s
bal run stan_subscriber_credentials_auth.bal &
sleep 10s
sleep 20s
response=$(bal run stan_publisher_credentials_auth.bal 2>&1 | tail -n 1)
assertNotEmpty "$response"
assertEquals "$response" "Message published successfully."
2 changes: 1 addition & 1 deletion examples/tcp/scripts/tcp.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
source scripts/assert.sh

bal run tcp_listener_tls.bal &
sleep 10s
sleep 20s
response=$(bal run tcp_client_tls.bal 2>&1 | tail -n 1)
assertNotEmpty "$response"
assertEquals "$response" "Received message: Hello, World!"
2 changes: 1 addition & 1 deletion examples/websocket/scripts/websocket.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
source scripts/assert.sh

bal run websocket_service_jwt_auth.bal &
sleep 10s
sleep 20s
response=$(bal run websocket_client_self_signed_jwt_auth.bal 2>&1 | tail -n 1)
assertNotEmpty "$response"
assertEquals "$response" "Hello, World!"
4 changes: 2 additions & 2 deletions examples/websub/scripts/websub.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
source scripts/assert.sh

bal run websub_hub_service_jwt_auth.bal &
sleep 10s
sleep 20s
bal run websub_subscriber_service_jwt_auth.bal &
sleep 10s
sleep 20s
response=$(bal run websub_publisher_client_jwt_auth.bal 2>&1 | tail -n 1)
assertNotEmpty "$response"
assertEquals "$response" "Publish update successful."
8 changes: 4 additions & 4 deletions examples/websub/websub_hub_service_jwt_auth.bal
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ isolated service /websubhub on securedHub {
isolated remote function onRegisterTopic(websubhub:TopicRegistration msg, http:Headers headers) returns websubhub:TopicRegistrationSuccess|websubhub:TopicRegistrationError {
string? auth = doAuth(headers);
if auth is string {
return error websubhub:TopicRegistrationError(auth);
return websubhub:TOPIC_REGISTRATION_ERROR;
}
log:printInfo("Registered topic: '" + msg.topic + "'.");
websubhub:TopicRegistrationSuccess result = {
Expand All @@ -44,7 +44,7 @@ isolated service /websubhub on securedHub {
isolated remote function onDeregisterTopic(websubhub:TopicDeregistration msg, http:Headers headers) returns websubhub:TopicDeregistrationSuccess|websubhub:TopicDeregistrationError {
string? auth = doAuth(headers);
if auth is string {
return error websubhub:TopicDeregistrationError(auth);
return websubhub:TOPIC_DEREGISTRATION_ERROR;
}
log:printInfo("Deregistered topic: '" + msg.topic + "'.");
websubhub:TopicDeregistrationSuccess result = {
Expand All @@ -56,7 +56,7 @@ isolated service /websubhub on securedHub {
isolated remote function onSubscription(websubhub:Subscription msg, http:Headers headers) returns websubhub:SubscriptionAccepted|websubhub:InternalSubscriptionError {
string? auth = doAuth(headers);
if auth is string {
return error websubhub:InternalSubscriptionError(auth);
return websubhub:INTERNAL_SUBSCRIPTION_ERROR;
}
log:printInfo("Subscription accepted for topic: '" + msg.hubTopic + "'.");
websubhub:SubscriptionAccepted result = {
Expand Down Expand Up @@ -84,7 +84,7 @@ isolated service /websubhub on securedHub {
isolated remote function onUpdateMessage(websubhub:UpdateMessage msg, http:Headers headers) returns websubhub:Acknowledgement|websubhub:UpdateMessageError {
string? auth = doAuth(headers);
if auth is string {
return error websubhub:UpdateMessageError(auth);
return websubhub:UPDATE_MESSAGE_ERROR;
}
log:printInfo("Message updated for message type: '" + msg.msgType.toString() + "', topic: '" + msg.hubTopic +
"', content-type: '" + msg.contentType + "', content: '" + msg.content.toString() + "'.");
Expand Down

0 comments on commit 94f6391

Please sign in to comment.