Package org.shredzone.acme4j.provider
Class TestableConnectionProvider
java.lang.Object
org.shredzone.acme4j.connector.DummyConnection
org.shredzone.acme4j.provider.TestableConnectionProvider
- All Implemented Interfaces:
AutoCloseable
,Connection
,AcmeProvider
Test implementation of
AcmeProvider
. It also implements a dummy implementation
of Connection
that is always returned on connect(URI, NetworkSettings)
.-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
connect
(URI serverUri, NetworkSettings networkSettings) createChallenge
(Login login, JSON data) Creates aLogin
that uses thisAcmeProvider
.Creates aSession
that uses thisAcmeProvider
.getChallenge
(String type) Returns theChallenge
instance that has been created.void
putMetadata
(String key, Object value) Add a property to the metadata registry.void
putTestChallenge
(String type, BiFunction<Login, JSON, Challenge> creator) Register aChallenge
.void
putTestResource
(Resource r, URL u) Register aResource
mapping.Methods inherited from class org.shredzone.acme4j.connector.DummyConnection
close, getExpiration, getLastModified, getLinks, getLocation, getNonce, readCertificates, readJsonResponse, resetNonce, sendCertificateRequest, sendRequest, sendSignedPostAsGetRequest, sendSignedRequest, sendSignedRequest
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.shredzone.acme4j.connector.Connection
handleRetryAfter
-
Constructor Details
-
TestableConnectionProvider
public TestableConnectionProvider()
-
-
Method Details
-
putTestResource
Register aResource
mapping. -
putMetadata
Add a property to the metadata registry.- Parameters:
key
- Metadata keyvalue
- Metadata value
-
putTestChallenge
Register aChallenge
.- Parameters:
type
- Challenge type to register.creator
- CreatorBiFunction
that creates a matchingChallenge
-
getChallenge
Returns theChallenge
instance that has been created. Fails if no such challenge was created.- Parameters:
type
- Challenge type- Returns:
- Created
Challenge
instance
-
createSession
Creates aSession
that uses thisAcmeProvider
. -
createLogin
Creates aLogin
that uses thisAcmeProvider
.- Throws:
IOException
-
getRetryAfter
- Specified by:
getRetryAfter
in interfaceConnection
- Overrides:
getRetryAfter
in classDummyConnection
-
accepts
- Specified by:
accepts
in interfaceAcmeProvider
-
resolve
- Specified by:
resolve
in interfaceAcmeProvider
-
connect
- Specified by:
connect
in interfaceAcmeProvider
-
directory
- Specified by:
directory
in interfaceAcmeProvider
-
createChallenge
- Specified by:
createChallenge
in interfaceAcmeProvider
-