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()); }
protected void scheduleExportJob() { FeatureExportInfo info = new FeatureExportInfo(); info.toDirectory = exportPage.doExportToDirectory(); info.exportSource = false; info.exportSourceBundle = false; info.allowBinaryCycles = false; info.exportMetadata = false; info.destinationDirectory = exportPage.getDestination(); info.zipFileName = exportPage.getFileName(); info.items = getPluginModels(); String rootDirectory = "WEB-INF"; // $NON-NLS-1$ WARProductExportOperation job = new WARProductExportOperation( info, PDEUIMessages.ProductExportJob_name, product, rootDirectory); job.setUser(true); job.setRule(ResourcesPlugin.getWorkspace().getRoot()); job.schedule(); job.setProperty(IProgressConstants.ICON_PROPERTY, PDEPluginImages.DESC_FEATURE_OBJ); }
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; }