|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.teleal.cling.mock.MockUpnpService
public class MockUpnpService
Simplifies testing of core and non-core modules.
This service has no real network transport layer, it collects all messages instead and makes
them available for testing with getOutgoingDatagramMessages(),
getSentStreamRequestMessages(), etc. Mock responses for TCP (HTTP) stream requests
can be returned by overriding getStreamResponseMessage(org.teleal.cling.model.message.StreamRequestMessage)
or getStreamResponseMessages() if you know the order of requests.
It uses the MockUpnpService.MockProtocolFactory.
| Nested Class Summary | |
|---|---|
static class |
MockUpnpService.MockProtocolFactory
This factory customizes several protocols. |
| Field Summary | |
|---|---|
protected UpnpServiceConfiguration |
configuration
|
protected ControlPoint |
controlPoint
|
protected NetworkAddressFactory |
networkAddressFactory
|
protected ProtocolFactory |
protocolFactory
|
protected Registry |
registry
|
protected Router |
router
|
| Constructor Summary | |
|---|---|
MockUpnpService()
Single-thread of execution for the whole UPnP stack, no ALIVE messages or registry maintenance. |
|
MockUpnpService(boolean sendsAlive,
boolean maintainsRegistry)
Single-thread of execution for the whole UPnP stack, except one background registry maintenance thread. |
|
MockUpnpService(boolean sendsAlive,
boolean maintainsRegistry,
boolean multiThreaded)
|
|
| Method Summary | |
|---|---|
protected ProtocolFactory |
createProtocolFactory(UpnpService service,
boolean sendsAlive)
|
List<byte[]> |
getBroadcastedBytes()
|
UpnpServiceConfiguration |
getConfiguration()
|
ControlPoint |
getControlPoint()
|
List<IncomingDatagramMessage> |
getIncomingDatagramMessages()
|
List<OutgoingDatagramMessage> |
getOutgoingDatagramMessages()
|
ProtocolFactory |
getProtocolFactory()
|
List<UpnpStream> |
getReceivedUpnpStreams()
|
Registry |
getRegistry()
|
Router |
getRouter()
|
List<StreamRequestMessage> |
getSentStreamRequestMessages()
|
StreamResponseMessage |
getStreamResponseMessage(StreamRequestMessage request)
|
StreamResponseMessage[] |
getStreamResponseMessages()
|
void |
shutdown()
Stopping the UPnP stack. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected final UpnpServiceConfiguration configuration
protected final ControlPoint controlPoint
protected final ProtocolFactory protocolFactory
protected final Registry registry
protected final Router router
protected final NetworkAddressFactory networkAddressFactory
| Constructor Detail |
|---|
public MockUpnpService()
public MockUpnpService(boolean sendsAlive,
boolean maintainsRegistry)
public MockUpnpService(boolean sendsAlive,
boolean maintainsRegistry,
boolean multiThreaded)
| Method Detail |
|---|
protected ProtocolFactory createProtocolFactory(UpnpService service,
boolean sendsAlive)
public UpnpServiceConfiguration getConfiguration()
getConfiguration in interface UpnpServicepublic ControlPoint getControlPoint()
getControlPoint in interface UpnpServicepublic ProtocolFactory getProtocolFactory()
getProtocolFactory in interface UpnpServicepublic Registry getRegistry()
getRegistry in interface UpnpServicepublic Router getRouter()
getRouter in interface UpnpServicepublic void shutdown()
UpnpServiceClients are required to stop the UPnP stack properly. Notifications for disappearing devices will be multicasted, existing event subscriptions canceled.
shutdown in interface UpnpServicepublic List<IncomingDatagramMessage> getIncomingDatagramMessages()
public List<OutgoingDatagramMessage> getOutgoingDatagramMessages()
public List<UpnpStream> getReceivedUpnpStreams()
public List<StreamRequestMessage> getSentStreamRequestMessages()
public List<byte[]> getBroadcastedBytes()
public StreamResponseMessage[] getStreamResponseMessages()
public StreamResponseMessage getStreamResponseMessage(StreamRequestMessage request)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||