Search in sources :

Example 1 with FormConfigFullRepresentation

use of com.bakdata.conquery.models.forms.configs.FormConfig.FormConfigFullRepresentation in project conquery by bakdata.

the class FormConfigTest method getConfig.

@Test
public void getConfig() {
    // PREPARE
    user.addPermission(dataset.createPermission(Ability.READ.asSet()));
    ObjectMapper mapper = FormConfigProcessor.getMAPPER();
    JsonNode values = mapper.valueToTree(form);
    FormConfig formConfig = new FormConfig(form.getClass().getAnnotation(CPSType.class).id(), values);
    formConfig.setDataset(dataset);
    formConfig.setOwner(user);
    user.addPermission(formConfig.createPermission(Ability.READ.asSet()));
    storage.addFormConfig(formConfig);
    // EXECUTE
    FormConfigFullRepresentation response = processor.getConfig(user, formConfig);
    // CHECK
    assertThat(response).usingRecursiveComparison().ignoringFields(FormConfigOverviewRepresentation.Fields.createdAt).isEqualTo(FormConfigFullRepresentation.builder().formType(form.getClass().getAnnotation(CPSType.class).id()).id(formConfig.getId()).label(formConfig.getLabel()).own(true).ownerName(user.getLabel()).shared(false).groups(Collections.emptySet()).system(false).tags(formConfig.getTags()).values(values).build());
}
Also used : FormConfig(com.bakdata.conquery.models.forms.configs.FormConfig) JsonNode(com.fasterxml.jackson.databind.JsonNode) FormConfigFullRepresentation(com.bakdata.conquery.models.forms.configs.FormConfig.FormConfigFullRepresentation) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) CPSType(com.bakdata.conquery.io.cps.CPSType) Test(org.junit.jupiter.api.Test)

Aggregations

CPSType (com.bakdata.conquery.io.cps.CPSType)1 FormConfig (com.bakdata.conquery.models.forms.configs.FormConfig)1 FormConfigFullRepresentation (com.bakdata.conquery.models.forms.configs.FormConfig.FormConfigFullRepresentation)1 JsonNode (com.fasterxml.jackson.databind.JsonNode)1 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 Test (org.junit.jupiter.api.Test)1