Search in sources :

Example 31 with ParameterValue

use of org.ligoj.app.model.ParameterValue in project ligoj-api by ligoj.

the class ParameterValueResourceTest method createTextEmptyPattern.

@Test
public void createTextEmptyPattern() {
    final ParameterValueCreateVo parameterValue = new ParameterValueCreateVo();
    parameterValue.setParameter(parameterRepository.findOne("c_170").getId());
    parameterValue.setText("va-l-u-9e");
    final ParameterValue entity = resource.createInternal(parameterValue);
    Assertions.assertEquals(parameterValue.getParameter(), entity.getParameter().getId());
    Assertions.assertEquals("va-l-u-9e", entity.getData());
}
Also used : ParameterValue(org.ligoj.app.model.ParameterValue) AbstractAppTest(org.ligoj.app.AbstractAppTest) Test(org.junit.jupiter.api.Test)

Example 32 with ParameterValue

use of org.ligoj.app.model.ParameterValue in project ligoj-api by ligoj.

the class ParameterValueResourceTest method createText.

@Test
public void createText() {
    final ParameterValueCreateVo parameterValue = new ParameterValueCreateVo();
    parameterValue.setParameter(parameterRepository.findOne("c_2").getId());
    parameterValue.setText("value");
    final ParameterValue entity = resource.createInternal(parameterValue);
    Assertions.assertEquals(parameterValue.getParameter(), entity.getParameter().getId());
    Assertions.assertEquals("value", entity.getData());
}
Also used : ParameterValue(org.ligoj.app.model.ParameterValue) AbstractAppTest(org.ligoj.app.AbstractAppTest) Test(org.junit.jupiter.api.Test)

Example 33 with ParameterValue

use of org.ligoj.app.model.ParameterValue in project ligoj-api by ligoj.

the class ParameterValueResourceTest method createBoolean.

@Test
public void createBoolean() {
    final ParameterValueCreateVo parameterValue = new ParameterValueCreateVo();
    parameterValue.setParameter(parameterRepository.findOne("c_5").getId());
    parameterValue.setBool(Boolean.TRUE);
    final ParameterValue entity = resource.createInternal(parameterValue);
    Assertions.assertEquals(parameterValue.getParameter(), entity.getParameter().getId());
    Assertions.assertEquals(parameterValue.getBool().toString(), entity.getData());
}
Also used : ParameterValue(org.ligoj.app.model.ParameterValue) AbstractAppTest(org.ligoj.app.AbstractAppTest) Test(org.junit.jupiter.api.Test)

Example 34 with ParameterValue

use of org.ligoj.app.model.ParameterValue in project ligoj-api by ligoj.

the class ParameterValueResourceTest method createIndex.

@Test
public void createIndex() {
    final ParameterValueCreateVo parameterValue = new ParameterValueCreateVo();
    parameterValue.setParameter(parameterRepository.findOne("c_3").getId());
    parameterValue.setIndex(1);
    final ParameterValue entity = resource.createInternal(parameterValue);
    Assertions.assertEquals(parameterValue.getParameter(), entity.getParameter().getId());
    Assertions.assertEquals("1", entity.getData());
}
Also used : ParameterValue(org.ligoj.app.model.ParameterValue) AbstractAppTest(org.ligoj.app.AbstractAppTest) Test(org.junit.jupiter.api.Test)

Example 35 with ParameterValue

use of org.ligoj.app.model.ParameterValue in project ligoj-api by ligoj.

the class ParameterValueResourceTest method findIntegerNoData.

@Test
public void findIntegerNoData() {
    final Parameter parameter = parameterRepository.findOne("c_4");
    parameter.setData(null);
    final ParameterValue parameterValueEntity = newParameterValue("1", parameter);
    em.persist(parameterValueEntity);
    em.flush();
    final ParameterValueVo valueVo = resource.toVo(parameterValueEntity);
    Assertions.assertEquals(parameter.getId(), valueVo.getParameter().getId());
    Assertions.assertEquals(1, valueVo.getInteger().intValue());
    Assertions.assertNotNull(valueVo.getCreatedDate());
    Assertions.assertNotNull(valueVo.getCreatedBy());
}
Also used : ParameterValue(org.ligoj.app.model.ParameterValue) Parameter(org.ligoj.app.model.Parameter) AbstractAppTest(org.ligoj.app.AbstractAppTest) Test(org.junit.jupiter.api.Test)

Aggregations

ParameterValue (org.ligoj.app.model.ParameterValue)35 Test (org.junit.jupiter.api.Test)28 AbstractAppTest (org.ligoj.app.AbstractAppTest)27 Parameter (org.ligoj.app.model.Parameter)16 ArrayList (java.util.ArrayList)7 Node (org.ligoj.app.model.Node)6 HashMap (java.util.HashMap)5 Subscription (org.ligoj.app.model.Subscription)4 Date (java.util.Date)3 List (java.util.List)3 Map (java.util.Map)3 Function (java.util.function.Function)3 Collectors (java.util.stream.Collectors)3 NodeStatus (org.ligoj.app.api.NodeStatus)3 NodeVo (org.ligoj.app.api.NodeVo)3 Collection (java.util.Collection)2 Entry (java.util.Map.Entry)2 Optional (java.util.Optional)2 BiFunction (java.util.function.BiFunction)2 CacheRemoveAll (javax.cache.annotation.CacheRemoveAll)2