Search in sources :

Example 16 with ConqueryConfig

use of com.bakdata.conquery.models.config.ConqueryConfig in project conquery by bakdata.

the class IntegrationTests method readTest.

private static DynamicTest readTest(Resource resource, String name, IntegrationTests integrationTests) {
    try (InputStream in = resource.open()) {
        JsonIntegrationTest test = new JsonIntegrationTest(in);
        ConqueryConfig conf = getConfigOverride(test, integrationTests.getWorkDir());
        name = test.getTestSpec().getLabel();
        TestConquery conquery = getCachedConqueryInstance(integrationTests.getWorkDir(), conf);
        return DynamicTest.dynamicTest(name, URI.create("classpath:/" + resource.getPath()), new IntegrationTest.Wrapper(name, conquery, test));
    } catch (Exception e) {
        return DynamicTest.dynamicTest(name, resource.getURI(), () -> {
            throw e;
        });
    }
}
Also used : JsonIntegrationTest(com.bakdata.conquery.integration.json.JsonIntegrationTest) TestConquery(com.bakdata.conquery.util.support.TestConquery) InputStream(java.io.InputStream) ConqueryConfig(com.bakdata.conquery.models.config.ConqueryConfig) ProgrammaticIntegrationTest(com.bakdata.conquery.integration.tests.ProgrammaticIntegrationTest) JsonIntegrationTest(com.bakdata.conquery.integration.json.JsonIntegrationTest) IOException(java.io.IOException)

Example 17 with ConqueryConfig

use of com.bakdata.conquery.models.config.ConqueryConfig 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)

Example 18 with ConqueryConfig

use of com.bakdata.conquery.models.config.ConqueryConfig in project conquery by bakdata.

the class Cloner method clone.

public static <T> ConqueryConfig clone(ConqueryConfig config, Map<Class<T>, T> injectables, ObjectMapper mapper) {
    try {
        MutableInjectableValues injectableHolder = ((MutableInjectableValues) mapper.getInjectableValues());
        for (Entry<Class<T>, T> injectable : injectables.entrySet()) {
            injectableHolder.add(injectable.getKey(), injectable.getValue());
        }
        ConqueryConfig clone = mapper.readValue(mapper.writeValueAsBytes(config), ConqueryConfig.class);
        clone.setLoggingFactory(config.getLoggingFactory());
        return clone;
    } catch (IOException e) {
        throw new IllegalStateException("Failed to clone a conquery config " + config, e);
    }
}
Also used : MutableInjectableValues(com.bakdata.conquery.io.jackson.MutableInjectableValues) ConqueryConfig(com.bakdata.conquery.models.config.ConqueryConfig) IOException(java.io.IOException)

Aggregations

ConqueryConfig (com.bakdata.conquery.models.config.ConqueryConfig)18 Test (org.junit.jupiter.api.Test)7 Namespace (com.bakdata.conquery.models.worker.Namespace)3 IOException (java.io.IOException)3 PreprocessorCommand (com.bakdata.conquery.commands.PreprocessorCommand)2 MutableInjectableValues (com.bakdata.conquery.io.jackson.MutableInjectableValues)2 IdPrinter (com.bakdata.conquery.models.identifiable.mapping.IdPrinter)2 ManagedQuery (com.bakdata.conquery.models.query.ManagedQuery)2 PrintSettings (com.bakdata.conquery.models.query.PrintSettings)2 ResultInfo (com.bakdata.conquery.models.query.resultinfo.ResultInfo)2 DatasetRegistry (com.bakdata.conquery.models.worker.DatasetRegistry)2 ArrayList (java.util.ArrayList)2 List (java.util.List)2 CollectEntitiesCommand (com.bakdata.conquery.commands.CollectEntitiesCommand)1 MigrateCommand (com.bakdata.conquery.commands.MigrateCommand)1 RecodeStoreCommand (com.bakdata.conquery.commands.RecodeStoreCommand)1 ShardNode (com.bakdata.conquery.commands.ShardNode)1 StandaloneCommand (com.bakdata.conquery.commands.StandaloneCommand)1 JsonIntegrationTest (com.bakdata.conquery.integration.json.JsonIntegrationTest)1 ProgrammaticIntegrationTest (com.bakdata.conquery.integration.tests.ProgrammaticIntegrationTest)1