Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.teleal.cling.mock
Class MockUpnpService

    java.lang.Object
      org.teleal.cling.mock.MockUpnpService

All Implemented Interfaces:
  UpnpService

    public class MockUpnpService

extends Object
implements UpnpService

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`.

Author:
  Christian Bauer

Nested Class Summary
`static class` | `MockUpnpService.MockProtocolFactory` This factory customizes several protocols.
`class` | `MockUpnpService.MockRouter`

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)`
`protected Router` | `createRouter()`
`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

### configuration

    protected final UpnpServiceConfiguration configuration

### controlPoint

    protected final ControlPoint controlPoint

### protocolFactory

    protected final ProtocolFactory protocolFactory

### registry

    protected final Registry registry

### router

    protected final Router router

### networkAddressFactory

    protected final NetworkAddressFactory networkAddressFactory

Constructor Detail

### MockUpnpService

    public MockUpnpService()

  Single-thread of execution for the whole UPnP stack, no ALIVE messages or registry maintenance.

### MockUpnpService

    public MockUpnpService(boolean sendsAlive,
                           boolean maintainsRegistry)

  Single-thread of execution for the whole UPnP stack, except one background registry maintenance thread.

### MockUpnpService

    public MockUpnpService(boolean sendsAlive,
                           boolean maintainsRegistry,
                           boolean multiThreaded)

Method Detail

### createProtocolFactory

    protected ProtocolFactory createProtocolFactory(UpnpService service,
                                                    boolean sendsAlive)

### createRouter

    protected Router createRouter()

### getConfiguration

    public UpnpServiceConfiguration getConfiguration()

  Specified by:
    `getConfiguration` in interface `UpnpService`

### getControlPoint

    public ControlPoint getControlPoint()

  Specified by:
    `getControlPoint` in interface `UpnpService`

### getProtocolFactory

    public ProtocolFactory getProtocolFactory()

  Specified by:
    `getProtocolFactory` in interface `UpnpService`

### getRegistry

    public Registry getRegistry()

  Specified by:
    `getRegistry` in interface `UpnpService`

### getRouter

    public Router getRouter()

  Specified by:
    `getRouter` in interface `UpnpService`

### shutdown

    public void shutdown()

  Description copied from interface: `UpnpService`
  Stopping the UPnP stack.

  Clients are required to stop the UPnP stack properly. Notifications for disappearing devices will be multicasted, existing event subscriptions canceled.

  Specified by:
    `shutdown` in interface `UpnpService`

### getIncomingDatagramMessages

    public List<IncomingDatagramMessage> getIncomingDatagramMessages()

### getOutgoingDatagramMessages

    public List<OutgoingDatagramMessage> getOutgoingDatagramMessages()

### getReceivedUpnpStreams

    public List<UpnpStream> getReceivedUpnpStreams()

### getSentStreamRequestMessages

    public List<StreamRequestMessage> getSentStreamRequestMessages()

### getBroadcastedBytes

    public List<byte[]> getBroadcastedBytes()

### getStreamResponseMessages

    public StreamResponseMessage[] getStreamResponseMessages()

### getStreamResponseMessage

    public StreamResponseMessage getStreamResponseMessage(StreamRequestMessage request)

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2011 Teleal GmbH, Switzerland. All Rights Reserved.