1 19 20 package org.netbeans.modules.apisupport.project.suite; 21 22 import java.io.File ; 23 import java.util.Arrays ; 24 import java.util.List ; 25 import java.util.logging.Level ; 26 import org.netbeans.modules.apisupport.project.DialogDisplayerImpl; 27 import org.netbeans.modules.apisupport.project.InstalledFileLocatorImpl; 28 import org.netbeans.modules.apisupport.project.NbModuleProject; 29 import org.netbeans.modules.apisupport.project.TestBase; 30 import org.netbeans.modules.apisupport.project.layers.LayerTestBase; 31 import org.netbeans.modules.apisupport.project.ui.SuiteActions; 32 import org.netbeans.spi.project.ActionProvider; 33 import org.openide.DialogDescriptor; 34 import org.openide.execution.ExecutorTask; 35 import org.openide.filesystems.FileObject; 36 37 41 public class BuildNBMSTest extends TestBase { 42 43 static { 44 System.setProperty("org.netbeans.core.startup.ModuleSystem.CULPRIT", "true"); 46 LayerTestBase.Lkp.setLookup(new Object [0]); 47 } 48 49 private SuiteProject suite; 50 51 public BuildNBMSTest(String name) { 52 super(name); 53 } 54 55 @Override 56 protected Level logLevel() { 57 return Level.FINE; 58 } 59 60 protected void setUp() throws Exception { 61 clearWorkDir(); 62 63 super.setUp(); 64 65 InstalledFileLocatorImpl.registerDestDir(destDirF); 66 67 suite = TestBase.generateSuite(new File (getWorkDir(), "projects"), "suite"); 68 NbModuleProject proj = TestBase.generateSuiteComponent(suite, "mod1"); 69 70 SuiteProjectTest.openSuite(suite); 71 proj.open(); 72 } 73 74 public void testBuildNBMS() throws Exception { 75 SuiteActions p = (SuiteActions) suite.getLookup().lookup(ActionProvider.class); 76 assertNotNull("Provider is here", p); 77 78 List l = Arrays.asList(p.getSupportedActions()); 79 assertTrue("We support nbms: " + l, l.contains("nbms")); 80 81 DialogDisplayerImpl.returnFromNotify(DialogDescriptor.NO_OPTION); 82 ExecutorTask task = p.invokeActionImpl("nbms", suite.getLookup()); 83 assertNotNull("did not even run task", task); 84 task.waitFinished(); 85 FileObject nbmFo = suite.getProjectDirectory().getFileObject("build/updates/org-example-mod1.nbm"); 86 FileObject updatesXml = suite.getProjectDirectory().getFileObject("build/updates/updates.xml"); 87 assertNotNull("Nbm build/updates/org-example-mod1.nbm doesn't exist",nbmFo); 88 assertNotNull("build/updates/updates.xml doesn't exist",updatesXml); 89 } 90 91 } 92 93 | Popular Tags |