Class SelfSignedCertificateRule
java.lang.Object
org.junit.rules.ExternalResource
com.linecorp.armeria.testing.junit4.server.SelfSignedCertificateRule
- All Implemented Interfaces:
TestRule
public final class SelfSignedCertificateRule extends ExternalResource
A
TestRule that provides a temporary self-signed certificate.-
Constructor Summary
Constructors Constructor Description SelfSignedCertificateRule()Creates a new instance.SelfSignedCertificateRule(String fqdn)Creates a new instance.SelfSignedCertificateRule(String fqdn, SecureRandom random, int bits)Creates a new instance.SelfSignedCertificateRule(String fqdn, SecureRandom random, int bits, TemporalAccessor notBefore, TemporalAccessor notAfter)Creates a new instance.SelfSignedCertificateRule(String fqdn, TemporalAccessor notBefore, TemporalAccessor notAfter)Creates a new instance.SelfSignedCertificateRule(TemporalAccessor notBefore, TemporalAccessor notAfter)Creates a new instance. -
Method Summary
Modifier and Type Method Description protected voidafter()Deletes the generatedSelfSignedCertificate.protected voidbefore()Generates aSelfSignedCertificate.X509Certificatecertificate()Returns the generatedX509Certificate.FilecertificateFile()Returns the self-signed certificate file.PrivateKeyprivateKey()Returns thePrivateKeyof the self-signed certificate.FileprivateKeyFile()Returns the private key file of the self-signed certificate.Methods inherited from class org.junit.rules.ExternalResource
apply
-
Constructor Details
-
SelfSignedCertificateRule
public SelfSignedCertificateRule()Creates a new instance. -
SelfSignedCertificateRule
Creates a new instance.- Parameters:
notBefore-Certificateis not valid before this timenotAfter-Certificateis not valid after this time
-
SelfSignedCertificateRule
Creates a new instance.- Parameters:
fqdn- a fully qualified domain name
-
SelfSignedCertificateRule
public SelfSignedCertificateRule(String fqdn, TemporalAccessor notBefore, TemporalAccessor notAfter)Creates a new instance.- Parameters:
fqdn- a fully qualified domain namenotBefore-Certificateis not valid before this timenotAfter-Certificateis not valid after this time
-
SelfSignedCertificateRule
Creates a new instance.- Parameters:
fqdn- a fully qualified domain namerandom- theSecureRandomto usebits- the number of bits of the generated private key
-
SelfSignedCertificateRule
public SelfSignedCertificateRule(String fqdn, SecureRandom random, int bits, TemporalAccessor notBefore, TemporalAccessor notAfter)Creates a new instance.- Parameters:
fqdn- a fully qualified domain namerandom- theSecureRandomto usebits- the number of bits of the generated private keynotBefore-Certificateis not valid before this timenotAfter-Certificateis not valid after this time
-
-
Method Details
-
before
Generates aSelfSignedCertificate.- Overrides:
beforein classExternalResource- Throws:
Throwable
-
after
protected void after()Deletes the generatedSelfSignedCertificate.- Overrides:
afterin classExternalResource
-
certificate
Returns the generatedX509Certificate. -
certificateFile
Returns the self-signed certificate file. -
privateKey
Returns thePrivateKeyof the self-signed certificate. -
privateKeyFile
Returns the private key file of the self-signed certificate.
-