Search in sources :

Example 6 with ParameterValueCreateVo

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);
}
Also used : ParameterValueCreateVo(org.ligoj.app.resource.node.ParameterValueCreateVo) ArrayList(java.util.ArrayList) Parameter(org.ligoj.app.model.Parameter) Test(org.junit.jupiter.api.Test) AbstractOrgTest(org.ligoj.app.resource.AbstractOrgTest)

Example 7 with ParameterValueCreateVo

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);
    });
}
Also used : ParameterValueCreateVo(org.ligoj.app.resource.node.ParameterValueCreateVo) ArrayList(java.util.ArrayList) Parameter(org.ligoj.app.model.Parameter) Test(org.junit.jupiter.api.Test) AbstractOrgTest(org.ligoj.app.resource.AbstractOrgTest)

Example 8 with ParameterValueCreateVo

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");
}
Also used : ParameterValueCreateVo(org.ligoj.app.resource.node.ParameterValueCreateVo) ValidationJsonException(org.ligoj.bootstrap.core.validation.ValidationJsonException) Test(org.junit.jupiter.api.Test) AbstractOrgTest(org.ligoj.app.resource.AbstractOrgTest)

Aggregations

ParameterValueCreateVo (org.ligoj.app.resource.node.ParameterValueCreateVo)8 ArrayList (java.util.ArrayList)7 Test (org.junit.jupiter.api.Test)5 AbstractOrgTest (org.ligoj.app.resource.AbstractOrgTest)5 Parameter (org.ligoj.app.model.Parameter)4 Project (org.ligoj.app.model.Project)1 ValidationJsonException (org.ligoj.bootstrap.core.validation.ValidationJsonException)1