Пример #1
0
 private IWARProduct createPlainProducttWithLibraries() throws IOException {
   IWARProduct product = createPlainProduct();
   File testJar = File.createTempFile("test", ".jar");
   Path testPath = new Path(testJar.getAbsolutePath());
   product.addLibrary(testPath, false);
   File bridgeJar = File.createTempFile(SERVLETBRIDGE, ".jar");
   Path servletBridgePath = new Path(bridgeJar.getAbsolutePath());
   product.addLibrary(servletBridgePath, false);
   return product;
 }
Пример #2
0
 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);
 }
Пример #3
0
 private IWARProduct createBasicProductWithLibraries() throws Exception {
   IWARProduct product = createBasicProduct();
   IWorkspaceRoot wsRoot = ResourcesPlugin.getWorkspace().getRoot();
   IProject project = wsRoot.getProject("warProduct");
   if (!project.exists()) {
     project.create(null);
     project.open(null);
   }
   IFile jar = project.getFile("test.jar");
   if (!jar.exists()) {
     File testJar = File.createTempFile("test", ".jar");
     FileInputStream stream = new FileInputStream(testJar);
     jar.create(stream, true, null);
   }
   product.addLibrary(jar.getFullPath(), false);
   IFile bridge = project.getFile(SERVLETBRIDGE + ".jar");
   if (!bridge.exists()) {
     File bridgeJar = File.createTempFile(SERVLETBRIDGE, ".jar");
     FileInputStream stream = new FileInputStream(bridgeJar);
     bridge.create(stream, true, null);
   }
   product.addLibrary(bridge.getFullPath(), false);
   return product;
 }
Пример #4
0
 public void testContainsServletBridgeLibrary() throws Exception {
   IWARProduct product = createBasicProduct();
   IWorkspaceRoot wsRoot = ResourcesPlugin.getWorkspace().getRoot();
   IProject project = wsRoot.getProject("warProduct");
   if (!project.exists()) {
     project.create(null);
     project.open(null);
   }
   IFile jar = project.getFile(SERVLETBRIDGE + ".jar");
   if (!jar.exists()) {
     File bridge = File.createTempFile(SERVLETBRIDGE, ".jar");
     FileInputStream stream = new FileInputStream(bridge);
     jar.create(stream, true, null);
   }
   product.addLibrary(jar.getFullPath(), false);
   Validator validator = new Validator(product);
   Validation validation = validator.validate();
   assertTrue(validation.isValid());
 }