APISonar


org.MyTestCase.testWD

> org > MyTestCase > testWD
org APIs MyTestCase APIs testWD APIs

Example 1
public void testAddDelete() throws MalformedURLException {
    final PumpingsQueue queue = new DispatchedQueue(new File(MyTestCase.testWD, "queueState.xml"));
    final ActionsTracer listener = new ActionsTracer(queue);
    final Pumping pumping = queue.add(new URL("http://127.0.0.1:8080/testurl.data"));
    assertTrue(queue.toArray().length == 1);
    assertEquals(1, listener.actions.size());
    assertEquals("add", listener.actions.get(0).getFirst());
    assertEquals(pumping.getId(), listener.actions.get(0).getSecond());
    queue.delete(pumping.getId());
    assertEquals(2, listener.actions.size());
    assertEquals("delete", listener.actions.get(1).getFirst());
    assertEquals(pumping.getId(), listener.actions.get(1).getSecond());
    assertTrue(queue.toArray().length == 0);
  }
Example 2
public void testConnectorPropertiesSetGet() {
    URLConnector connector = new URLConnector(MyTestCase.testWD);
    connector.setConnectTimeout(1000);
    assertEquals(1000, connector.getConnectTimeout());
    connector.setReadTimeout(2000);
    assertEquals(2000, connector.getReadTimeout());
    connector.setUseProxy(false);
    assertEquals(false, connector.getUseProxy());
  }
Example 3
public void testMyOwnProxyAdd() {
    URLConnector connector = new URLConnector(MyTestCase.testWD);
    MyProxy http = new MyProxy(new Proxy(Proxy.Type.HTTP, new InetSocketAddress("www.mpotstava.danilahttp", 1234)));
    MyProxy ftp = new MyProxy(new Proxy(Proxy.Type.SOCKS, new InetSocketAddress("www.mpotstava.danilaftp", 1234)), MyProxyType.FTP);
    MyProxy socks = new MyProxy(new Proxy(Proxy.Type.SOCKS, new InetSocketAddress("www.mpotstava.danilasocks", 1234)));
    connector.addProxy(http);
    connector.addProxy(ftp);
    connector.addProxy(socks);
    assertEquals(http.getProxy(), connector.getProxy(MyProxyType.HTTP));
    assertEquals(ftp.getProxy(), connector.getProxy(MyProxyType.FTP));
    assertEquals(socks.getProxy(), connector.getProxy(MyProxyType.SOCKS));
  }
Example 4
public void testSystemProxyCatched() {
    URLConnector connector = new URLConnector(MyTestCase.testWD);
    assertEquals(deploymentProxy, connector.getProxy(MyProxyType.HTTP));
    assertEquals(ftpPro, connector.getProxy(MyProxyType.FTP));
    assertEquals(socksPro, connector.getProxy(MyProxyType.SOCKS));
  }
Example 5
public void testClearAndAddNewByPass() {
    URLConnector connector = new URLConnector(MyTestCase.testWD);
    assertTrue(connector.getByPassHosts().length > 0);
    connector.clearByPassList();
    assertTrue(connector.getByPassHosts().length == 0);
    connector.addByPassHost("test.one");
    assertEquals("test.one", connector.getByPassHosts()[0]);
    connector.addByPassHost("test.two");
    assertTrue(connector.getByPassHosts().length == 2);
  }