Search in sources :

Example 6 with ServicePluginLocator

use of org.ligoj.app.resource.ServicePluginLocator in project plugin-prov by ligoj.

the class TerraformResourceTest method applyTerraformError.

/**
 * IOException during the asynchronous execution
 */
@Test
public void applyTerraformError() {
    final TerraformResource resource = new TerraformResource() {

        @Override
        protected File applyTerraform(final Subscription entity, final Terraforming terra, final QuoteVo configuration) throws IOException {
            throw new IOException();
        }
    };
    super.applicationContext.getAutowireCapableBeanFactory().autowireBean(resource);
    // Mock to disable inner transactions for this test
    resource.resource = Mockito.mock(ProvResource.class);
    final ServicePluginLocator locator = Mockito.mock(ServicePluginLocator.class);
    // Replace the plugin locator
    resource.locator = locator;
    Mockito.when(locator.getResource("service:prov:test:account", Terraforming.class)).thenReturn(Mockito.mock(Terraforming.class));
    resource.applyTerraform(subscription);
}
Also used : ProvResource(org.ligoj.app.plugin.prov.ProvResource) QuoteVo(org.ligoj.app.plugin.prov.QuoteVo) IOException(java.io.IOException) Subscription(org.ligoj.app.model.Subscription) ServicePluginLocator(org.ligoj.app.resource.ServicePluginLocator) AbstractAppTest(org.ligoj.app.AbstractAppTest) Test(org.junit.jupiter.api.Test)

Aggregations

ServicePluginLocator (org.ligoj.app.resource.ServicePluginLocator)6 ToolPlugin (org.ligoj.app.api.ToolPlugin)3 JenkinsPluginResource (org.ligoj.app.resource.node.sample.JenkinsPluginResource)3 TechnicalException (org.ligoj.bootstrap.core.resource.TechnicalException)3 Test (org.junit.jupiter.api.Test)2 AbstractAppTest (org.ligoj.app.AbstractAppTest)2 Subscription (org.ligoj.app.model.Subscription)2 QuoteVo (org.ligoj.app.plugin.prov.QuoteVo)2 JiraPluginResource (org.ligoj.app.resource.node.sample.JiraPluginResource)2 SonarPluginResource (org.ligoj.app.resource.node.sample.SonarPluginResource)2 IOException (java.io.IOException)1 SubscriptionStatusWithData (org.ligoj.app.api.SubscriptionStatusWithData)1 DelegateNode (org.ligoj.app.model.DelegateNode)1 Node (org.ligoj.app.model.Node)1 TaskSampleNode (org.ligoj.app.model.TaskSampleNode)1 ProvResource (org.ligoj.app.plugin.prov.ProvResource)1 PluginsClassLoader (org.ligoj.app.resource.plugin.PluginsClassLoader)1 ApplicationContext (org.springframework.context.ApplicationContext)1