Search in sources :

Example 1 with DeployableMavenClassLoaderModelLoader

use of org.mule.runtime.module.deployment.impl.internal.application.DeployableMavenClassLoaderModelLoader in project mule by mulesoft.

the class MavenClassLoaderModelLoader method createClassLoaderModelLoaders.

private void createClassLoaderModelLoaders() {
    MavenClient mavenClient = mavenClientProvider.createMavenClient(mavenRuntimeConfig);
    deployableMavenClassLoaderModelLoader = new DeployableMavenClassLoaderModelLoader(mavenClient, mavenClientProvider.getLocalRepositorySuppliers());
    pluginMavenClassLoaderModelLoader = new PluginMavenClassLoaderModelLoader(mavenClient, mavenClientProvider.getLocalRepositorySuppliers());
    libFolderClassLoaderModelLoader = new LibFolderClassLoaderModelLoader();
}
Also used : MavenClient(org.mule.maven.client.api.MavenClient) DeployableMavenClassLoaderModelLoader(org.mule.runtime.module.deployment.impl.internal.application.DeployableMavenClassLoaderModelLoader) PluginMavenClassLoaderModelLoader(org.mule.runtime.module.deployment.impl.internal.plugin.PluginMavenClassLoaderModelLoader) LibFolderClassLoaderModelLoader(org.mule.runtime.module.service.internal.artifact.LibFolderClassLoaderModelLoader)

Example 2 with DeployableMavenClassLoaderModelLoader

use of org.mule.runtime.module.deployment.impl.internal.application.DeployableMavenClassLoaderModelLoader in project mule by mulesoft.

the class PolicyTemplateDescriptorFactoryTestCase method setUp.

@Before
public void setUp() throws Exception {
    when(descriptorLoaderRepository.get(FILE_SYSTEM_POLICY_MODEL_LOADER_ID, POLICY, ClassLoaderModelLoader.class)).thenReturn(new FileSystemPolicyClassLoaderModelLoader());
    when(descriptorLoaderRepository.get(INVALID_LOADER_ID, POLICY, ClassLoaderModelLoader.class)).thenThrow(new LoaderNotFoundException(INVALID_LOADER_ID));
    MavenClientProvider mavenClientProvider = MavenClientProvider.discoverProvider(currentThread().getContextClassLoader());
    when(descriptorLoaderRepository.get(MULE_LOADER_ID, POLICY, ClassLoaderModelLoader.class)).thenReturn(new DeployableMavenClassLoaderModelLoader(mavenClientProvider.createMavenClient(newMavenConfigurationBuilder().localMavenRepositoryLocation(mavenClientProvider.getLocalRepositorySuppliers().environmentMavenRepositorySupplier().get()).build()), mavenClientProvider.getLocalRepositorySuppliers()));
    when(descriptorLoaderRepository.get(PROPERTIES_BUNDLE_DESCRIPTOR_LOADER_ID, POLICY, BundleDescriptorLoader.class)).thenReturn(new PropertiesBundleDescriptorLoader());
    when(descriptorLoaderRepository.get(INVALID_LOADER_ID, POLICY, BundleDescriptorLoader.class)).thenThrow(new LoaderNotFoundException(INVALID_LOADER_ID));
}
Also used : DeployableMavenClassLoaderModelLoader(org.mule.runtime.module.deployment.impl.internal.application.DeployableMavenClassLoaderModelLoader) LoaderNotFoundException(org.mule.runtime.module.artifact.api.descriptor.LoaderNotFoundException) MavenClientProvider(org.mule.maven.client.api.MavenClientProvider) Before(org.junit.Before)

Example 3 with DeployableMavenClassLoaderModelLoader

use of org.mule.runtime.module.deployment.impl.internal.application.DeployableMavenClassLoaderModelLoader in project mule by mulesoft.

the class DefaultConnectivityTestingServiceBuilder method build.

/**
 * {@inheritDoc}
 */
@Override
public ConnectivityTestingService build() {
    checkState(artifactDeclaration != null, "artifact configuration cannot be null");
    return new TemporaryArtifactConnectivityTestingService(() -> {
        String applicationName = UUID.getUUID() + "-connectivity-testing-temp-app";
        File applicationFolder = new File(getExecutionFolder(), applicationName);
        ApplicationDescriptor applicationDescriptor = new ApplicationDescriptor(applicationName);
        applicationDescriptor.setArtifactDeclaration(artifactDeclaration);
        applicationDescriptor.setConfigResources(emptySet());
        applicationDescriptor.setArtifactLocation(applicationFolder);
        createDeployablePomFile(applicationFolder, model);
        updateArtifactPom(applicationFolder, model);
        MavenClientProvider mavenClientProvider = MavenClientProvider.discoverProvider(DefaultConnectivityTestingServiceBuilder.class.getClassLoader());
        applicationDescriptor.setClassLoaderModel(new DeployableMavenClassLoaderModelLoader(mavenClientProvider.createMavenClient(GlobalConfigLoader.getMavenConfig()), mavenClientProvider.getLocalRepositorySuppliers()).load(applicationFolder, emptyMap(), ArtifactType.APP));
        return defaultApplicationFactory.createArtifact(applicationDescriptor);
    });
}
Also used : DeployableMavenClassLoaderModelLoader(org.mule.runtime.module.deployment.impl.internal.application.DeployableMavenClassLoaderModelLoader) MavenClientProvider(org.mule.maven.client.api.MavenClientProvider) File(java.io.File) MavenUtils.createDeployablePomFile(org.mule.runtime.module.deployment.impl.internal.maven.MavenUtils.createDeployablePomFile) ApplicationDescriptor(org.mule.runtime.deployment.model.api.application.ApplicationDescriptor)

Aggregations

DeployableMavenClassLoaderModelLoader (org.mule.runtime.module.deployment.impl.internal.application.DeployableMavenClassLoaderModelLoader)3 MavenClientProvider (org.mule.maven.client.api.MavenClientProvider)2 File (java.io.File)1 Before (org.junit.Before)1 MavenClient (org.mule.maven.client.api.MavenClient)1 ApplicationDescriptor (org.mule.runtime.deployment.model.api.application.ApplicationDescriptor)1 LoaderNotFoundException (org.mule.runtime.module.artifact.api.descriptor.LoaderNotFoundException)1 MavenUtils.createDeployablePomFile (org.mule.runtime.module.deployment.impl.internal.maven.MavenUtils.createDeployablePomFile)1 PluginMavenClassLoaderModelLoader (org.mule.runtime.module.deployment.impl.internal.plugin.PluginMavenClassLoaderModelLoader)1 LibFolderClassLoaderModelLoader (org.mule.runtime.module.service.internal.artifact.LibFolderClassLoaderModelLoader)1