Search in sources :

Example 1 with ConfigurablePlugin

use of org.ligoj.app.api.ConfigurablePlugin in project ligoj-api by ligoj.

the class ServicePluginLocatorTest method getResourceTypeParent.

@Test
public void getResourceTypeParent() {
    final ConfigurablePlugin resource = component.getResource(JiraBaseResource.KEY + ":any", ConfigurablePlugin.class);
    Assertions.assertNotNull(resource);
    Assertions.assertTrue(resource instanceof BugTrackerResource);
}
Also used : ConfigurablePlugin(org.ligoj.app.api.ConfigurablePlugin) BugTrackerResource(org.ligoj.app.resource.node.sample.BugTrackerResource) AbstractAppTest(org.ligoj.app.AbstractAppTest) Test(org.junit.jupiter.api.Test)

Example 2 with ConfigurablePlugin

use of org.ligoj.app.api.ConfigurablePlugin in project ligoj-api by ligoj.

the class ServicePluginLocatorTest method getResourceType.

@Test
public void getResourceType() {
    final ConfigurablePlugin resource = component.getResource(JiraBaseResource.KEY, ConfigurablePlugin.class);
    Assertions.assertNotNull(resource);
    Assertions.assertTrue(resource instanceof BugTrackerResource);
}
Also used : ConfigurablePlugin(org.ligoj.app.api.ConfigurablePlugin) BugTrackerResource(org.ligoj.app.resource.node.sample.BugTrackerResource) AbstractAppTest(org.ligoj.app.AbstractAppTest) Test(org.junit.jupiter.api.Test)

Example 3 with ConfigurablePlugin

use of org.ligoj.app.api.ConfigurablePlugin in project ligoj-api by ligoj.

the class SubscriptionResource method getConfiguration.

/**
 * Return tools specific configuration. Only non secured parameters are returned.
 *
 * @param id
 *            The subscription identifier.
 * @return tools specific configuration.
 * @throws Exception
 *             When the configuration gathering fails. Managed at JAX-RS level.
 */
@GET
@Path("{id:\\d+}/configuration")
@org.springframework.transaction.annotation.Transactional(readOnly = true)
public ConfigurationVo getConfiguration(@PathParam("id") final int id) throws Exception {
    // Copy subscription details
    final Subscription entity = checkVisibleSubscription(id);
    final ConfigurationVo vo = new ConfigurationVo();
    vo.setNode(NodeResource.toVo(entity.getNode()));
    vo.setParameters(getNonSecuredParameters(id));
    vo.setSubscription(id);
    vo.setProject(DescribedBean.clone(entity.getProject()));
    // Get specific configuration
    final ConfigurablePlugin servicePlugin = locator.getResource(vo.getNode().getId(), ConfigurablePlugin.class);
    if (servicePlugin != null) {
        // Specific configuration is available
        vo.setConfiguration(servicePlugin.getConfiguration(id));
    }
    return vo;
}
Also used : ConfigurablePlugin(org.ligoj.app.api.ConfigurablePlugin) ConfigurationVo(org.ligoj.app.api.ConfigurationVo) Subscription(org.ligoj.app.model.Subscription) Path(javax.ws.rs.Path) GET(javax.ws.rs.GET)

Aggregations

ConfigurablePlugin (org.ligoj.app.api.ConfigurablePlugin)3 Test (org.junit.jupiter.api.Test)2 AbstractAppTest (org.ligoj.app.AbstractAppTest)2 BugTrackerResource (org.ligoj.app.resource.node.sample.BugTrackerResource)2 GET (javax.ws.rs.GET)1 Path (javax.ws.rs.Path)1 ConfigurationVo (org.ligoj.app.api.ConfigurationVo)1 Subscription (org.ligoj.app.model.Subscription)1