Skip to content

Commit

Permalink
Update test cases with signature configs
Browse files Browse the repository at this point in the history
  • Loading branch information
Nuvindu committed Oct 16, 2024
1 parent cf19a09 commit 7c4fdaa
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 3 deletions.
13 changes: 12 additions & 1 deletion ballerina/modules/soap11/tests/soap11_client_test.bal
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,17 @@ function testSoapReceiveWithAsymmetricBindingAndInboundConfig() returns error? {
Client soapClient = check new ("http://localhost:9090",
{
outboundSecurity: {
signatureConfig: {
keystore: {
path: KEY_STORE_PATH_2,
password: PASSWORD
},
privateKeyAlias: ALIAS,
privateKeyPassword: PASSWORD,
signatureAlgorithm: soap:RSA_SHA512,
canonicalizationAlgorithm: soap:C14N_EXCL_OMIT_COMMENTS,
digestAlgorithm: soap:SHA512
},
encryptionConfig: {
keystore: {
path: KEY_STORE_PATH_2,
Expand All @@ -409,7 +420,7 @@ function testSoapReceiveWithAsymmetricBindingAndInboundConfig() returns error? {
}
}
);
xml body = xml `<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><soap:Body><quer:Add xmlns:quer="http://tempuri.org/"><quer:intA>2</quer:intA><quer:intB>3</quer:intB></quer:Add></soap:Body></soap:Envelope>`;
xml body = xml `<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><soap:Body xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" wsu:Id="id-6f23a35d-b1db-4472-8fd5-db2581a17cd8"><quer:Add xmlns:quer="http://tempuri.org/"><quer:intA>2</quer:intA><quer:intB>3</quer:intB></quer:Add></soap:Body></soap:Envelope>`;
xml response = check soapClient->sendReceive(body, "http://tempuri.org/Add", path = "/getSamePayload");
test:assertEquals((response/<soap11:Body>).toString(), (body/<soap11:Body>).toString());
}
14 changes: 12 additions & 2 deletions ballerina/modules/soap12/tests/soap12_client_test.bal
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,17 @@ function testSoapReceiveWithAsymmetricBindingAndInboundConfig() returns error? {
Client soapClient = check new ("http://localhost:9091",
{
outboundSecurity: {
signatureConfig: {
keystore: {
path: KEY_STORE_PATH_2,
password: PASSWORD
},
privateKeyAlias: ALIAS,
privateKeyPassword: PASSWORD,
signatureAlgorithm: soap:RSA_SHA512,
canonicalizationAlgorithm: soap:C14N_EXCL_OMIT_COMMENTS,
digestAlgorithm: soap:SHA512
},
encryptionConfig: {
keystore: {
path: KEY_STORE_PATH_2,
Expand All @@ -442,8 +453,7 @@ function testSoapReceiveWithAsymmetricBindingAndInboundConfig() returns error? {
}
}
);
xml body = xml `<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" soap:encodingStyle="http://www.w3.org/2003/05/soap-encoding/"><soap:Body><quer:Add xmlns:quer="http://tempuri.org/"><quer:intA>2</quer:intA><quer:intB>3</quer:intB></quer:Add></soap:Body></soap:Envelope>`;
xml body = xml `<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" soap:encodingStyle="http://www.w3.org/2003/05/soap-encoding/"><soap:Body xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" wsu:Id="id-9fc31395-d908-4efa-96e5-754b03963236"><quer:Add xmlns:quer="http://tempuri.org/"><quer:intA>2</quer:intA><quer:intB>3</quer:intB></quer:Add></soap:Body></soap:Envelope>`;
xml response = check soapClient->sendReceive(body, "http://tempuri.org/Add");
test:assertEquals((response/<soap11:Body>).toString(), (body/<soap11:Body>).toString());
}

0 comments on commit 7c4fdaa

Please sign in to comment.