コード例 #1
0
ファイル: ValidatorTest.java プロジェクト: kaloyan-raev/libra
 public void testServletBridgeLibraryIsMissing() {
   IWARProduct product = createBasicProduct();
   Validator validator = new Validator(product);
   Validation validation = validator.validate();
   assertFalse(validation.isValid());
   ValidationError[] errors = validation.getErrors();
   boolean foundServletBridgeMissing = false;
   for (int i = 0; i < errors.length; i++) {
     ValidationError error = errors[i];
     String message = error.getMessage();
     if (error.getType() == ValidationError.LIBRARY_MISSING
         && message.indexOf(SERVLETBRIDGE) != -1) {
       foundServletBridgeMissing = true;
     }
   }
   assertTrue(foundServletBridgeMissing);
 }
コード例 #2
0
ファイル: ValidatorTest.java プロジェクト: kaloyan-raev/libra
 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);
 }
コード例 #3
0
ファイル: ValidatorTest.java プロジェクト: kaloyan-raev/libra
 public void testLibrariesDoesntExist() {
   IWARProduct product = createBasicProduct();
   String projectPath = File.separator + "test";
   Path path = new Path(projectPath + File.separator + "test.jar");
   product.addLibrary(path, false);
   Path servletBridgePath = new Path(projectPath + File.separator + SERVLETBRIDGE_JAR);
   product.addLibrary(servletBridgePath, false);
   Validator validator = new Validator(product);
   Validation validation = validator.validate();
   assertFalse(validation.isValid());
   ValidationError[] errors = validation.getErrors();
   boolean testJarIsMissing = false;
   for (int i = 0; i < errors.length; i++) {
     ValidationError error = errors[i];
     String message = error.getMessage();
     if (error.getType() == ValidationError.LIBRARY_DOESNT_EXIST
         && message.indexOf("test.jar") != -1) {
       testJarIsMissing = true;
     }
   }
   assertTrue(testJarIsMissing);
 }
コード例 #4
0
ファイル: ValidatorTest.java プロジェクト: kaloyan-raev/libra
 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);
 }