-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #129 from ayeshLK/compiler_plugin
Fix identified issues in SL Alpha 5 distribution
- Loading branch information
Showing
6 changed files
with
145 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
websubhub-compiler-plugin-test/src/test/resources/ballerina_sources/sample_14/.gitignore
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
target |
7 changes: 7 additions & 0 deletions
7
websubhub-compiler-plugin-test/src/test/resources/ballerina_sources/sample_14/Ballerina.toml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
[package] | ||
org = "websubhub_test" | ||
name = "sample_14" | ||
version = "0.1.0" | ||
|
||
[build-options] | ||
observabilityIncluded = true |
98 changes: 98 additions & 0 deletions
98
websubhub-compiler-plugin-test/src/test/resources/ballerina_sources/sample_14/service.bal
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
import ballerina/websubhub as foo; | ||
import ballerina/http; | ||
import ballerina/io; | ||
|
||
listener foo:Listener securedHub = new(9090, | ||
secureSocket = { | ||
key: { | ||
certFile: "../resources/public.crt", | ||
keyFile: "../resources/private.key" | ||
} | ||
} | ||
); | ||
|
||
service /websubhub on securedHub { | ||
|
||
isolated remote function onRegisterTopic(foo:TopicRegistration message) | ||
returns foo:TopicRegistrationSuccess|foo:TopicRegistrationError { | ||
if (message.topic == "test") { | ||
return foo:TOPIC_REGISTRATION_SUCCESS; | ||
} else { | ||
return foo:TOPIC_REGISTRATION_ERROR; | ||
} | ||
} | ||
|
||
isolated remote function onDeregisterTopic(foo:TopicDeregistration message, http:Request baseRequest) | ||
returns foo:TopicDeregistrationSuccess|foo:TopicDeregistrationError { | ||
|
||
map<string> body = { isDeregisterSuccess: "true" }; | ||
foo:TopicDeregistrationSuccess deregisterResult = { | ||
body | ||
}; | ||
if (message.topic == "test") { | ||
return deregisterResult; | ||
} else { | ||
return error foo:TopicDeregistrationError("Topic Deregistration Failed!"); | ||
} | ||
} | ||
|
||
isolated remote function onUpdateMessage(foo:UpdateMessage message) | ||
returns foo:Acknowledgement|foo:UpdateMessageError { | ||
return foo:ACKNOWLEDGEMENT; | ||
} | ||
|
||
isolated remote function onSubscription(foo:Subscription msg) | ||
returns foo:SubscriptionAccepted|foo:SubscriptionPermanentRedirect|foo:SubscriptionTemporaryRedirect | ||
|foo:BadSubscriptionError|foo:InternalSubscriptionError { | ||
foo:SubscriptionAccepted successResult = { | ||
body: <map<string>>{ | ||
isSuccess: "true" | ||
} | ||
}; | ||
if (msg.hubTopic == "test") { | ||
return successResult; | ||
} else if (msg.hubTopic == "test1") { | ||
return successResult; | ||
} else { | ||
return error foo:BadSubscriptionError("Bad subscription"); | ||
} | ||
} | ||
|
||
isolated remote function onSubscriptionValidation(foo:Subscription msg) | ||
returns foo:SubscriptionDeniedError? { | ||
if (msg.hubTopic == "test1") { | ||
return error foo:SubscriptionDeniedError("Denied subscription for topic 'test1'"); | ||
} | ||
return (); | ||
} | ||
|
||
isolated remote function onSubscriptionIntentVerified(foo:VerifiedSubscription msg) { | ||
io:println("Subscription Intent verified invoked!"); | ||
} | ||
|
||
isolated remote function onUnsubscription(foo:Unsubscription msg) | ||
returns foo:UnsubscriptionAccepted|foo:BadUnsubscriptionError|foo:InternalUnsubscriptionError { | ||
if (msg.hubTopic == "test" || msg.hubTopic == "test1" ) { | ||
foo:UnsubscriptionAccepted successResult = { | ||
body: <map<string>>{ | ||
isSuccess: "true" | ||
} | ||
}; | ||
return successResult; | ||
} else { | ||
return error foo:BadUnsubscriptionError("Denied unsubscription for topic '" + <string> msg.hubTopic + "'"); | ||
} | ||
} | ||
|
||
isolated remote function onUnsubscriptionValidation(foo:Unsubscription msg) | ||
returns foo:UnsubscriptionDeniedError? { | ||
if (msg.hubTopic == "test1") { | ||
return error foo:UnsubscriptionDeniedError("Denied subscription for topic 'test1'"); | ||
} | ||
return (); | ||
} | ||
|
||
isolated remote function onUnsubscriptionIntentVerified(foo:VerifiedUnsubscription msg){ | ||
io:println("Unsubscription Intent verified invoked!"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters