use of org.graylog2.contentpacks.constraints.ConstraintChecker in project graylog2-server by Graylog2.
the class PluginVersionConstraintCheckerTest method checkConstraintsFails.
@Test
public void checkConstraintsFails() {
final TestPluginMetaData pluginMetaData = new TestPluginMetaData();
final PluginVersionConstraintChecker constraintChecker = new PluginVersionConstraintChecker(Collections.singleton(pluginMetaData));
final GraylogVersionConstraint graylogVersionConstraint = GraylogVersionConstraint.builder().version("^2.0.0").build();
final PluginVersionConstraint pluginVersionConstraint = PluginVersionConstraint.builder().pluginId("unique-id").version("^2.0.0").build();
final ImmutableSet<Constraint> requiredConstraints = ImmutableSet.of(graylogVersionConstraint, pluginVersionConstraint);
assertThat(constraintChecker.checkConstraints(requiredConstraints).stream().allMatch(c -> !c.fulfilled())).isTrue();
}
use of org.graylog2.contentpacks.constraints.ConstraintChecker in project graylog2-server by Graylog2.
the class CatalogResourceTest method setUp.
@Before
public void setUp() {
final ContentPackInstallationPersistenceService contentPackInstallationPersistenceService = mock(ContentPackInstallationPersistenceService.class);
final Set<ConstraintChecker> constraintCheckers = Collections.emptySet();
final Map<ModelType, EntityWithExcerptFacade<?, ?>> entityFacades = Collections.singletonMap(ModelType.of("test", "1"), mockEntityFacade);
contentPackService = new ContentPackService(contentPackInstallationPersistenceService, constraintCheckers, entityFacades);
catalogResource = new CatalogResource(contentPackService);
}
Aggregations