Skip to content

Commit

Permalink
Add test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
ayeshLK committed Apr 30, 2024
1 parent af711cd commit d3d382a
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,17 @@ public void testCompilerPluginForListenerImplicitInitWithCheckExpr() {
Assert.assertEquals(diagnostic.message(), expectedCode.getDescription());
}

@Test
public void testCompilerPluginForListenerInitWithPortConfig() {
Package currentPackage = loadPackage("sample_25");
PackageCompilation compilation = currentPackage.getCompilation();
DiagnosticResult diagnosticResult = compilation.diagnosticResult();
List<Diagnostic> errorDiagnostics = diagnosticResult.diagnostics().stream()
.filter(d -> DiagnosticSeverity.ERROR.equals(d.diagnosticInfo().severity()))
.toList();
Assert.assertEquals(errorDiagnostics.size(), 0);
}

private Package loadPackage(String path) {
Path projectDirPath = RESOURCE_DIRECTORY.resolve(path);
BuildProject project = BuildProject.load(getEnvironmentBuilder(), projectDirPath);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[package]
org = "websub_test"
name = "sample_25"
version = "0.1.0"

[build-options]
observabilityIncluded = true
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
// Copyright (c) 2024, WSO2 LLC. (http://www.wso2.com).
//
// WSO2 LLC. licenses this file to you under the Apache License,
// Version 2.0 (the "License"); you may not use this file except
// in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.

import ballerina/websub;

configurable int port = 9090;

listener websub:Listener ln = check new(port, {
secureSocket: {
key: {
path: "tests/resources/ballerinaKeystore.pkcs12",
password: "ballerina"
}
}
});

@websub:SubscriberServiceConfig {
}
service /sample on new websub:Listener(port, {
secureSocket: {
key: {
path: "tests/resources/ballerinaKeystore.pkcs12",
password: "ballerina"
}
}
}) {
remote function onEventNotification(websub:ContentDistributionMessage event) {
return;
}
}

0 comments on commit d3d382a

Please sign in to comment.