Search in sources :

Example 1 with ImportCatalogResource

use of org.ligoj.app.plugin.prov.in.ImportCatalogResource in project plugin-prov-azure by ligoj.

the class ProvAzurePriceImportResourceTest method prepareData.

@BeforeEach
public void prepareData() throws IOException {
    persistSystemEntities();
    persistEntities("csv", new Class[] { Node.class, Project.class, CacheCompany.class, CacheUser.class, DelegateNode.class, Parameter.class, ProvLocation.class, Subscription.class, ParameterValue.class, ProvQuote.class }, StandardCharsets.UTF_8.name());
    this.subscription = getSubscription("gStack");
    // Disable inner transaction
    this.resource = new ProvAzurePriceImportResource();
    applicationContext.getAutowireCapableBeanFactory().autowireBean(resource);
    this.resource.initRate();
    this.resource.initVmTenancy();
    this.resource.initRegion();
    this.resource.setImportCatalogResource(new ImportCatalogResource());
    applicationContext.getAutowireCapableBeanFactory().autowireBean(this.resource.getImportCatalogResource());
    configuration.delete(ProvAzurePriceImportResource.CONF_REGIONS);
    initSpringSecurityContext(DEFAULT_USER);
    resetImportTask();
    final ProvUsage usage = new ProvUsage();
    usage.setName("36month");
    usage.setRate(100);
    usage.setDuration(36);
    usage.setConfiguration(repository.findBy("subscription.id", subscription));
    em.persist(usage);
    em.flush();
    em.clear();
}
Also used : ProvUsage(org.ligoj.app.plugin.prov.model.ProvUsage) ImportCatalogResource(org.ligoj.app.plugin.prov.in.ImportCatalogResource) BeforeEach(org.junit.jupiter.api.BeforeEach)

Aggregations

BeforeEach (org.junit.jupiter.api.BeforeEach)1 ImportCatalogResource (org.ligoj.app.plugin.prov.in.ImportCatalogResource)1 ProvUsage (org.ligoj.app.plugin.prov.model.ProvUsage)1