1 19 package org.netbeans.modules.j2ee.archive.xtests; 20 21 import java.io.File ; 22 import org.netbeans.junit.NbTestCase; 23 import org.netbeans.junit.NbTestSuite; 24 import org.netbeans.modules.j2ee.archive.wizard.*; 25 import org.netbeans.modules.j2ee.deployment.impl.ServerInstance; 26 import org.netbeans.modules.j2ee.deployment.impl.ServerRegistry; 27 import org.netbeans.modules.j2ee.sun.ide.j2ee.ui.AddDomainWizardIterator; 28 import org.openide.WizardDescriptor; 29 import org.openide.WizardDescriptor.Panel; 30 31 35 public class AddRemoveSjsasInstance4Test extends NbTestCase { 36 37 private final int SLEEP = 10000; 38 39 public AddRemoveSjsasInstance4Test(String testName) { 40 super(testName); 41 } 42 43 public void addSjsasInstance() { 44 try { 45 AddDomainWizardIterator inst = new AddDomainWizardIterator(); 46 WizardDescriptor wizard = new WizardDescriptor(new Panel[] {}); 47 wizard.putProperty(TestUtil.PLATFORM_LOCATION, new File (TestUtil._PLATFORM_LOCATION)); 48 wizard.putProperty(TestUtil.INSTALL_LOCATION, TestUtil._INSTALL_LOCATION); 49 wizard.putProperty(TestUtil.PROP_DISPLAY_NAME, TestUtil._DISPLAY_NAME); 50 wizard.putProperty(TestUtil.HOST, TestUtil._HOST); 51 wizard.putProperty(TestUtil.PORT, TestUtil._PORT); 52 wizard.putProperty(TestUtil.DOMAIN, TestUtil._DOMAIN); 53 wizard.putProperty(TestUtil.USER_NAME, TestUtil._USER_NAME); 54 wizard.putProperty(TestUtil.PASSWORD, TestUtil._PASSWORD); 55 56 inst.initialize(wizard); 57 inst.instantiate(); 58 59 ServerRegistry.getInstance().checkInstanceExists(TestUtil._URL); 60 61 TestUtil.sleep(SLEEP); 62 } catch(Exception e) { 63 fail(e.getMessage()); 64 } 65 } 66 67 public void removeSjsasInstance() { 68 try { 69 TestUtil.sleep(SLEEP); 70 71 ServerInstance inst = ServerRegistry.getInstance().getServerInstance(TestUtil._URL); 72 inst.remove(); 73 74 try { 75 ServerRegistry.getInstance().checkInstanceExists(TestUtil._URL); 76 } catch(Exception e) { 77 return; 78 } 79 80 fail("Sjsas instance still exists !"); 81 } catch(Exception e) { 82 fail(e.getMessage()); 83 } 84 } 85 86 public static NbTestSuite suite() { 87 NbTestSuite suite = new NbTestSuite("AddRemoveSjsasInstanceTest"); 88 suite.addTest(new AddRemoveSjsasInstance4Test("addSjsasInstance")); 89 suite.addTest(new AddRemoveSjsasInstance4Test("removeSjsasInstance")); 90 return suite; 91 } 92 } | Popular Tags |