Exemplo n.º 1
0
 private void addBundleToProduct(
     final WARProductModelFactory factory, final String id, final IWARProduct product) {
   IProductPlugin bundle = factory.createPlugin();
   bundle.setId(id);
   bundle.setVersion("0.0.0");
   product.addPlugins(new IProductPlugin[] {bundle});
 }
Exemplo n.º 2
0
 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);
 }