Search in sources :

Example 1 with ValidationRuleSet

use of org.commonjava.indy.promote.model.ValidationRuleSet in project indy by Commonjava.

the class ValidationRuleParserTest method testRuleSetParseAndMatchOnStoreKey.

@Test
public void testRuleSetParseAndMatchOnStoreKey() throws Exception {
    ValidationRuleSet ruleSet = parser.parseRuleSet("{\"name\":\"test\",\"storeKeyPattern\":\".*\"}", "test.json");
    assertThat(ruleSet, notNullValue());
    assertThat(ruleSet.matchesKey("hosted:repo"), equalTo(true));
}
Also used : ValidationRuleSet(org.commonjava.indy.promote.model.ValidationRuleSet) Test(org.junit.Test)

Example 2 with ValidationRuleSet

use of org.commonjava.indy.promote.model.ValidationRuleSet in project indy by Commonjava.

the class FullRuleStack_GroupWithOneOfTwoHosts_RuleTest method getRuleSet.

@Override
protected ValidationRuleSet getRuleSet() {
    ValidationRuleSet ruleSet = new ValidationRuleSet();
    ruleSet.setName("test");
    ruleSet.setStoreKeyPattern("group:target");
    ruleSet.setRuleNames(Arrays.asList(RULES));
    Map<String, String> params = new HashMap<>();
    params.put("availableInStores", "group:public, group:target");
    params.put("classifierAndTypeSet", "javadoc:jar, sources:jar");
    params.put("versionPattern", "\\d+\\.\\d+\\.\\d+[.-]redhat-\\d+");
    ruleSet.setValidationParameters(params);
    return ruleSet;
}
Also used : HashMap(java.util.HashMap) ValidationRuleSet(org.commonjava.indy.promote.model.ValidationRuleSet)

Example 3 with ValidationRuleSet

use of org.commonjava.indy.promote.model.ValidationRuleSet in project indy by Commonjava.

the class NoPreExistingPaths_GroupWithOneOfTwoHosts_RuleTest method getRuleSet.

@Override
protected ValidationRuleSet getRuleSet() {
    ValidationRuleSet ruleSet = new ValidationRuleSet();
    ruleSet.setName("test");
    ruleSet.setStoreKeyPattern("group:target");
    ruleSet.setRuleNames(Collections.singletonList(getRuleScriptFile()));
    return ruleSet;
}
Also used : ValidationRuleSet(org.commonjava.indy.promote.model.ValidationRuleSet)

Example 4 with ValidationRuleSet

use of org.commonjava.indy.promote.model.ValidationRuleSet in project indy by Commonjava.

the class NoPreExistingPaths_RuleTest method getRuleSet.

@Override
protected ValidationRuleSet getRuleSet() {
    ValidationRuleSet ruleSet = new ValidationRuleSet();
    ruleSet.setName("test");
    ruleSet.setStoreKeyPattern("group:target");
    ruleSet.setRuleNames(Collections.singletonList(getRuleScriptFile()));
    ruleSet.setValidationParameters(Collections.singletonMap("availableInStores", "group:other"));
    return ruleSet;
}
Also used : ValidationRuleSet(org.commonjava.indy.promote.model.ValidationRuleSet)

Example 5 with ValidationRuleSet

use of org.commonjava.indy.promote.model.ValidationRuleSet in project indy by Commonjava.

the class ProjectVersionPatternRuleTest method getRuleSet.

protected ValidationRuleSet getRuleSet() {
    ValidationRuleSet ruleSet = new ValidationRuleSet();
    ruleSet.setName("test");
    ruleSet.setStoreKeyPattern("group:target");
    ruleSet.setRuleNames(Collections.singletonList(getRuleScriptFile()));
    ruleSet.setValidationParameters(Collections.singletonMap("versionPattern", "\\d\\.\\d"));
    return ruleSet;
}
Also used : ValidationRuleSet(org.commonjava.indy.promote.model.ValidationRuleSet)

Aggregations

ValidationRuleSet (org.commonjava.indy.promote.model.ValidationRuleSet)16 HashMap (java.util.HashMap)2 ChangeSummary (org.commonjava.indy.audit.ChangeSummary)2 StoreKey (org.commonjava.indy.model.core.StoreKey)2 ValidationRuleMapping (org.commonjava.indy.promote.validate.model.ValidationRuleMapping)2 DataFile (org.commonjava.indy.subsys.datafile.DataFile)2 Test (org.junit.Test)2 Logger (org.slf4j.Logger)2 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 File (java.io.File)1 IOException (java.io.IOException)1 IndyDataException (org.commonjava.indy.data.IndyDataException)1 ArtifactStore (org.commonjava.indy.model.core.ArtifactStore)1 ValidationRequest (org.commonjava.indy.promote.validate.model.ValidationRequest)1 EventMetadata (org.commonjava.maven.galley.event.EventMetadata)1