Search in sources :

Example 6 with DependencyEntity

use of com.walmartlabs.concord.dependencymanager.DependencyEntity in project concord by walmartlabs.

the class DependencyPolicyTest method testSingleDepDeny.

@Test
public void testSingleDepDeny() {
    DependencyRule di = new DependencyRule(null, null, ".*", null, null, null);
    PolicyRules<DependencyRule> rules = new PolicyRules<>(null, null, Collections.singletonList(di));
    DependencyPolicy policy = new DependencyPolicy(rules);
    DependencyEntity dependency = buildDependency("com.walmartlabs.concord.plugins.basic", "ansible-tasks", "0.57.1-SNAPSHOT");
    // ---
    assertDeny(policy, dependency);
}
Also used : DependencyEntity(com.walmartlabs.concord.dependencymanager.DependencyEntity) Test(org.junit.jupiter.api.Test)

Example 7 with DependencyEntity

use of com.walmartlabs.concord.dependencymanager.DependencyEntity in project concord by walmartlabs.

the class DependencyPolicy method check.

public CheckResult<DependencyRule, DependencyEntity> check(Collection<DependencyEntity> dependencies) {
    if (rules == null || rules.isEmpty()) {
        return CheckResult.success();
    }
    List<CheckResult.Item<DependencyRule, DependencyEntity>> warn = new ArrayList<>();
    List<CheckResult.Item<DependencyRule, DependencyEntity>> deny = new ArrayList<>();
    for (DependencyEntity e : dependencies) {
        check(e, warn, deny);
    }
    return new CheckResult<>(warn, deny);
}
Also used : DependencyEntity(com.walmartlabs.concord.dependencymanager.DependencyEntity) ArrayList(java.util.ArrayList)

Aggregations

DependencyEntity (com.walmartlabs.concord.dependencymanager.DependencyEntity)7 Test (org.junit.jupiter.api.Test)3 ProgressListener (com.walmartlabs.concord.dependencymanager.ProgressListener)2 ExecutionException (com.walmartlabs.concord.agent.ExecutionException)1 ProcessLog (com.walmartlabs.concord.agent.logging.ProcessLog)1 DependencyRule (com.walmartlabs.concord.policyengine.DependencyRule)1 PolicyEngine (com.walmartlabs.concord.policyengine.PolicyEngine)1 URI (java.net.URI)1 ArrayList (java.util.ArrayList)1