use of org.mule.runtime.core.api.registry.ServiceRegistry in project mule by mulesoft.
the class CraftedExtensionModelLoaderTestCase method spiDiscoverable.
@Test
public void spiDiscoverable() throws Exception {
ServiceRegistry registry = new SpiServiceRegistry();
Optional<ExtensionModelLoader> craftedLoader = registry.lookupProviders(ExtensionModelLoader.class, classLoader).stream().filter(p -> p instanceof CraftedExtensionModelLoader).findAny();
assertThat(craftedLoader.isPresent(), is(true));
}
use of org.mule.runtime.core.api.registry.ServiceRegistry in project mule by mulesoft.
the class DefaultExtensionSchemaGeneratorTestCase method data.
@Parameterized.Parameters(name = "{1}")
public static Collection<Object[]> data() {
final ClassLoader classLoader = DefaultExtensionSchemaGeneratorTestCase.class.getClassLoader();
final ServiceRegistry serviceRegistry = mock(ServiceRegistry.class);
when(serviceRegistry.lookupProviders(DeclarationEnricher.class, classLoader)).thenReturn(asList(new JavaXmlDeclarationEnricher()));
final List<SchemaGeneratorTestUnit> extensions;
extensions = asList(newTestUnit(javaLoader, MapConnector.class, "map.xsd"), newTestUnit(javaLoader, ListConnector.class, "list.xsd"), newTestUnit(javaLoader, TestConnector.class, "basic.xsd"), newTestUnit(javaLoader, StringListConnector.class, "string-list.xsd"), newTestUnit(javaLoader, GlobalPojoConnector.class, "global-pojo.xsd"), newTestUnit(javaLoader, GlobalInnerPojoConnector.class, "global-inner-pojo.xsd"), newTestUnit(javaLoader, VeganExtension.class, "vegan.xsd"), newTestUnit(javaLoader, PetStoreConnector.class, "petstore.xsd"), newTestUnit(javaLoader, MetadataExtension.class, "metadata.xsd"), newTestUnit(javaLoader, HeisenbergExtension.class, "heisenberg.xsd"), newTestUnit(javaLoader, SubstitutionGroupExtension.class, "substitutiongroup.xsd"), newTestUnit(javaLoader, TransactionalExtension.class, "tx-ext.xsd"), newTestUnit(javaLoader, SubTypesMappingConnector.class, "subtypes.xsd"), newTestUnit(javaLoader, MarvelExtension.class, "marvel.xsd"), newTestUnit(soapLoader, FootballSoapExtension.class, "soap.xsd"), newTestUnit(soapLoader, RickAndMortyExtension.class, "ram.xsd"), newTestUnit(javaLoader, TypedValueExtension.class, "typed-value.xsd"), newTestUnit(javaLoader, TestOAuthExtension.class, "test-oauth.xsd"), newTestUnit(javaLoader, WeaveFunctionExtension.class, "test-fn.xsd"), newTestUnit(javaLoader, ValuesExtension.class, "values.xsd"), newTestUnit(javaLoader, ReconnectionExtension.class, "reconnection-extension.xsd"));
BiFunction<Class<?>, ExtensionModelLoader, ExtensionModel> createExtensionModel = (extension, loader) -> {
ExtensionModel model = loadExtension(extension, loader);
if (extensionModels.put(model.getName(), model) != null) {
throw new IllegalArgumentException(format("Extension names must be unique. Name [%s] for extension [%s] was already used", model.getName(), extension.getName()));
}
return model;
};
return extensions.stream().map(e -> new Object[] { createExtensionModel.apply(e.getExtensionClass(), e.getLoader()), e.getFileName() }).collect(toList());
}
use of org.mule.runtime.core.api.registry.ServiceRegistry in project mule by mulesoft.
the class ExtensionModelJsonGeneratorTestCase method data.
@Parameterized.Parameters(name = "{1}")
public static Collection<Object[]> data() {
final ClassLoader classLoader = ExtensionModelJsonGeneratorTestCase.class.getClassLoader();
final ServiceRegistry serviceRegistry = mock(ServiceRegistry.class);
when(serviceRegistry.lookupProviders(DeclarationEnricher.class, classLoader)).thenReturn(asList(new JavaXmlDeclarationEnricher()));
List<ExtensionJsonGeneratorTestUnit> extensions;
extensions = asList(newTestUnit(javaLoader, VeganExtension.class, "vegan.json"), newTestUnit(javaLoader, PetStoreConnector.class, "petstore.json"), newTestUnit(javaLoader, MetadataExtension.class, "metadata.json"), newTestUnit(javaLoader, HeisenbergExtension.class, "heisenberg.json"), newTestUnit(javaLoader, SubstitutionGroupExtension.class, "substitutiongroup.json"), newTestUnit(javaLoader, TransactionalExtension.class, "tx-ext.json"), newTestUnit(javaLoader, SubTypesMappingConnector.class, "subtypes.json"), newTestUnit(javaLoader, MarvelExtension.class, "marvel.json"), newTestUnit(soapLoader, RickAndMortyExtension.class, "ram.json"), newTestUnit(javaLoader, TypedValueExtension.class, "typed-value.json"), newTestUnit(javaLoader, TestOAuthExtension.class, "test-oauth.json"), newTestUnit(javaLoader, WeaveFunctionExtension.class, "test-fn.json"), newTestUnit(javaLoader, ValuesExtension.class, "values.json"), newTestUnit(javaLoader, ReconnectionExtension.class, "reconnection-extension.json"));
BiFunction<Class<?>, ExtensionModelLoader, ExtensionModel> createExtensionModel = (extension, loader) -> {
ExtensionModel model = loadExtension(extension, loader);
if (extensionModels.put(model.getName(), model) != null) {
throw new IllegalArgumentException(format("Extension names must be unique. Name [%s] for extension [%s] was already used", model.getName(), extension.getName()));
}
return model;
};
return extensions.stream().map(e -> new Object[] { createExtensionModel.apply(e.getExtensionClass(), e.getLoader()), e.getFileName() }).collect(toList());
}
use of org.mule.runtime.core.api.registry.ServiceRegistry in project mule by mulesoft.
the class MuleArtifactContext method createApplicationParser.
private XmlApplicationParser createApplicationParser(List<ClassLoader> pluginsClassLoaders) {
ExtensionManager extensionManager = muleContext.getExtensionManager();
ServiceRegistry customRegistry = extensionManager != null ? new XmlApplicationServiceRegistry(serviceRegistry, DslResolvingContext.getDefault(extensionManager.getExtensions())) : serviceRegistry;
return new XmlApplicationParser(customRegistry, pluginsClassLoaders);
}
Aggregations