Search in sources :

Example 1 with BundleContextMock

use of org.apache.aries.mocks.BundleContextMock in project aries by apache.

the class InitialContextTest method setup.

/**
   * This method does the setup .
   * @throws NoSuchFieldException 
   * @throws SecurityException 
   * @throws IllegalAccessException 
   * @throws IllegalArgumentException 
   */
@Before
public void setup() throws SecurityException, NoSuchFieldException, IllegalArgumentException, IllegalAccessException {
    bc = Skeleton.newMock(new BundleContextMock(), BundleContext.class);
    activator = new Activator();
    activator.start(bc);
}
Also used : BundleContextMock(org.apache.aries.mocks.BundleContextMock) Activator(org.apache.aries.jndi.startup.Activator) BundleContext(org.osgi.framework.BundleContext) Before(org.junit.Before)

Example 2 with BundleContextMock

use of org.apache.aries.mocks.BundleContextMock in project aries by apache.

the class ParserProxyTest method getMockParserServiceProxy.

public static ParserProxy getMockParserServiceProxy() {
    BundleContext mockCtx = Skeleton.newMock(new BundleContextMock(), BundleContext.class);
    NamespaceHandlerRegistry nhri = new NamespaceHandlerRegistryImpl(mockCtx);
    ParserService parserService = new ParserServiceImpl(nhri);
    mockCtx.registerService(ParserService.class.getName(), parserService, new Hashtable<String, String>());
    ParserProxyImpl parserProxyService = new ParserProxyImpl();
    parserProxyService.setParserService(parserService);
    parserProxyService.setBundleContext(mockCtx);
    parserProxyService.setModellingManager(new ModellingManagerImpl());
    return parserProxyService;
}
Also used : ParserServiceImpl(org.apache.aries.blueprint.container.ParserServiceImpl) BundleContextMock(org.apache.aries.mocks.BundleContextMock) NamespaceHandlerRegistry(org.apache.aries.blueprint.container.NamespaceHandlerRegistry) BundleContext(org.osgi.framework.BundleContext) NamespaceHandlerRegistryImpl(org.apache.aries.blueprint.namespace.NamespaceHandlerRegistryImpl) ParserService(org.apache.aries.blueprint.services.ParserService)

Example 3 with BundleContextMock

use of org.apache.aries.mocks.BundleContextMock in project aries by apache.

the class ObjectFactoryTest method setup.

/**
   * This method does the setup .
   * @throws NoSuchFieldException 
   * @throws SecurityException 
   * @throws IllegalAccessException 
   * @throws IllegalArgumentException 
   */
@Before
public void setup() throws SecurityException, NoSuchFieldException, IllegalArgumentException, IllegalAccessException {
    bc = Skeleton.newMock(new BundleContextMock(), BundleContext.class);
    activator = new Activator();
    activator.start(bc);
    env = new Hashtable<Object, Object>();
    env.put(JNDIConstants.BUNDLE_CONTEXT, bc);
}
Also used : BundleContextMock(org.apache.aries.mocks.BundleContextMock) Activator(org.apache.aries.jndi.startup.Activator) BundleContext(org.osgi.framework.BundleContext) Before(org.junit.Before)

Aggregations

BundleContextMock (org.apache.aries.mocks.BundleContextMock)3 BundleContext (org.osgi.framework.BundleContext)3 Activator (org.apache.aries.jndi.startup.Activator)2 Before (org.junit.Before)2 NamespaceHandlerRegistry (org.apache.aries.blueprint.container.NamespaceHandlerRegistry)1 ParserServiceImpl (org.apache.aries.blueprint.container.ParserServiceImpl)1 NamespaceHandlerRegistryImpl (org.apache.aries.blueprint.namespace.NamespaceHandlerRegistryImpl)1 ParserService (org.apache.aries.blueprint.services.ParserService)1