use of org.ligoj.app.api.ConfigurationVo in project ligoj-api by ligoj.
the class SubscriptionResourceTest method getConfiguration.
@Test
public void getConfiguration() throws Exception {
final int subscription = repository.findByExpected("node.id", "service:vm:vcloud:sample").getId();
final ConfigurationVo configuration = resource.getConfiguration(subscription);
// Not secured parameter
Assertions.assertEquals("http://localhost:8120", configuration.getParameters().get("service:vm:vcloud:url"));
// Secured parameter
Assertions.assertNull(configuration.getParameters().get("service:vm:vcloud:user"));
Assertions.assertEquals(subscription, configuration.getSubscription());
Assertions.assertEquals("gStack", configuration.getProject().getName());
Assertions.assertEquals("service:vm:vcloud:sample", configuration.getNode().getId());
Assertions.assertNotNull(configuration.getConfiguration());
}
use of org.ligoj.app.api.ConfigurationVo in project ligoj-api by ligoj.
the class SubscriptionResourceTest method getConfigurationNone.
@Test
public void getConfigurationNone() throws Exception {
final int subscription = repository.findByExpected("node.id", "service:km:confluence:dig").getId();
final ConfigurationVo configuration = resource.getConfiguration(subscription);
Assertions.assertEquals(subscription, configuration.getSubscription());
Assertions.assertEquals("gStack", configuration.getProject().getName());
Assertions.assertEquals("service:km:confluence:dig", configuration.getNode().getId());
// No configuration for Confluence
Assertions.assertNull(configuration.getConfiguration());
}
use of org.ligoj.app.api.ConfigurationVo 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;
}
Aggregations