Search in sources :

Example 1 with NoopImportManager

use of com.walmartlabs.concord.imports.NoopImportManager in project concord by walmartlabs.

the class Main method start.

private static ProcessSnapshot start(Runner runner, ProcessConfiguration cfg, Path workDir, Map<String, Object> args) throws Exception {
    // assume all imports were processed by the agent
    ProjectLoaderV2 loader = new ProjectLoaderV2(new NoopImportManager());
    ProcessDefinition processDefinition = loader.load(workDir, new NoopImportsNormalizer(), ImportsListener.NOP_LISTENER).getProjectDefinition();
    Map<String, Object> initiator = cfg.initiator();
    if (initiator != null) {
        // when the process starts the process' initiator and the current user are the same
        args.put(Constants.Request.INITIATOR_KEY, initiator);
        args.put(Constants.Request.CURRENT_USER_KEY, initiator);
    }
    return runner.start(cfg, processDefinition, args);
}
Also used : NoopImportManager(com.walmartlabs.concord.imports.NoopImportManager) ProjectLoaderV2(com.walmartlabs.concord.runtime.v2.ProjectLoaderV2) NoopImportsNormalizer(com.walmartlabs.concord.runtime.v2.NoopImportsNormalizer) ProcessDefinition(com.walmartlabs.concord.runtime.v2.model.ProcessDefinition)

Example 2 with NoopImportManager

use of com.walmartlabs.concord.imports.NoopImportManager in project concord by walmartlabs.

the class Lint method call.

@Override
public Integer call() throws Exception {
    if (!Files.isDirectory(targetDir)) {
        throw new IllegalArgumentException("Not a directory: " + targetDir);
    }
    ProjectLoader loader = new ProjectLoader(new NoopImportManager());
    ProcessDefinition pd = loader.loadProject(targetDir, new DummyImportsNormalizer(), verbose ? new CliImportsListener() : null).projectDefinition();
    List<LintResult> lintResults = new ArrayList<>();
    linters().forEach(l -> lintResults.addAll(l.apply(pd)));
    if (!lintResults.isEmpty()) {
        print(lintResults);
        println();
    }
    println("Found:");
    println("  imports: " + pd.imports().items().size());
    println("  profiles: " + pd.profiles().size());
    println("  flows: " + pd.flows().size());
    println("  forms: " + pd.forms().size());
    println("  triggers: " + pd.triggers().size());
    println("  (not counting dynamically imported resources)");
    println();
    printStats(lintResults);
    println();
    boolean hasErrors = hasErrors(lintResults);
    if (hasErrors) {
        println("@|red,bold INVALID|@");
    } else {
        println("@|green,bold VALID|@");
    }
    return hasErrors ? 10 : 0;
}
Also used : NoopImportManager(com.walmartlabs.concord.imports.NoopImportManager) ArrayList(java.util.ArrayList) ProcessDefinition(com.walmartlabs.concord.process.loader.model.ProcessDefinition) CliImportsListener(com.walmartlabs.concord.cli.runner.CliImportsListener) ProjectLoader(com.walmartlabs.concord.process.loader.ProjectLoader)

Aggregations

NoopImportManager (com.walmartlabs.concord.imports.NoopImportManager)2 CliImportsListener (com.walmartlabs.concord.cli.runner.CliImportsListener)1 ProjectLoader (com.walmartlabs.concord.process.loader.ProjectLoader)1 ProcessDefinition (com.walmartlabs.concord.process.loader.model.ProcessDefinition)1 NoopImportsNormalizer (com.walmartlabs.concord.runtime.v2.NoopImportsNormalizer)1 ProjectLoaderV2 (com.walmartlabs.concord.runtime.v2.ProjectLoaderV2)1 ProcessDefinition (com.walmartlabs.concord.runtime.v2.model.ProcessDefinition)1 ArrayList (java.util.ArrayList)1