Search in sources :

Example 16 with ResultInfo

use of com.bakdata.conquery.models.query.resultinfo.ResultInfo in project conquery by bakdata.

the class SecondaryIdQuery method getResultInfos.

@Override
public List<ResultInfo> getResultInfos() {
    List<ResultInfo> resultInfos = new ArrayList<>();
    resultInfos.add(new SimpleResultInfo(secondaryId.getName(), ResultType.IdT.INSTANCE));
    resultInfos.addAll(query.getResultInfos());
    return resultInfos;
}
Also used : SimpleResultInfo(com.bakdata.conquery.models.query.resultinfo.SimpleResultInfo) ArrayList(java.util.ArrayList) SimpleResultInfo(com.bakdata.conquery.models.query.resultinfo.SimpleResultInfo) ResultInfo(com.bakdata.conquery.models.query.resultinfo.ResultInfo)

Example 17 with ResultInfo

use of com.bakdata.conquery.models.query.resultinfo.ResultInfo in project conquery by bakdata.

the class FormTest method checkResults.

private void checkResults(StandaloneSupport standaloneSupport, ManagedForm managedForm, User user) throws IOException {
    Map<String, List<ManagedQuery>> managedMapping = managedForm.getSubQueries();
    IdPrinter idPrinter = standaloneSupport.getConfig().getFrontend().getQueryUpload().getIdPrinter(user, managedForm, standaloneSupport.getNamespace());
    final ConqueryConfig config = standaloneSupport.getConfig();
    PrintSettings PRINT_SETTINGS = new PrintSettings(false, Locale.ENGLISH, standaloneSupport.getDatasetsProcessor().getDatasetRegistry(), config, idPrinter::createId);
    CsvLineStreamRenderer renderer = new CsvLineStreamRenderer(config.getCsv().createWriter(), PRINT_SETTINGS);
    for (Map.Entry<String, List<ManagedQuery>> managed : managedMapping.entrySet()) {
        List<ResultInfo> resultInfos = managed.getValue().get(0).getResultInfos();
        log.info("{} CSV TESTING: {}", getLabel(), managed.getKey());
        List<String> actual = renderer.toStream(config.getFrontend().getQueryUpload().getIdResultInfos(), resultInfos, managed.getValue().stream().flatMap(ManagedQuery::streamResults)).collect(Collectors.toList());
        assertThat(actual).as("Checking result " + managed.getKey()).containsExactlyInAnyOrderElementsOf(In.stream(expectedCsv.get(managed.getKey()).stream()).withUTF8().readLines());
    }
}
Also used : IdPrinter(com.bakdata.conquery.models.identifiable.mapping.IdPrinter) CsvLineStreamRenderer(com.bakdata.conquery.io.result.CsvLineStreamRenderer) ConqueryConfig(com.bakdata.conquery.models.config.ConqueryConfig) PrintSettings(com.bakdata.conquery.models.query.PrintSettings) List(java.util.List) ManagedQuery(com.bakdata.conquery.models.query.ManagedQuery) ResultInfo(com.bakdata.conquery.models.query.resultinfo.ResultInfo) Map(java.util.Map)

Aggregations

ResultInfo (com.bakdata.conquery.models.query.resultinfo.ResultInfo)17 ArrayList (java.util.ArrayList)10 ManagedQuery (com.bakdata.conquery.models.query.ManagedQuery)6 PrintSettings (com.bakdata.conquery.models.query.PrintSettings)6 List (java.util.List)6 ConqueryConfig (com.bakdata.conquery.models.config.ConqueryConfig)5 ResultType (com.bakdata.conquery.models.externalservice.ResultType)5 I18n (com.bakdata.conquery.models.i18n.I18n)5 Locale (java.util.Locale)5 SelectResultInfo (com.bakdata.conquery.models.query.resultinfo.SelectResultInfo)4 UniqueNamer (com.bakdata.conquery.models.query.resultinfo.UniqueNamer)4 EntityResult (com.bakdata.conquery.models.query.results.EntityResult)4 StringJoiner (java.util.StringJoiner)4 Slf4j (lombok.extern.slf4j.Slf4j)4 CQConcept (com.bakdata.conquery.apiv1.query.concept.specific.CQConcept)3 ResultTestUtil (com.bakdata.conquery.io.result.ResultTestUtil)3 EntityPrintId (com.bakdata.conquery.models.identifiable.mapping.EntityPrintId)3 IOException (java.io.IOException)3 Stream (java.util.stream.Stream)3 Cell (org.apache.poi.ss.usermodel.Cell)3