Rename testmethods to make these more clear (#10231)
Motivation: The currently used method names don't make a lot of sense. Modifications: Rename to cleanup Result: Cleanup
This commit is contained in:
parent
9427255ffb
commit
cfcd7a4fde
@ -22,7 +22,7 @@ import java.io.File;
|
|||||||
|
|
||||||
public class JdkSslClientContextTest extends SslContextTest {
|
public class JdkSslClientContextTest extends SslContextTest {
|
||||||
@Override
|
@Override
|
||||||
protected SslContext newServerContext(File crtFile, File keyFile, String pass) throws SSLException {
|
protected SslContext newSslContext(File crtFile, File keyFile, String pass) throws SSLException {
|
||||||
return new JdkSslClientContext(crtFile, InsecureTrustManagerFactory.INSTANCE, crtFile, keyFile, pass,
|
return new JdkSslClientContext(crtFile, InsecureTrustManagerFactory.INSTANCE, crtFile, keyFile, pass,
|
||||||
null, null, IdentityCipherSuiteFilter.INSTANCE, ApplicationProtocolConfig.DISABLED, 0, 0);
|
null, null, IdentityCipherSuiteFilter.INSTANCE, ApplicationProtocolConfig.DISABLED, 0, 0);
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,7 @@ import java.io.File;
|
|||||||
public class JdkSslServerContextTest extends SslContextTest {
|
public class JdkSslServerContextTest extends SslContextTest {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected SslContext newServerContext(File crtFile, File keyFile, String pass) throws SSLException {
|
protected SslContext newSslContext(File crtFile, File keyFile, String pass) throws SSLException {
|
||||||
return new JdkSslServerContext(crtFile, keyFile, pass);
|
return new JdkSslServerContext(crtFile, keyFile, pass);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -31,7 +31,7 @@ public class OpenSslClientContextTest extends SslContextTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected SslContext newServerContext(File crtFile, File keyFile, String pass) throws SSLException {
|
protected SslContext newSslContext(File crtFile, File keyFile, String pass) throws SSLException {
|
||||||
return new OpenSslClientContext(crtFile, InsecureTrustManagerFactory.INSTANCE, crtFile, keyFile, pass,
|
return new OpenSslClientContext(crtFile, InsecureTrustManagerFactory.INSTANCE, crtFile, keyFile, pass,
|
||||||
null, null, IdentityCipherSuiteFilter.INSTANCE, ApplicationProtocolConfig.DISABLED, 0, 0);
|
null, null, IdentityCipherSuiteFilter.INSTANCE, ApplicationProtocolConfig.DISABLED, 0, 0);
|
||||||
}
|
}
|
||||||
|
@ -32,7 +32,7 @@ public class OpenSslServerContextTest extends SslContextTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected SslContext newServerContext(File crtFile, File keyFile, String pass) throws SSLException {
|
protected SslContext newSslContext(File crtFile, File keyFile, String pass) throws SSLException {
|
||||||
Assume.assumeTrue(OpenSsl.isAvailable());
|
Assume.assumeTrue(OpenSsl.isAvailable());
|
||||||
return new OpenSslServerContext(crtFile, keyFile, pass);
|
return new OpenSslServerContext(crtFile, keyFile, pass);
|
||||||
}
|
}
|
||||||
|
@ -64,35 +64,35 @@ public abstract class SslContextTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSslServerWithEncryptedPrivateKey() throws SSLException {
|
public void testSslContextWithEncryptedPrivateKey() throws SSLException {
|
||||||
File keyFile = ResourcesUtil.getFile(getClass(), "test_encrypted.pem");
|
File keyFile = ResourcesUtil.getFile(getClass(), "test_encrypted.pem");
|
||||||
File crtFile = ResourcesUtil.getFile(getClass(), "test.crt");
|
File crtFile = ResourcesUtil.getFile(getClass(), "test.crt");
|
||||||
|
|
||||||
newServerContext(crtFile, keyFile, "12345");
|
newSslContext(crtFile, keyFile, "12345");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSslServerWithEncryptedPrivateKey2() throws SSLException {
|
public void testSslContextWithEncryptedPrivateKey2() throws SSLException {
|
||||||
File keyFile = ResourcesUtil.getFile(getClass(), "test2_encrypted.pem");
|
File keyFile = ResourcesUtil.getFile(getClass(), "test2_encrypted.pem");
|
||||||
File crtFile = ResourcesUtil.getFile(getClass(), "test2.crt");
|
File crtFile = ResourcesUtil.getFile(getClass(), "test2.crt");
|
||||||
|
|
||||||
newServerContext(crtFile, keyFile, "12345");
|
newSslContext(crtFile, keyFile, "12345");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSslServerWithUnencryptedPrivateKey() throws SSLException {
|
public void testSslContextWithUnencryptedPrivateKey() throws SSLException {
|
||||||
File keyFile = ResourcesUtil.getFile(getClass(), "test_unencrypted.pem");
|
File keyFile = ResourcesUtil.getFile(getClass(), "test_unencrypted.pem");
|
||||||
File crtFile = ResourcesUtil.getFile(getClass(), "test.crt");
|
File crtFile = ResourcesUtil.getFile(getClass(), "test.crt");
|
||||||
|
|
||||||
newServerContext(crtFile, keyFile, null);
|
newSslContext(crtFile, keyFile, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(expected = SSLException.class)
|
@Test(expected = SSLException.class)
|
||||||
public void testSslServerWithUnencryptedPrivateKeyEmptyPass() throws SSLException {
|
public void testSslContextWithUnencryptedPrivateKeyEmptyPass() throws SSLException {
|
||||||
File keyFile = ResourcesUtil.getFile(getClass(), "test_unencrypted.pem");
|
File keyFile = ResourcesUtil.getFile(getClass(), "test_unencrypted.pem");
|
||||||
File crtFile = ResourcesUtil.getFile(getClass(), "test.crt");
|
File crtFile = ResourcesUtil.getFile(getClass(), "test.crt");
|
||||||
|
|
||||||
newServerContext(crtFile, keyFile, "");
|
newSslContext(crtFile, keyFile, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -112,14 +112,14 @@ public abstract class SslContextTest {
|
|||||||
File keyFile = ResourcesUtil.getFile(getClass(), "test_unencrypted.pem");
|
File keyFile = ResourcesUtil.getFile(getClass(), "test_unencrypted.pem");
|
||||||
File crtFile = ResourcesUtil.getFile(getClass(), "test.crt");
|
File crtFile = ResourcesUtil.getFile(getClass(), "test.crt");
|
||||||
|
|
||||||
SslContext sslContext = newServerContext(crtFile, keyFile, null);
|
SslContext sslContext = newSslContext(crtFile, keyFile, null);
|
||||||
assertFalse(sslContext.cipherSuites().contains(unsupportedCipher));
|
assertFalse(sslContext.cipherSuites().contains(unsupportedCipher));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(expected = CertificateException.class)
|
@Test(expected = CertificateException.class)
|
||||||
public void test() throws CertificateException {
|
public void testUnsupportedParams() throws CertificateException {
|
||||||
SslContext.toX509Certificates(new File(getClass().getResource("ec_params_unsupported.pem").getFile()));
|
SslContext.toX509Certificates(new File(getClass().getResource("ec_params_unsupported.pem").getFile()));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected abstract SslContext newServerContext(File crtFile, File keyFile, String pass) throws SSLException;
|
protected abstract SslContext newSslContext(File crtFile, File keyFile, String pass) throws SSLException;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user