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;
});
}
}
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());
}
}
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);
}
}
Aggregations