org.fourthline.cling.mock

## Class MockUpnpService

- java.lang.Object
- - org.fourthline.cling.mock.MockUpnpService

- All Implemented Interfaces:
    UpnpService

      @Alternative
      public class MockUpnpService
      extends Object
      implements UpnpService

  Simplifies testing of core and non-core modules.

  It uses the `MockUpnpService.MockProtocolFactory`.

  Author:
    Christian Bauer

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `MockUpnpService.MockProtocolFactory` This factory customizes several protocols.

    - ### Nested classes/interfaces inherited from interface org.fourthline.cling.UpnpService

      `UpnpService.Shutdown, UpnpService.Start`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected UpnpServiceConfiguration` | `configuration`
    `protected ControlPoint` | `controlPoint`
    `protected NetworkAddressFactory` | `networkAddressFactory`
    `protected ProtocolFactory` | `protocolFactory`
    `protected Registry` | `registry`
    `protected MockRouter` | `router`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `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)`
    `MockUpnpService(boolean sendsAlive, MockUpnpServiceConfiguration configuration)`
    `MockUpnpService(MockUpnpServiceConfiguration configuration)` No ALIVE messages.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected ProtocolFactory` | `createProtocolFactory(UpnpService service, boolean sendsAlive)`
    `protected MockRouter` | `createRouter()`
    `UpnpServiceConfiguration` | `getConfiguration()`
    `ControlPoint` | `getControlPoint()`
    `ProtocolFactory` | `getProtocolFactory()`
    `Registry` | `getRegistry()`
    `MockRouter` | `getRouter()`
    `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 MockRouter 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(MockUpnpServiceConfiguration configuration)

      No ALIVE messages.

    - #### 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)

    - #### MockUpnpService

          public MockUpnpService(boolean sendsAlive,
                         MockUpnpServiceConfiguration configuration)

  - ### Method Detail

    - #### createProtocolFactory

          protected ProtocolFactory createProtocolFactory(UpnpService service,
                                              boolean sendsAlive)

    - #### createRouter

          protected MockRouter 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 MockRouter 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 multicast'ed, existing event subscriptions cancelled.

      Specified by:
        `shutdown` in interface `UpnpService`

Copyright © 2014 4th Line GmbH, Switzerland. All Rights Reserved.