Search in sources :

Example 11 with ApplicationDescriptor

use of org.mule.runtime.deployment.model.api.application.ApplicationDescriptor in project mule by mulesoft.

the class DefaultArchiveDeployerTestCase method createMockApplication.

private Application createMockApplication() {
    Application artifact = mock(Application.class);
    ApplicationDescriptor descriptor = mock(ApplicationDescriptor.class);
    when(descriptor.getDataFolderName()).thenReturn(ARTIFACT_ID);
    when(artifact.getDescriptor()).thenReturn(descriptor);
    when(artifact.getArtifactName()).thenReturn(ARTIFACT_ID);
    return artifact;
}
Also used : Application(org.mule.runtime.deployment.model.api.application.Application) ApplicationDescriptor(org.mule.runtime.deployment.model.api.application.ApplicationDescriptor)

Example 12 with ApplicationDescriptor

use of org.mule.runtime.deployment.model.api.application.ApplicationDescriptor 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

ApplicationDescriptor (org.mule.runtime.deployment.model.api.application.ApplicationDescriptor)12 File (java.io.File)6 Test (org.junit.Test)5 Application (org.mule.runtime.deployment.model.api.application.Application)3 Domain (org.mule.runtime.deployment.model.api.domain.Domain)3 Before (org.junit.Before)2 DomainDescriptor (org.mule.runtime.deployment.model.api.domain.DomainDescriptor)2 MuleApplicationClassLoader (org.mule.runtime.deployment.model.internal.application.MuleApplicationClassLoader)2 ArtifactClassLoader (org.mule.runtime.module.artifact.api.classloader.ArtifactClassLoader)2 ClassLoaderLookupPolicy (org.mule.runtime.module.artifact.api.classloader.ClassLoaderLookupPolicy)2 FileOutputStream (java.io.FileOutputStream)1 InputStream (java.io.InputStream)1 URL (java.net.URL)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 LinkedList (java.util.LinkedList)1 Properties (java.util.Properties)1 LoggerContext (org.apache.logging.log4j.core.LoggerContext)1 MavenClientProvider (org.mule.maven.client.api.MavenClientProvider)1 MuleApplicationModel (org.mule.runtime.api.deployment.meta.MuleApplicationModel)1