Package com.lucimber.dbus.connection
Class DummyConnection.Builder
java.lang.Object
com.lucimber.dbus.connection.DummyConnection.Builder
- Enclosing class:
- DummyConnection
Builder for creating DummyConnection instances with custom configuration.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()
Builds the DummyConnection instance.withConfig
(ConnectionConfig config) Sets the connection configuration.withConnectDelay
(Duration delay) Sets the simulated connection delay.withConnectionFailure
(boolean shouldFail) Configures the connection to fail during connect.withHealthCheckFailure
(boolean shouldFail) Configures health checks to fail.withMethodCallResponse
(String interfaceName, String methodName, Function<OutboundMessage, InboundMessage> responseFunction) Adds a response handler for method calls.
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
withConfig
Sets the connection configuration.- Parameters:
config
- the connection configuration- Returns:
- this builder
-
withConnectDelay
Sets the simulated connection delay.- Parameters:
delay
- the connection delay- Returns:
- this builder
-
withConnectionFailure
Configures the connection to fail during connect.- Parameters:
shouldFail
- true to simulate connection failure- Returns:
- this builder
-
withHealthCheckFailure
Configures health checks to fail.- Parameters:
shouldFail
- true to simulate health check failure- Returns:
- this builder
-
withMethodCallResponse
public DummyConnection.Builder withMethodCallResponse(String interfaceName, String methodName, Function<OutboundMessage, InboundMessage> responseFunction) Adds a response handler for method calls.- Parameters:
interfaceName
- the D-Bus interface namemethodName
- the method nameresponseFunction
- function to generate the response- Returns:
- this builder
-
build
Builds the DummyConnection instance.- Returns:
- a new DummyConnection
-