Skip to content

Commit

Permalink
Add test case
Browse files Browse the repository at this point in the history
  • Loading branch information
Bhashinee committed Oct 9, 2023
1 parent 4298bf2 commit 153fe3d
Show file tree
Hide file tree
Showing 14 changed files with 42 additions and 37 deletions.
6 changes: 3 additions & 3 deletions ballerina-tests/http-advanced-tests/Ballerina.toml
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
[package]
org = "ballerina"
name = "http_advanced_tests"
version = "2.10.1"
version = "2.10.3"

[[dependency]]
org = "ballerina"
name = "http_test_common"
repository = "local"
version = "2.10.1"
version = "2.10.3"

[platform.java17]
graalvmCompatible = true

[[platform.java17.dependency]]
scope = "testOnly"
path = "../../test-utils/build/libs/http-test-utils-2.10.1.jar"
path = "../../test-utils/build/libs/http-test-utils-2.10.3-SNAPSHOT.jar"
6 changes: 3 additions & 3 deletions ballerina-tests/http-client-tests/Ballerina.toml
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
[package]
org = "ballerina"
name = "http_client_tests"
version = "2.10.1"
version = "2.10.3"

[[dependency]]
org = "ballerina"
name = "http_test_common"
repository = "local"
version = "2.10.1"
version = "2.10.3"

[platform.java17]
graalvmCompatible = true

[[platform.java17.dependency]]
scope = "testOnly"
path = "../../test-utils/build/libs/http-test-utils-2.10.1.jar"
path = "../../test-utils/build/libs/http-test-utils-2.10.3-SNAPSHOT.jar"
6 changes: 3 additions & 3 deletions ballerina-tests/http-dispatching-tests/Ballerina.toml
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
[package]
org = "ballerina"
name = "http_dispatching_tests"
version = "2.10.1"
version = "2.10.3"

[[dependency]]
org = "ballerina"
name = "http_test_common"
repository = "local"
version = "2.10.1"
version = "2.10.3"

[platform.java17]
graalvmCompatible = true

[[platform.java17.dependency]]
scope = "testOnly"
path = "../../test-utils/build/libs/http-test-utils-2.10.1.jar"
path = "../../test-utils/build/libs/http-test-utils-2.10.3-SNAPSHOT.jar"
6 changes: 3 additions & 3 deletions ballerina-tests/http-interceptor-tests/Ballerina.toml
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
[package]
org = "ballerina"
name = "http_interceptor_tests"
version = "2.10.1"
version = "2.10.3"

[[dependency]]
org = "ballerina"
name = "http_test_common"
repository = "local"
version = "2.10.1"
version = "2.10.3"

[platform.java17]
graalvmCompatible = true

[[platform.java17.dependency]]
scope = "testOnly"
path = "../../test-utils/build/libs/http-test-utils-2.10.1.jar"
path = "../../test-utils/build/libs/http-test-utils-2.10.3-SNAPSHOT.jar"
6 changes: 3 additions & 3 deletions ballerina-tests/http-misc-tests/Ballerina.toml
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
[package]
org = "ballerina"
name = "http_misc_tests"
version = "2.10.1"
version = "2.10.3"

[[dependency]]
org = "ballerina"
name = "http_test_common"
repository = "local"
version = "2.10.1"
version = "2.10.3"

[platform.java17]
graalvmCompatible = true

[[platform.java17.dependency]]
scope = "testOnly"
path = "../../test-utils/build/libs/http-test-utils-2.10.1.jar"
path = "../../test-utils/build/libs/http-test-utils-2.10.3-SNAPSHOT.jar"
6 changes: 3 additions & 3 deletions ballerina-tests/http-resiliency-tests/Ballerina.toml
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
[package]
org = "ballerina"
name = "http_resiliency_tests"
version = "2.10.1"
version = "2.10.3"

[[dependency]]
org = "ballerina"
name = "http_test_common"
repository = "local"
version = "2.10.1"
version = "2.10.3"

[platform.java17]
graalvmCompatible = true

[[platform.java17.dependency]]
scope = "testOnly"
path = "../../test-utils/build/libs/http-test-utils-2.10.1.jar"
path = "../../test-utils/build/libs/http-test-utils-2.10.3-SNAPSHOT.jar"
6 changes: 3 additions & 3 deletions ballerina-tests/http-security-tests/Ballerina.toml
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
[package]
org = "ballerina"
name = "http_security_tests"
version = "2.10.1"
version = "2.10.3"

[[dependency]]
org = "ballerina"
name = "http_test_common"
repository = "local"
version = "2.10.1"
version = "2.10.3"

[platform.java17]
graalvmCompatible = true

[[platform.java17.dependency]]
scope = "testOnly"
path = "../../test-utils/build/libs/http-test-utils-2.10.1.jar"
path = "../../test-utils/build/libs/http-test-utils-2.10.3-SNAPSHOT.jar"
6 changes: 3 additions & 3 deletions ballerina-tests/http-service-tests/Ballerina.toml
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
[package]
org = "ballerina"
name = "http_service_tests"
version = "2.10.1"
version = "2.10.3"

[[dependency]]
org = "ballerina"
name = "http_test_common"
repository = "local"
version = "2.10.1"
version = "2.10.3"

[platform.java17]
graalvmCompatible = true

