Search in sources :

Example 11 with ConqueryConfig

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

the class DecimalParserTest method test.

@Test
public void test() {
    final DecimalParser parser = new DecimalParser(new ConqueryConfig());
    parser.addLine(BigDecimal.valueOf(10, 1000));
    parser.addLine(BigDecimal.valueOf(30, 1000));
    assertThat(parser.decideType()).isInstanceOf(DecimalTypeScaled.class);
    parser.addLine(BigDecimal.valueOf(2, 62));
    assertThat(parser.decideType()).isInstanceOf(DecimalArrayStore.class);
}
Also used : ConqueryConfig(com.bakdata.conquery.models.config.ConqueryConfig) Test(org.junit.jupiter.api.Test)

Example 12 with ConqueryConfig

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

the class IntegerParserTest method test.

@ParameterizedTest
@MethodSource("arguments")
public void test(long min, long max, Consumer<IntegerStore> test) {
    final IntegerParser parser = new IntegerParser(new ConqueryConfig());
    parser.setMinValue(min);
    parser.setMaxValue(max);
    assertThat(parser.decideType()).satisfies(test);
}
Also used : ConqueryConfig(com.bakdata.conquery.models.config.ConqueryConfig) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) MethodSource(org.junit.jupiter.params.provider.MethodSource)

Example 13 with ConqueryConfig

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

the class TestConquery method createSupport.

private synchronized StandaloneSupport createSupport(DatasetId datasetId, String name) {
    DatasetRegistry datasets = standaloneCommand.getManager().getDatasetRegistry();
    Namespace ns = datasets.get(datasetId);
    assertThat(datasets.getShardNodes()).hasSize(2);
    // make tmp subdir and change cfg accordingly
    File localTmpDir = new File(tmpDir, "tmp_" + name);
    if (!localTmpDir.exists()) {
        if (!localTmpDir.mkdir()) {
            throw new IllegalStateException("Could not create directory for Support");
        }
    } else {
        log.info("Reusing existing folder {} for Support", localTmpDir.getPath());
    }
    ConqueryConfig localCfg = Cloner.clone(config, Map.of(Validator.class, standaloneCommand.getManager().getEnvironment().getValidator()), IntegrationTests.MAPPER);
    StandaloneSupport support = new StandaloneSupport(this, ns, ns.getStorage().getDataset(), localTmpDir, localCfg, standaloneCommand.getManager().getAdmin().getAdminProcessor(), standaloneCommand.getManager().getAdmin().getAdminDatasetProcessor(), // Getting the User from AuthorizationConfig
    testUser);
    Wait.builder().total(Duration.ofSeconds(5)).stepTime(Duration.ofMillis(5)).build().until(() -> ns.getWorkers().size() == ns.getNamespaces().getShardNodes().size());
    support.waitUntilWorkDone();
    openSupports.add(support);
    return support;
}
Also used : ConqueryConfig(com.bakdata.conquery.models.config.ConqueryConfig) DatasetRegistry(com.bakdata.conquery.models.worker.DatasetRegistry) File(java.io.File) Namespace(com.bakdata.conquery.models.worker.Namespace) Validator(javax.validation.Validator)

Example 14 with ConqueryConfig

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

the class AddWorker method react.

@Override
public void react(ShardNodeNetworkContext context) throws Exception {
    log.info("creating a new worker for {}", dataset);
    ConqueryConfig config = context.getConfig();
    Worker worker = context.getWorkers().createWorker(dataset, config.getStorage(), createWorkerName(), context.getValidator(), config.isFailOnError());
    worker.setSession(context.getRawSession());
    context.send(new RegisterWorker(worker.getInfo()));
}
Also used : ConqueryConfig(com.bakdata.conquery.models.config.ConqueryConfig) Worker(com.bakdata.conquery.models.worker.Worker)

Example 15 with ConqueryConfig

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

the class Conquery method initialize.

@Override
public void initialize(Bootstrap<ConqueryConfig> bootstrap) {
    final ObjectMapper confMapper = bootstrap.getObjectMapper();
    Jackson.configure(confMapper);
    confMapper.setConfig(confMapper.getDeserializationConfig().withView(InternalOnly.class));
    // check for java compiler, needed for the class generation
    if (ToolProvider.getSystemJavaCompiler() == null) {
        throw new IllegalStateException("Conquery requires to be run on either a JDK or a ServerJRE");
    }
    // main config file is json
    bootstrap.setConfigurationFactoryFactory(JsonConfigurationFactory::new);
    bootstrap.addCommand(new ShardNode());
    bootstrap.addCommand(new PreprocessorCommand());
    bootstrap.addCommand(new CollectEntitiesCommand());
    bootstrap.addCommand(new StandaloneCommand(this));
    bootstrap.addCommand(new RecodeStoreCommand());
    bootstrap.addCommand(new MigrateCommand());
    ((MutableInjectableValues) confMapper.getInjectableValues()).add(Validator.class, bootstrap.getValidatorFactory().getValidator());
    // do some setup in other classes after initialization but before running a
    // command
    bootstrap.addBundle(new ConfiguredBundle<>() {

        @Override
        public void run(ConqueryConfig configuration, Environment environment) {
            configuration.configureObjectMapper(environment.getObjectMapper());
        }

        @Override
        public void initialize(Bootstrap<?> bootstrap) {
            // Allow overriding of config from environment variables.
            bootstrap.setConfigurationSourceProvider(new SubstitutingSourceProvider(bootstrap.getConfigurationSourceProvider(), StringSubstitutor.createInterpolator()));
        }
    });
}
Also used : JsonConfigurationFactory(io.dropwizard.configuration.JsonConfigurationFactory) CollectEntitiesCommand(com.bakdata.conquery.commands.CollectEntitiesCommand) MutableInjectableValues(com.bakdata.conquery.io.jackson.MutableInjectableValues) PreprocessorCommand(com.bakdata.conquery.commands.PreprocessorCommand) InternalOnly(com.bakdata.conquery.io.jackson.InternalOnly) StandaloneCommand(com.bakdata.conquery.commands.StandaloneCommand) MigrateCommand(com.bakdata.conquery.commands.MigrateCommand) SubstitutingSourceProvider(io.dropwizard.configuration.SubstitutingSourceProvider) ShardNode(com.bakdata.conquery.commands.ShardNode) RecodeStoreCommand(com.bakdata.conquery.commands.RecodeStoreCommand) ConqueryConfig(com.bakdata.conquery.models.config.ConqueryConfig) Environment(io.dropwizard.setup.Environment) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper)

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