Class DummyComponentContext

java.lang.Object
io.openems.edge.common.test.DummyComponentContext
All Implemented Interfaces:
org.osgi.service.component.ComponentContext

public class DummyComponentContext extends Object implements org.osgi.service.component.ComponentContext
Simulates a ComponentContext for the OpenEMS Component test framework.
  • Constructor Details

    • DummyComponentContext

      public DummyComponentContext(Dictionary<String,Object> properties)
    • DummyComponentContext

      public DummyComponentContext()
  • Method Details

    • from

      Build a DummyComponentContext from a configuration.
      Parameters:
      configuration - the AbstractComponentConfig
      Returns:
      the DummyComponentContextn
      Throws:
      IllegalAccessException - on error
      IllegalArgumentException - on error
      InvocationTargetException - on error
    • addProperty

      public void addProperty(String key, Object value)
      Add a configuration property.
      Parameters:
      key - the property key
      value - the property value
    • getProperties

      public Dictionary<String,Object> getProperties()
      Specified by:
      getProperties in interface org.osgi.service.component.ComponentContext
    • locateService

      public <S> S locateService(String name)
      Specified by:
      locateService in interface org.osgi.service.component.ComponentContext
    • locateService

      public <S> S locateService(String name, org.osgi.framework.ServiceReference<S> reference)
      Specified by:
      locateService in interface org.osgi.service.component.ComponentContext
    • locateServices

      public Object[] locateServices(String name)
      Specified by:
      locateServices in interface org.osgi.service.component.ComponentContext
    • getBundleContext

      public org.osgi.framework.BundleContext getBundleContext()
      Specified by:
      getBundleContext in interface org.osgi.service.component.ComponentContext
    • getUsingBundle

      public org.osgi.framework.Bundle getUsingBundle()
      Specified by:
      getUsingBundle in interface org.osgi.service.component.ComponentContext
    • getComponentInstance

      public <S> org.osgi.service.component.ComponentInstance<S> getComponentInstance()
      Specified by:
      getComponentInstance in interface org.osgi.service.component.ComponentContext
    • enableComponent

      public void enableComponent(String name)
      Specified by:
      enableComponent in interface org.osgi.service.component.ComponentContext
    • disableComponent

      public void disableComponent(String name)
      Specified by:
      disableComponent in interface org.osgi.service.component.ComponentContext
    • getServiceReference

      public org.osgi.framework.ServiceReference<?> getServiceReference()
      Specified by:
      getServiceReference in interface org.osgi.service.component.ComponentContext