use of io.cdap.cdap.runtime.spi.provisioner.Capabilities in project cdap by caskdata.
the class ProvisioningServiceTest method testUnfulfilledRequirements.
@Test
public void testUnfulfilledRequirements() {
Capabilities provisionerCapabilities = new Capabilities(ImmutableSet.of(Table.TYPE));
Set<PluginRequirement> requirements = ImmutableSet.of(new PluginRequirement("source1", "batchsource", new Requirements(ImmutableSet.of(Table.TYPE, "unicorn"))), new PluginRequirement("sink1", "batchsink", new Requirements(ImmutableSet.of(Table.TYPE, "dragon"))));
Set<PluginRequirement> expectedUnfulfilledRequirements = ImmutableSet.of(new PluginRequirement("source1", "batchsource", new Requirements(ImmutableSet.of("unicorn"))), new PluginRequirement("sink1", "batchsink", new Requirements(ImmutableSet.of("dragon"))));
assertRequirementFulfillment(provisionerCapabilities, requirements, expectedUnfulfilledRequirements);
// check when there are multiple plugins with same name but different type
requirements = ImmutableSet.of(new PluginRequirement("source1", "batchsource", new Requirements(ImmutableSet.of(Table.TYPE, "unicorn"))), new PluginRequirement("sink1", "batchsink", new Requirements(ImmutableSet.of(Table.TYPE, "dragon"))), new PluginRequirement("sink1", "anothersink", new Requirements(ImmutableSet.of(Table.TYPE, "narwhal"))));
expectedUnfulfilledRequirements = ImmutableSet.of(new PluginRequirement("source1", "batchsource", new Requirements(ImmutableSet.of("unicorn"))), new PluginRequirement("sink1", "batchsink", new Requirements(ImmutableSet.of("dragon"))), new PluginRequirement("sink1", "anothersink", new Requirements(ImmutableSet.of("narwhal"))));
assertRequirementFulfillment(provisionerCapabilities, requirements, expectedUnfulfilledRequirements);
// check when provisioner does not have any specified capability
provisionerCapabilities = Capabilities.EMPTY;
assertRequirementFulfillment(provisionerCapabilities, requirements, requirements);
}
use of io.cdap.cdap.runtime.spi.provisioner.Capabilities in project cdap by caskdata.
the class ProvisioningServiceTest method testFulfilledRequirements.
@Test
public void testFulfilledRequirements() {
Capabilities provisionerCapabilities = new Capabilities(ImmutableSet.of(Table.TYPE));
Set<PluginRequirement> requirements = ImmutableSet.of(new PluginRequirement("source1", "batchsource", new Requirements(Collections.emptySet())), new PluginRequirement("sink1", "batchsink", new Requirements(ImmutableSet.of(Table.TYPE))));
// there should not be any incapability
assertRequirementFulfillment(provisionerCapabilities, requirements, Collections.emptySet());
provisionerCapabilities = new Capabilities(ImmutableSet.of(Table.TYPE));
requirements = ImmutableSet.of(new PluginRequirement("source1", "batchsource", new Requirements(ImmutableSet.of(Table.TYPE))), new PluginRequirement("sink1", "batchsink", new Requirements(ImmutableSet.of(Table.TYPE))));
// there should not be any incapability
assertRequirementFulfillment(provisionerCapabilities, requirements, Collections.emptySet());
}
Aggregations