demo.org.powermock.examples.tutorial.staticmocking.impl
Class ServiceRegistrator

java.lang.Object
  extended by demo.org.powermock.examples.tutorial.staticmocking.impl.ServiceRegistrator
All Implemented Interfaces:
IServiceRegistrator

public class ServiceRegistrator
extends Object
implements IServiceRegistrator

An "OSGi"-ish implementation of the IServiceRegistrator interface. The test for this class demonstrates static mocking as well as getting and setting internal state.


Constructor Summary
ServiceRegistrator()
          Default constructor, initializes internal state.
 
Method Summary
 long registerService(String name, Object serviceImplementation)
          Registers a service to the service framework.
 void unregisterService(long id)
          Unregisters a service from the service framework.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ServiceRegistrator

public ServiceRegistrator()
Default constructor, initializes internal state.

Method Detail

registerService

public long registerService(String name,
                            Object serviceImplementation)
Registers a service to the service framework.

Specified by:
registerService in interface IServiceRegistrator
Parameters:
name - The name of the service the register.
serviceImplementation - The implementation of the service.
Returns:
An id of the service that got registered. Should be used when unregistering the service.

unregisterService

public void unregisterService(long id)
Unregisters a service from the service framework.

Specified by:
unregisterService in interface IServiceRegistrator
Parameters:
id - The id of the service that should be removed. The id was generated by IServiceRegistrator.registerService(String, Object).


Copyright © 2007-2012. All Rights Reserved.