use of com.bakdata.conquery.models.datasets.concepts.ValidityDate in project conquery by bakdata.
the class SerializationTests method treeConcept.
@Test
public void treeConcept() throws IOException, JSONException {
Dataset dataset = new Dataset();
dataset.setName("datasetName");
TreeConcept concept = new TreeConcept();
concept.setDataset(dataset);
concept.setLabel("conceptLabel");
concept.setName("conceptName");
Table table = new Table();
Column column = new Column();
column.setLabel("colLabel");
column.setName("colName");
column.setType(MajorTypeId.STRING);
column.setTable(table);
Column dateColumn = new Column();
dateColumn.setLabel("colLabel2");
dateColumn.setName("colName2");
dateColumn.setType(MajorTypeId.DATE);
dateColumn.setTable(table);
table.setColumns(new Column[] { column, dateColumn });
table.setDataset(dataset);
table.setLabel("tableLabel");
table.setName("tableName");
column.setTable(table);
ConceptTreeConnector connector = new ConceptTreeConnector();
connector.setConcept(concept);
connector.setLabel("connLabel");
connector.setName("connName");
connector.setColumn(column);
concept.setConnectors(List.of(connector));
ValidityDate valDate = new ValidityDate();
valDate.setColumn(dateColumn);
valDate.setConnector(connector);
valDate.setLabel("valLabel");
valDate.setName("valName");
connector.setValidityDates(List.of(valDate));
CentralRegistry registry = new CentralRegistry();
registry.register(dataset);
registry.register(concept);
registry.register(column);
registry.register(dateColumn);
registry.register(table);
registry.register(connector);
registry.register(valDate);
final Validator validator = Validators.newValidator();
concept.setValidator(validator);
SerializationTestUtil.forType(TreeConcept.class).registry(registry).injectables(new Injectable() {
@Override
public MutableInjectableValues inject(MutableInjectableValues values) {
return values.add(Validator.class, validator);
}
}).test(concept);
}
use of com.bakdata.conquery.models.datasets.concepts.ValidityDate in project conquery by bakdata.
the class FEValueTest method sortedValidityDates.
@Test
public void sortedValidityDates() {
Dataset dataset = new Dataset();
dataset.setName("testDataset");
Table table = new Table();
table.setDataset(dataset);
table.setName("testTable");
Column column = new Column();
column.setName("testColumn");
column.setTable(table);
ConceptTreeConnector connector = new ConceptTreeConnector();
connector.setName("testConnector");
TreeConcept concept = new TreeConcept();
concept.setDataset(dataset);
concept.setName("testConcept");
ValidityDate val0 = new ValidityDate();
val0.setName("val0");
val0.setConnector(connector);
ValidityDate val1 = new ValidityDate();
val1.setName("val1");
val1.setConnector(connector);
ValidityDate val2 = new ValidityDate();
val2.setName("val2");
val2.setConnector(connector);
List<ValidityDate> validityDates = List.of(val0, val1, val2);
connector.setColumn(column);
connector.setConcept(concept);
connector.setValidityDates(validityDates);
FETable feTable = FrontEndConceptBuilder.createTable(connector);
assertThat(feTable.getDateColumn().getOptions()).containsExactly(new FEValue("val0", val0.getId().toString()), new FEValue("val1", val1.getId().toString()), new FEValue("val2", val2.getId().toString()));
}
Aggregations