use of org.apache.sling.provisioning.model.ModelUtility.ArtifactVersionResolver in project sling by apache.
the class ModelUtilityApplyArtifactVersionsTest method setUp.
@Before
public void setUp() {
testModel = new Model();
Feature feature = testModel.getOrCreateFeature("feature1");
RunMode runMode = feature.getOrCreateRunMode(new String[] { "rm1" });
ArtifactGroup group = runMode.getOrCreateArtifactGroup(10);
group.add(new Artifact("g1", "a1", "v1", "c1", "t1"));
group.add(new Artifact("g2", "a2", "LATEST", null, null));
group.add(new Artifact("g3", "a3", "LATEST", null, null));
// dummy variable resolver that simulates external resolving of some variables
testArtifactVersionResolver = new ArtifactVersionResolver() {
@Override
public String resolve(Artifact artifact) {
if ("g2".equals(artifact.getGroupId()) && "a2".equals(artifact.getArtifactId())) {
return "v2";
}
return null;
}
};
}
use of org.apache.sling.provisioning.model.ModelUtility.ArtifactVersionResolver in project sling by apache.
the class CustomResolverTest method testCustomArtifactVersionResolver.
@Test
public void testCustomArtifactVersionResolver() throws Exception {
final Model m = U.readCompleteTestModel();
final ArtifactVersionResolver r = new CustomArtifactVersionResolver();
final Model effective = ModelUtility.getEffectiveModel(m, new ResolverOptions().artifactVersionResolver(r));
final ArtifactGroup g = U.getGroup(effective, "example", null, 0);
U.assertArtifact(g, "mvn:org.example/jar-without-version/9.9.9");
}
Aggregations