[[platform.java17.dependency]]
scope = "testOnly"
path = "../../test-utils/build/libs/http-test-utils-2.10.1.jar"
path = "../../test-utils/build/libs/http-test-utils-2.10.3-SNAPSHOT.jar"
2 changes: 1 addition & 1 deletion ballerina-tests/http-test-common/Ballerina.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[package]
org = "ballerina"
name = "http_test_common"
version = "2.10.1"
version = "2.10.3"
2 changes: 1 addition & 1 deletion ballerina-tests/http-test-common/Dependencies.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ distribution-version = "2201.8.0"
[[package]]
org = "ballerina"
name = "http_test_common"
version = "2.10.1"
version = "2.10.3"
dependencies = [
{org = "ballerina", name = "lang.string"},
{org = "ballerina", name = "mime"},
Expand Down
6 changes: 3 additions & 3 deletions ballerina-tests/http2-tests/Ballerina.toml
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
[package]
org = "ballerina"
name = "http2_tests"
version = "2.10.1"
version = "2.10.3"

[[dependency]]
org = "ballerina"
name = "http_test_common"
repository = "local"
version = "2.10.1"
version = "2.10.3"

[platform.java17]
graalvmCompatible = true

[[platform.java17.dependency]]
scope = "testOnly"
path = "../../test-utils/build/libs/http-test-utils-2.10.1.jar"
path = "../../test-utils/build/libs/http-test-utils-2.10.3-SNAPSHOT.jar"
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
org.gradle.caching=true
group=io.ballerina.stdlib
version=2.10.2-SNAPSHOT
version=2.10.3-SNAPSHOT
ballerinaLangVersion=2201.8.0
ballerinaTomlParserVersion=1.2.2
commonsLang3Version=3.12.0
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* Copyright (c) 2018, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
* Copyright (c) 2023, WSO2 LLC. (http://www.wso2.org) All Rights Reserved.
*
* WSO2 Inc. licenses this file to you under the Apache License,
* 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
Expand Down Expand Up @@ -38,13 +38,14 @@

import static io.ballerina.stdlib.http.transport.contract.Constants.HTTPS_SCHEME;
import static io.ballerina.stdlib.http.transport.contract.Constants.HTTP_2_0;
import static io.ballerina.stdlib.http.transport.contract.Constants.REQUIRE;

/**
* Test ALPN protocol negotiation for HTTP2 with Certificates and keys.
* Test mTLS with certs and keys in HTTP2.
*/
public class Http2ALPNwithCertsTest {
public class Http2AlpnWithCertsTest {

private static final Logger LOG = LoggerFactory.getLogger(Http2ALPNwithCertsTest.class);
private static final Logger LOG = LoggerFactory.getLogger(Http2AlpnWithCertsTest.class);
private ServerConnector serverConnector;
private HttpClientConnector httpClientConnector;
private HttpWsConnectorFactory connectorFactory;
Expand All @@ -64,7 +65,7 @@ public void setup() throws InterruptedException {
}

@Test
public void testHttp2ALPNwithCerts() {
public void testHttp2AlpnWithcerts() {
TestUtil.testHttpsPost(httpClientConnector, TestUtil.SERVER_PORT1);
}

Expand All @@ -77,12 +78,16 @@ private ListenerConfiguration getListenerConfigs() {
listenerConfiguration.setSslHandshakeTimeOut(TestUtil.SSL_HANDSHAKE_TIMEOUT);
listenerConfiguration.setServerKeyFile(TestUtil.getAbsolutePath(TestUtil.KEY_FILE));
listenerConfiguration.setServerCertificates(TestUtil.getAbsolutePath(TestUtil.CERT_FILE));
listenerConfiguration.setVerifyClient(REQUIRE);
listenerConfiguration.setServerTrustCertificates(TestUtil.getAbsolutePath(TestUtil.CERT_FILE));
return listenerConfiguration;
}

private SenderConfiguration getSenderConfigs() {
SenderConfiguration senderConfiguration = new SenderConfiguration();
senderConfiguration.setClientTrustCertificates(TestUtil.getAbsolutePath(TestUtil.CERT_FILE));
senderConfiguration.setClientKeyFile(TestUtil.getAbsolutePath(TestUtil.KEY_FILE));
senderConfiguration.setClientCertificates(TestUtil.getAbsolutePath(TestUtil.CERT_FILE));
senderConfiguration.setHttpVersion(HTTP_2_0);
senderConfiguration.setScheme(HTTPS_SCHEME);
senderConfiguration.setSslSessionTimeOut(TestUtil.SSL_SESSION_TIMEOUT);
Expand Down
2 changes: 1 addition & 1 deletion native/src/test/resources/testng.xml
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@
<class name="io.ballerina.stdlib.http.transport.https.CipherSuiteswithCertsTest"/>
<class name="io.ballerina.stdlib.http.transport.https.OptionalMutualSSLTest"/>
<class name="io.ballerina.stdlib.http.transport.https.SSLProtocolsWithCertsTest"/>
<class name="io.ballerina.stdlib.http.transport.http2.ssl.Http2ALPNwithCertsTest"/>
<class name="io.ballerina.stdlib.http.transport.http2.ssl.Http2AlpnWithCertsTest"/>
<class name="io.ballerina.stdlib.http.transport.http2.ssl.TestHttp2WithALPN"/>
<class name="io.ballerina.stdlib.http.transport.http2.ssl.Http2MutualSslTest"/>
<class name="io.ballerina.stdlib.http.transport.http2.ssl.DisableSslTest"/>
Expand Down

0 comments on commit 153fe3d

Please sign in to comment.