com.atlassian.sal.testresources.component
Class MockComponentLocator

java.lang.Object
  extended by com.atlassian.sal.api.component.ComponentLocator
      extended by com.atlassian.sal.testresources.component.MockComponentLocator

public class MockComponentLocator
extends ComponentLocator

Mock implementation of the component locator for testing


Constructor Summary
MockComponentLocator(Object... objects)
           
 
Method Summary
 MockComponentLocator add(Class<?> cls, Object obj)
           
 MockComponentLocator add(Object obj)
           
static MockComponentLocator create(Object... objects)
           
protected
<T> T
getComponentInternal(Class<T> iface)
          Gets the requested component, to be overridden for each application
protected
<T> T
getComponentInternal(Class<T> iface, String componentId)
          Gets the requested component, to be overridden for each application
protected
<T> Collection<T>
getComponentsInternal(Class<T> iface)
           
 
Methods inherited from class com.atlassian.sal.api.component.ComponentLocator
convertClassToName, getComponent, getComponent, getComponents, isInitialized, setComponentLocator
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MockComponentLocator

public MockComponentLocator(Object... objects)
Method Detail

add

public MockComponentLocator add(Class<?> cls,
                                Object obj)

add

public MockComponentLocator add(Object obj)

getComponentInternal

protected <T> T getComponentInternal(Class<T> iface)
Description copied from class: ComponentLocator
Gets the requested component, to be overridden for each application

Specified by:
getComponentInternal in class ComponentLocator
Parameters:
iface - The interface to lookup
Returns:
The implementation

create

public static MockComponentLocator create(Object... objects)

getComponentsInternal

protected <T> Collection<T> getComponentsInternal(Class<T> iface)
Specified by:
getComponentsInternal in class ComponentLocator

getComponentInternal

protected <T> T getComponentInternal(Class<T> iface,
                                     String componentId)
Description copied from class: ComponentLocator
Gets the requested component, to be overridden for each application

Specified by:
getComponentInternal in class ComponentLocator
Parameters:
iface - The interface to lookup
componentId - key of the component
Returns:
The implementation


Copyright © 2015 Atlassian. All rights reserved.