private void checkForMissingRequiredBundle(final String id) throws IOException { IWARProduct product = createPlainProducttWithLibraries(); Validator validator = new Validator(product); Validation validation = validator.validate(); assertFalse(validation.isValid()); ValidationError[] errors = validation.getErrors(); boolean foundMissingBundle = false; for (int i = 0; i < errors.length && !foundMissingBundle; i++) { ValidationError error = errors[i]; if (error.getType() == ValidationError.BUNDLE_MISSING) { IProductPlugin missingBundle = (IProductPlugin) error.getCausingObject(); String message = error.getMessage(); if (missingBundle.getId().equals(id) && message.indexOf(id) != -1) { foundMissingBundle = true; } } } assertTrue(foundMissingBundle); }
private void checkForBannedBundle(final String id) throws Exception { IWARProduct product = createBasicProductWithLibraries(); IProductPlugin plugin = new ProductPlugin(product.getModel()); plugin.setId(id); IProductPlugin[] plugins = new IProductPlugin[] {plugin}; product.addPlugins(plugins); Validator validator = new Validator(product); Validation validation = validator.validate(); assertFalse(validation.isValid()); ValidationError[] errors = validation.getErrors(); boolean foundBannedBundle = false; for (int i = 0; i < errors.length && !foundBannedBundle; i++) { ValidationError error = errors[i]; if (error.getType() == ValidationError.BUNDLE_BANNED) { IProductPlugin bannedPlugin = (IProductPlugin) error.getCausingObject(); String message = error.getMessage(); if (bannedPlugin.getId().equals(id) && message.indexOf(id) != -1) { foundBannedBundle = true; } } } assertTrue(foundBannedBundle); }