1 9 10 package org.netbeans.test.subversion.main.checkout; 11 12 import junit.textui.TestRunner; 13 import org.netbeans.jellytools.JellyTestCase; 14 import org.netbeans.jemmy.JemmyProperties; 15 import org.netbeans.jemmy.TimeoutExpiredException; 16 import org.netbeans.jemmy.operators.Operator; 17 import org.netbeans.jemmy.operators.Operator.DefaultStringComparator; 18 import org.netbeans.junit.NbTestSuite; 19 import org.netbeans.test.subversion.operators.CheckoutWizardOperator; 20 import org.netbeans.test.subversion.operators.ProxyConfigurationOperator; 21 import org.netbeans.test.subversion.operators.RepositoryStepOperator; 22 23 27 public class ProxySettingsUITest extends JellyTestCase { 28 29 String os_name; 30 Operator.DefaultStringComparator comOperator; 31 Operator.DefaultStringComparator oldOperator; 32 33 34 public ProxySettingsUITest(String name) { 35 super(name); 36 } 37 38 protected void setUp() throws Exception { 39 os_name = System.getProperty("os.name"); 40 System.out.println("### "+getName()+" ###"); 42 43 } 44 45 protected boolean isUnix() { 46 boolean unix = false; 47 if (os_name.indexOf("Windows") == -1) { 48 unix = true; 49 } 50 return unix; 51 } 52 53 public static void main(String [] args) { 54 TestRunner.run(suite()); 56 } 57 58 public static NbTestSuite suite() { 59 NbTestSuite suite = new NbTestSuite(); 60 suite.addTest(new ProxySettingsUITest("testProxySettings")); 61 suite.addTest(new ProxySettingsUITest("testProxyBeforeUrl")); 62 return suite; 63 } 64 65 public void testProxySettings() { 66 comOperator = new Operator.DefaultStringComparator(true, true); 69 oldOperator = (DefaultStringComparator) Operator.getDefaultStringComparator(); 70 Operator.setDefaultStringComparator(comOperator); 71 CheckoutWizardOperator co = CheckoutWizardOperator.invoke(); 72 Operator.setDefaultStringComparator(oldOperator); 73 RepositoryStepOperator co1so = new RepositoryStepOperator(); 74 co1so.setRepositoryURL(RepositoryStepOperator.ITEM_HTTPS + "localhost"); 75 ProxyConfigurationOperator pco = co1so.invokeProxy(); 76 pco.verify(); 77 pco.useSystemProxySettings(); 78 pco.noProxyDirectConnection(); 79 pco.hTTPProxy(); 80 pco.setProxyHost("host"); pco.setPort("8080"); 82 pco.checkProxyServerRequiresLogin(true); 83 pco.setName("name"); pco.setPassword("password"); pco.ok(); 86 co.btCancel().pushNoBlock(); 87 } 88 89 public void testProxyBeforeUrl() throws Exception { 90 comOperator = new Operator.DefaultStringComparator(true, true); 93 oldOperator = (DefaultStringComparator) Operator.getDefaultStringComparator(); 94 Operator.setDefaultStringComparator(comOperator); 95 CheckoutWizardOperator co = CheckoutWizardOperator.invoke(); 96 Operator.setDefaultStringComparator(oldOperator); 97 RepositoryStepOperator co1so = new RepositoryStepOperator(); 98 co1so.setRepositoryURL(RepositoryStepOperator.ITEM_HTTPS); 99 100 TimeoutExpiredException tee = null; 101 try { 102 co1so.invokeProxy(); 103 } catch (Exception e) { 104 tee = (TimeoutExpiredException) e; 105 } 107 assertNotNull(tee); 108 109 co1so.setRepositoryURL(RepositoryStepOperator.ITEM_HTTP); 110 tee = null; 111 try { 112 co1so.invokeProxy(); 113 } catch (Exception e) { 114 tee = (TimeoutExpiredException) e; 115 } 117 assertNotNull(tee); 118 119 co1so.setRepositoryURL(RepositoryStepOperator.ITEM_SVN); 120 tee = null; 121 try { 122 co1so.invokeProxy(); 123 } catch (Exception e) { 124 tee = (TimeoutExpiredException) e; 125 } 127 assertNotNull(tee); 128 129 co1so.setRepositoryURL(RepositoryStepOperator.ITEM_SVNSSH); 130 tee = null; 131 try { 132 co1so.invokeProxy(); 133 } catch (Exception e) { 134 tee = (TimeoutExpiredException) e; 135 } 137 assertNotNull(tee); 138 co.btCancel().pushNoBlock(); 139 } 140 } 141 | Popular Tags |