use of org.ligoj.app.resource.node.ParameterValueCreateVo in project ligoj-api by ligoj.
the class SubscriptionResourceTest method checkMandatoryParametersMandatoryNotMode.
@Test
public void checkMandatoryParametersMandatoryNotMode() {
final List<ParameterValueCreateVo> parameters = new ArrayList<>();
final List<Parameter> acceptedParameters = new ArrayList<>();
final Parameter parameter = new Parameter();
parameter.setId("p");
parameter.setMandatory(true);
parameter.setMode(SubscriptionMode.CREATE);
acceptedParameters.add(parameter);
resource.checkMandatoryParameters(parameters, acceptedParameters, SubscriptionMode.LINK);
}
use of org.ligoj.app.resource.node.ParameterValueCreateVo in project ligoj-api by ligoj.
the class SubscriptionResourceTest method checkMandatoryParametersMandatory.
@Test
public void checkMandatoryParametersMandatory() {
final List<ParameterValueCreateVo> parameters = new ArrayList<>();
final List<Parameter> acceptedParameters = new ArrayList<>();
final Parameter parameter = new Parameter();
parameter.setId("p");
parameter.setMandatory(true);
acceptedParameters.add(parameter);
Assertions.assertThrows(ValidationJsonException.class, () -> {
resource.checkMandatoryParameters(parameters, acceptedParameters, null);
});
}
use of org.ligoj.app.resource.node.ParameterValueCreateVo in project ligoj-api by ligoj.
the class SubscriptionResourceTest method createNotAcceptedParameter.
@Test
public void createNotAcceptedParameter() {
final SubscriptionEditionVo vo = newCreateVoBadParameters();
final ParameterValueCreateVo parameterValueEditionVo2 = new ParameterValueCreateVo();
parameterValueEditionVo2.setParameter("service:bt:jira:pkey");
parameterValueEditionVo2.setText("MYPROJECT");
vo.getParameters().add(parameterValueEditionVo2);
final ParameterValueCreateVo parameterValueEditionVo3 = new ParameterValueCreateVo();
parameterValueEditionVo3.setParameter("service:bt:jira:jdbc-password");
parameterValueEditionVo3.setInteger(1007400);
vo.getParameters().add(parameterValueEditionVo3);
MatcherUtil.assertThrows(Assertions.assertThrows(ValidationJsonException.class, () -> {
resource.create(vo);
}), JiraBaseResource.PARAMETER_JDBC_PASSSWORD, "not-accepted-parameter");
}
Aggregations