Search in sources :

Example 1 with ParserService

use of org.apache.aries.blueprint.services.ParserService in project aries by apache.

the class ParserServiceImportAndIncludeXSDsTest method testXSDImports.

@Test
public void testXSDImports() throws Exception {
    assertTrue(TEST_BUNDLE + " should correctly register blueprint container", waitForConfig());
    ParserService parserService = context().getService(ParserService.class);
    URL blueprintXML = context().getBundleByName(TEST_BUNDLE).getEntry("OSGI-INF/blueprint/ImportNamespacesWithXSDIncludeTest.xml");
    ComponentDefinitionRegistry cdr = parserService.parse(blueprintXML, context().getBundleByName(TEST_BUNDLE));
    assertNotNull(cdr.getComponentDefinition("aries-1682"));
}
Also used : ComponentDefinitionRegistry(org.apache.aries.blueprint.ComponentDefinitionRegistry) URL(java.net.URL) ParserService(org.apache.aries.blueprint.services.ParserService) Test(org.junit.Test)

Example 2 with ParserService

use of org.apache.aries.blueprint.services.ParserService in project aries by apache.

the class ParserServiceImportCmAndIncorrectNamespaceHandlersTest method testXSDImports.

@Test
public void testXSDImports() throws Exception {
    waitForConfig();
    ParserService parserService = context().getService(ParserService.class);
    URL blueprintXML = context().getBundleByName(TEST_BUNDLE).getEntry("OSGI-INF/blueprint/ImportIncorrectAndCmNamespacesTest.xml");
    ComponentDefinitionRegistry cdr = parserService.parse(blueprintXML, context().getBundleByName(TEST_BUNDLE));
    assertNotNull(cdr.getComponentDefinition("aries-1503"));
}
Also used : ComponentDefinitionRegistry(org.apache.aries.blueprint.ComponentDefinitionRegistry) URL(java.net.URL) ParserService(org.apache.aries.blueprint.services.ParserService) Test(org.junit.Test)

Example 3 with ParserService

use of org.apache.aries.blueprint.services.ParserService in project aries by apache.

the class ParserServiceImportXSDsBetweenNamespaceHandlersTest method testXSDImports.

@Test
public void testXSDImports() throws Exception {
    waitForConfig();
    ParserService parserService = context().getService(ParserService.class);
    URL blueprintXML = context().getBundleByName(TEST_BUNDLE).getEntry("OSGI-INF/blueprint/ImportNamespacesTest.xml");
    ComponentDefinitionRegistry cdr = parserService.parse(blueprintXML, context().getBundleByName(TEST_BUNDLE));
    assertNotNull(cdr.getComponentDefinition("aries-1503"));
}
Also used : ComponentDefinitionRegistry(org.apache.aries.blueprint.ComponentDefinitionRegistry) URL(java.net.URL) ParserService(org.apache.aries.blueprint.services.ParserService) Test(org.junit.Test)

Example 4 with ParserService

use of org.apache.aries.blueprint.services.ParserService in project aries by apache.

the class ParserServiceIgnoreUnknownNamespaceHandlerTest method testIgnoreTrue.

@Test
public void testIgnoreTrue() throws Exception {
    ParserService parserService = context().getService(ParserService.class);
    URL blueprintXML = context().getBundleByName(TEST_BUNDLE).getEntry("OSGI-INF/blueprint/context.xml");
    // ensure there is no error parsing while CM is stopped
    parserService.parse(blueprintXML, context().getBundleByName(TEST_BUNDLE));
}
Also used : URL(java.net.URL) ParserService(org.apache.aries.blueprint.services.ParserService) Test(org.junit.Test)

Example 5 with ParserService

use of org.apache.aries.blueprint.services.ParserService 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)

Aggregations

ParserService (org.apache.aries.blueprint.services.ParserService)5 URL (java.net.URL)4 Test (org.junit.Test)4 ComponentDefinitionRegistry (org.apache.aries.blueprint.ComponentDefinitionRegistry)3 NamespaceHandlerRegistry (org.apache.aries.blueprint.container.NamespaceHandlerRegistry)1 ParserServiceImpl (org.apache.aries.blueprint.container.ParserServiceImpl)1 NamespaceHandlerRegistryImpl (org.apache.aries.blueprint.namespace.NamespaceHandlerRegistryImpl)1 BundleContextMock (org.apache.aries.mocks.BundleContextMock)1 BundleContext (org.osgi.framework.BundleContext)1