Ejemplo n.º 1
0
  // Test Case 6: Password Empty - Error
  private void profileSetUpPasswordEmpty() throws InterruptedException {

    profilePage1();
    driver.findElement(By.id("nickName")).click();
    driver.findElement(By.id("nickName")).clear();
    driver.findElement(By.id("nickName")).sendKeys("Neel");

    new Select(driver.findElement(By.id("DOBMonth"))).selectByVisibleText("January");
    driver.findElement(By.cssSelector("option[value=\"01\"]")).click();
    new Select(driver.findElement(By.id("DOBDay"))).selectByVisibleText("04");
    driver.findElement(By.cssSelector("#DOBDay > option[value=\"02\"]")).click();
    new Select(driver.findElement(By.id("DOBYear"))).selectByVisibleText("1994");
    driver.findElement(By.cssSelector("option[value=\"1994\"]")).click();

    driver.findElement(By.id("email")).click();
    driver.findElement(By.id("email")).clear();
    driver.findElement(By.id("email")).sendKeys("*****@*****.**");

    driver.findElement(By.id("emailConfirmation")).click();
    driver.findElement(By.id("emailConfirmation")).clear();
    driver.findElement(By.id("emailConfirmation")).sendKeys("*****@*****.**");

    driver.findElement(By.id("password")).click();
    driver.findElement(By.id("password")).clear();

    Thread.sleep(3000);

    driver.findElement(By.cssSelector("input.submitButton.green")).click();
    Thread.sleep(3000);
    System.out.println("ERROR: Password Missing");
  }
Ejemplo n.º 2
0
  @Test
  public void sendMessageFromThreadToThread() throws Exception {
    final Channel<String> ch = newChannel();

    Thread thread =
        new Thread(
            new Runnable() {
              @Override
              public void run() {
                try {
                  Thread.sleep(100);

                  ch.send("a message");
                } catch (InterruptedException | SuspendExecution ex) {
                  throw new AssertionError(ex);
                }
              }
            });
    thread.start();

    String m = ch.receive();

    assertThat(m, equalTo("a message"));

    thread.join();
  }
Ejemplo n.º 3
0
  @Ignore
  @Test
  public void whenReceiveNotCalledFromOwnerThenThrowException4() throws Exception {
    assumeTrue(Debug.isAssertionsEnabled());
    final Channel<String> ch = newChannel();

    Thread thread =
        new Thread(
            new Runnable() {
              @Override
              public void run() {
                try {
                  ch.receive();
                } catch (InterruptedException ex) {
                  throw new AssertionError(ex);
                } catch (SuspendExecution e) {
                  throw new AssertionError(e);
                }
              }
            });
    thread.start();

    Thread.sleep(100);
    ch.send("a message");

    boolean thrown = false;
    try {
      ch.receive();
    } catch (Throwable e) {
      thrown = true;
    }
    assertTrue(thrown);

    thread.join();
  }
Ejemplo n.º 4
0
  //  Delete CSR
  @Test
  public void Test5() throws Exception {
    driver.get(baseUrl + "/#/host/magehostmanager.magemojo.com/configuration/ssl");
    driver.findElement(By.xpath("//a[contains(text(),'www.Testing5.com')]")).click();
    assertEquals(
        "Download CSR www.Testing5.com", driver.findElement(By.xpath("//legend[4]")).getText());
    driver.findElement(By.xpath("(//button[@type='button'])[8]")).click();
    assertEquals(
        "Confirmation Window",
        driver.findElement(By.cssSelector("h3.modal-title.ng-binding")).getText());
    assertTrue(isElementPresent(By.xpath("//div[3]/button[2]")));
    driver.findElement(By.xpath("//div[3]/button")).click();

    for (int second = 0; ; second++) {
      if (second >= 60) fail("timeout");
      try {
        if ("Successfully deleted the CSR."
            .equals(driver.findElement(By.xpath("//div[@id='toast-container']/div")).getText()))
          break;
      } catch (Exception e) {
      }
      Thread.sleep(1000);
    }

    for (int second = 0; ; second++) {
      if (second >= 60) fail("timeout");
      try {
        if (!isElementPresent(By.xpath("//a[contains(text(),'www.Testing5.com')]"))) break;
      } catch (Exception e) {
      }
      Thread.sleep(1000);
    }
  }
Ejemplo n.º 5
0
  @Test
  public void testChannelGroupReceive() throws Exception {
    final Channel<String> channel1 = newChannel();
    final Channel<String> channel2 = newChannel();
    final Channel<String> channel3 = newChannel();

    final ReceivePortGroup<String> group =
        new ReceivePortGroup<String>(channel1, channel2, channel3);

    Fiber fib =
        new Fiber(
                "fiber",
                fjPool,
                new SuspendableRunnable() {
                  @Override
                  public void run() throws SuspendExecution, InterruptedException {
                    String m1 = group.receive();
                    String m2 = channel2.receive();

                    assertThat(m1, equalTo("hello"));
                    assertThat(m2, equalTo("world!"));
                  }
                })
            .start();

    Thread.sleep(100);
    channel3.send("hello");
    Thread.sleep(100);
    if (policy != OverflowPolicy.BLOCK) {
      channel1.send("goodbye"); // TransferChannel will block here
      Thread.sleep(100);
    }
    channel2.send("world!");
    fib.join();
  }
Ejemplo n.º 6
0
  // Do some simple concurrent testing
  public void testConcurrentSimple() throws InterruptedException {
    final NonBlockingIdentityHashMap<String, String> nbhm =
        new NonBlockingIdentityHashMap<String, String>();
    final String[] keys = new String[20000];
    for (int i = 0; i < 20000; i++) keys[i] = "k" + i;

    // In 2 threads, add & remove even & odd elements concurrently
    Thread t1 =
        new Thread() {
          public void run() {
            work_helper(nbhm, "T1", 1, keys);
          }
        };
    t1.start();
    work_helper(nbhm, "T0", 0, keys);
    t1.join();

    // In the end, all members should be removed
    StringBuffer buf = new StringBuffer();
    buf.append("Should be emptyset but has these elements: {");
    boolean found = false;
    for (String x : nbhm.keySet()) {
      buf.append(" ").append(x);
      found = true;
    }
    if (found) System.out.println(buf + " }");
    assertThat("concurrent size=0", nbhm.size(), is(0));
    for (String x : nbhm.keySet()) {
      assertTrue("No elements so never get here", false);
    }
  }
Ejemplo n.º 7
0
  @Test
  public void testTopic() throws Exception {
    final Channel<String> channel1 = newChannel();
    final Channel<String> channel2 = newChannel();
    final Channel<String> channel3 = newChannel();

    final Topic<String> topic = new Topic<String>();

    topic.subscribe(channel1);
    topic.subscribe(channel2);
    topic.subscribe(channel3);

    Fiber f1 =
        new Fiber(
                fjPool,
                new SuspendableRunnable() {
                  @Override
                  public void run() throws SuspendExecution, InterruptedException {
                    assertThat(channel1.receive(), equalTo("hello"));
                    assertThat(channel1.receive(), equalTo("world!"));
                  }
                })
            .start();

    Fiber f2 =
        new Fiber(
                fjPool,
                new SuspendableRunnable() {
                  @Override
                  public void run() throws SuspendExecution, InterruptedException {
                    assertThat(channel2.receive(), equalTo("hello"));
                    assertThat(channel2.receive(), equalTo("world!"));
                  }
                })
            .start();

    Fiber f3 =
        new Fiber(
                fjPool,
                new SuspendableRunnable() {
                  @Override
                  public void run() throws SuspendExecution, InterruptedException {
                    assertThat(channel3.receive(), equalTo("hello"));
                    assertThat(channel3.receive(), equalTo("world!"));
                  }
                })
            .start();

    Thread.sleep(100);
    topic.send("hello");
    Thread.sleep(100);
    topic.send("world!");

    f1.join();
    f2.join();
    f3.join();
  }
 // *** l'utilisation des données "......"
 // ** et des données de longeurs de "nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn"
 // pour le champ nom
 // * l'impossibilité de modifier l'id d'un motif de remplacemnt une fois enregistré
 @Test
 public void testSSV8VALDEBTA008cIntegrationTests() throws Exception {
   driver.get(baseUrl + "/selectsystem-view-tomcat-oracle/login.xhtml");
   Thread.sleep(1000);
   findElement(By.id("j_username")).clear();
   findElement(By.id("j_username")).sendKeys("usercenter");
   Thread.sleep(1000);
   findElement(By.id("j_password")).clear();
   findElement(By.id("j_password")).sendKeys("pwd8888");
   findElement(By.cssSelector("#login > img[alt=\"Frensh\"]")).click();
   optionalClick(By.xpath("//span/a"));
   findElement(By.id("form:table:1:sdksds")).click();
   findElement(By.xpath("(//img[@alt='English'])[4]")).click();
   findElement(By.xpath("(//a[contains(text(),'Card Replacement Motif')])[2]")).click();
   new Select(findElement(By.id("globalCardReplacementMotifForm:bank")))
       .selectByVisibleText("banque test 3");
   Thread.sleep(1000);
   findElement(By.xpath("//table[@id='globalCardReplacementMotifForm:AZ']/tbody/tr/td/a[3]/img"))
       .click();
   Thread.sleep(1000);
   findElement(By.id("globalCardReplacementMotifForm:inputIdeee")).clear();
   findElement(By.id("globalCardReplacementMotifForm:inputIdeee")).sendKeys("..........");
   Thread.sleep(1000);
   findElement(By.id("globalCardReplacementMotifForm:inputLabeeee")).clear();
   findElement(By.id("globalCardReplacementMotifForm:inputLabeeee")).sendKeys("ReasRp_031");
   findElement(By.cssSelector("img[alt=\"save2\"]")).click();
   findElement(By.id("globalCardReplacementMotifForm:fdfdfffffipppipppiiegggeooo")).click();
   findElement(By.xpath("//table[@id='globalCardReplacementMotifForm:AZ']/tbody/tr/td/a[3]/img"))
       .click();
   Thread.sleep(1000);
   findElement(By.id("globalCardReplacementMotifForm:inputIdeee")).clear();
   findElement(By.id("globalCardReplacementMotifForm:inputIdeee")).sendKeys("ReasRp_031");
   Thread.sleep(1000);
   findElement(By.id("globalCardReplacementMotifForm:inputLabeeee")).clear();
   findElement(By.id("globalCardReplacementMotifForm:inputLabeeee"))
       .sendKeys("nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn");
   findElement(By.cssSelector("img[alt=\"save2\"]")).click();
   findElement(By.id("globalCardReplacementMotifForm:fdfdfffffipppipppiiegggeooo")).click();
   findElement(By.xpath("//table[@id='globalCardReplacementMotifForm:AZ']/tbody/tr/td/a[3]/img"))
       .click();
   Thread.sleep(1000);
   findElement(By.id("globalCardReplacementMotifForm:inputIdeee")).clear();
   findElement(By.id("globalCardReplacementMotifForm:inputIdeee")).sendKeys("ReasRp_033");
   Thread.sleep(1000);
   findElement(By.id("globalCardReplacementMotifForm:inputLabeeee")).clear();
   findElement(By.id("globalCardReplacementMotifForm:inputLabeeee")).sendKeys("ReasRp_033");
   findElement(By.cssSelector("img[alt=\"save2\"]")).click();
   findElement(By.id("globalCardReplacementMotifForm:fdfdfffffipppipppiiegggeooo")).click();
   findElement(
           By.id(
               "globalCardReplacementMotifForm:searchCardDesignFeesResultsId:0:scxqsjhvcqjshcvhqsceee"))
       .click();
   findElement(By.cssSelector("img[alt=\"save2\"]")).click();
   findElement(By.id("globalCardReplacementMotifForm:fdfdfffffipppipppiiegggeooo")).click();
   findElement(By.xpath("(//img[@alt='English'])[2]")).click();
 }
Ejemplo n.º 9
0
  @Test
  public void testOtsi() throws Exception {
    driver.get(baseUrl + "/");
    driver.findElement(By.linkText("Kandidaadid")).click();
    // Warning: waitForTextPresent may require manual changes
    for (int second = 0; ; second++) {
      if (second >= 60) fail("timeout");
      try {
        if (driver
            .findElement(By.cssSelector("BODY"))
            .getText()
            .matches("^[\\s\\S]*Vana Kala[\\s\\S]*$")) break;
      } catch (Exception e) {
      }
      Thread.sleep(1000);
    }

    driver.findElement(By.id("nimi")).clear();
    driver.findElement(By.id("nimi")).sendKeys("Magdalena");
    try {
      assertEquals("Magdalena", driver.findElement(By.id("nimi")).getAttribute("value"));
    } catch (Error e) {
      verificationErrors.append(e.toString());
    }
    driver.findElement(By.id("sButton")).click();
    // Warning: waitForTextPresent may require manual changes
    for (int second = 0; ; second++) {
      if (second >= 60) fail("timeout");
      try {
        if (driver
            .findElement(By.cssSelector("BODY"))
            .getText()
            .matches("^[\\s\\S]*Magdalena Malejeva[\\s\\S]*$")) break;
      } catch (Exception e) {
      }
      Thread.sleep(1000);
    }

    // Warning: verifyTextNotPresent may require manual changes
    try {
      assertFalse(
          driver
              .findElement(By.cssSelector("BODY"))
              .getText()
              .matches("^[\\s\\S]*Vana Kala[\\s\\S]*$"));
    } catch (Error e) {
      verificationErrors.append(e.toString());
    }
  }
  @Test
  public void testSendMessage() throws Exception {
    String url = getAppBaseURL() + "send_message";
    URL obj = new URL(url);
    HttpsURLConnection con = (HttpsURLConnection) obj.openConnection();
    String body = "message=" + URLEncoder.encode(MESSAGE, "UTF-8");

    con.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
    con.setRequestMethod("POST");

    con.setDoOutput(true);
    DataOutputStream wr = new DataOutputStream(con.getOutputStream());
    wr.writeBytes(body);
    wr.flush();
    wr.close();

    int responseCode = con.getResponseCode();

    // It ensures that the app successfully received the message.
    assertEquals(204, responseCode);

    // Try fetching the /fetch_messages endpoint and see if the
    // response contains the message.
    boolean found = false;
    for (int i = 0; i < MAX_RETRY; i++) {
      Thread.sleep(SLEEP_TIME);
      String resp = fetchMessages();
      if (resp.contains(MESSAGE)) {
        found = true;
        break;
      }
    }
    assertTrue(found);
  }
Ejemplo n.º 11
0
  public static void send(Socket sa, String data) throws IOException {
    byte[] content = data.getBytes();

    byte[] length = String.format("%04d", content.length).getBytes();

    byte[] buf = new byte[1024];
    int reslen;
    int rc;
    //  Bounce the message back.
    InputStream in = sa.getInputStream();
    OutputStream out = sa.getOutputStream();

    out.write(length);
    out.write(content);

    System.out.println("sent " + data.length() + " " + data);
    int to_read = 4; // 4 + greeting_size
    int read = 0;
    while (to_read > 0) {
      rc = in.read(buf, read, to_read);
      read += rc;
      to_read -= rc;
      System.out.println("read " + rc + " total_read " + read + " to_read " + to_read);
    }
    System.out.println(String.format("%02x %02x %02x %02x", buf[0], buf[1], buf[2], buf[3]));
    try {
      Thread.sleep(1000);
    } catch (InterruptedException e) {
      e.printStackTrace();
    }
    reslen = Integer.valueOf(new String(buf, 0, 4));

    in.read(buf, 0, reslen);
    System.out.println("recv " + reslen + " " + new String(buf, 0, reslen));
  }
Ejemplo n.º 12
0
  @Ignore
  @Test
  public void whenReceiveNotCalledFromOwnerThenThrowException2() throws Exception {
    assumeTrue(Debug.isAssertionsEnabled());
    final Channel<String> ch = newChannel();

    Fiber fib =
        new Fiber(
                "fiber",
                fjPool,
                new SuspendableRunnable() {
                  @Override
                  public void run() throws SuspendExecution, InterruptedException {
                    String m = ch.receive();

                    assertThat(m, equalTo("a message"));
                  }
                })
            .start();

    Thread.sleep(50);
    ch.send("a message");

    boolean thrown = false;
    try {
      ch.receive();
    } catch (Throwable e) {
      thrown = true;
    }
    assertTrue(thrown);

    fib.join();
  }
Ejemplo n.º 13
0
  @Test
  public void testChannelCloseWithSleep() throws Exception {
    final Channel<Integer> ch = newChannel();

    Fiber fib =
        new Fiber(
                "fiber",
                fjPool,
                new SuspendableRunnable() {
                  @Override
                  public void run() throws SuspendExecution, InterruptedException {
                    for (int i = 1; i <= 5; i++) {
                      Integer m = ch.receive();

                      assertThat(m, equalTo(i));
                    }

                    Integer m = ch.receive();

                    assertThat(m, nullValue());
                    assertTrue(ch.isClosed());
                  }
                })
            .start();

    Thread.sleep(50);
    ch.send(1);
    ch.send(2);
    ch.send(3);
    ch.send(4);
    ch.send(5);

    Thread.sleep(50);
    ch.close();

    ch.send(6);
    ch.send(7);

    fib.join();
  }
 // *** Supression des risques de banques
 @Test
 public void testSSV8VALDEBTA997IntegrationTests() throws Exception {
   driver.get(baseUrl + "/selectsystem-view-tomcat-oracle/login.xhtml");
   Thread.sleep(1000);
   findElement(By.id("j_username")).clear();
   findElement(By.id("j_username")).sendKeys("usercenter");
   Thread.sleep(1000);
   findElement(By.id("j_password")).clear();
   findElement(By.id("j_password")).sendKeys("pwd8888");
   findElement(By.cssSelector("#login > img[alt=\"Frensh\"]")).click();
   optionalClick(By.xpath("//span/a"));
   findElement(By.id("form:table:0:sdksds")).click();
   findElement(By.xpath("(//img[@alt='English'])[11]")).click();
   findElement(By.linkText("Managing Risk")).click();
   new Select(findElement(By.id("globalIssuerRiskBankManagementForm:titletttrrrr")))
       .selectByVisibleText("banque test 1");
   Thread.sleep(1000);
   findElement(By.id("globalIssuerRiskBankManagementForm:hs5414")).click();
   findElement(By.xpath("//td[3]/span/a/img")).click();
   findElement(By.xpath("//td/div[3]/a")).click();
   findElement(By.xpath("//tr[2]/td[3]/center/table/tbody/tr/td[3]/span/a/img")).click();
   findElement(By.xpath("//td/div[3]/a")).click();
   findElement(By.xpath("//tr[3]/td[3]/center/table/tbody/tr/td[3]/span/a/img")).click();
   findElement(By.xpath("//td/div[3]/a")).click();
   findElement(By.id("globalIssuerRiskBankManagementForm:hs5414")).click();
   new Select(findElement(By.id("globalIssuerRiskBankManagementForm:titletttrrrr")))
       .selectByVisibleText("banque test 2");
   Thread.sleep(1000);
   findElement(By.id("globalIssuerRiskBankManagementForm:hs5414")).click();
   findElement(By.xpath("//td[3]/span/a/img")).click();
   findElement(By.xpath("//td/div[2]/a")).click();
   findElement(By.xpath("//tr[2]/td[3]/center/table/tbody/tr/td[3]/span/a/img")).click();
   findElement(By.xpath("//td/div[2]/a")).click();
   findElement(By.xpath("//tr[3]/td[3]/center/table/tbody/tr/td[3]/span/a/img")).click();
   findElement(By.xpath("//td/div[2]/a")).click();
   findElement(By.id("globalIssuerRiskBankManagementForm:hs5414")).click();
   new Select(findElement(By.id("globalIssuerRiskBankManagementForm:titletttrrrr")))
       .selectByVisibleText("banque test 3");
   Thread.sleep(1000);
   findElement(By.id("globalIssuerRiskBankManagementForm:hs5414")).click();
   findElement(By.xpath("//td[3]/span/a/img")).click();
   findElement(By.xpath("//td/div[3]/a")).click();
   findElement(By.xpath("//tr[2]/td[3]/center/table/tbody/tr/td[3]/span/a/img")).click();
   findElement(By.xpath("//td/div[3]/a")).click();
   findElement(By.xpath("//tr[3]/td[3]/center/table/tbody/tr/td[3]/span/a/img")).click();
   findElement(By.xpath("//td/div[3]/a")).click();
   findElement(By.id("globalIssuerRiskBankManagementForm:hs5414")).click();
   new Select(findElement(By.id("globalIssuerRiskBankManagementForm:titletttrrrr")))
       .selectByVisibleText("banque test 2");
   Thread.sleep(1000);
   findElement(By.id("globalIssuerRiskBankManagementForm:hs5414")).click();
   findElement(By.xpath("//td[3]/span/a/img")).click();
   findElement(By.xpath("//td/div[3]/a")).click();
   findElement(By.xpath("//tr[2]/td[3]/center/table/tbody/tr/td[3]/span/a/img")).click();
   findElement(By.xpath("//td/div[3]/a")).click();
   findElement(By.xpath("//tr[3]/td[3]/center/table/tbody/tr/td[3]/span/a/img")).click();
   findElement(By.xpath("//td/div[3]/a")).click();
   findElement(By.id("globalIssuerRiskBankManagementForm:hs5414")).click();
   findElement(By.xpath("(//img[@alt='English'])[2]")).click();
 }
Ejemplo n.º 15
0
  @Test
  public void customExecutorIsPropagated() throws InterruptedException {
    AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
    ctx.register(CustomExecutorAsyncConfig.class);
    ctx.refresh();

    AsyncBean asyncBean = ctx.getBean(AsyncBean.class);
    asyncBean.work();
    Thread.sleep(500);
    assertThat(asyncBean.getThreadOfExecution().getName(), startsWith("Custom-"));

    TestableAsyncUncaughtExceptionHandler exceptionHandler =
        (TestableAsyncUncaughtExceptionHandler) ctx.getBean("exceptionHandler");
    assertFalse("handler should not have been called yet", exceptionHandler.isCalled());

    asyncBean.fail();
    Thread.sleep(500);
    Method m = ReflectionUtils.findMethod(AsyncBean.class, "fail");
    exceptionHandler.assertCalledWith(m, UnsupportedOperationException.class);

    ctx.close();
  }
 @Test
 public void set_A$String$int$Object_Expire() throws Exception {
   MemcachedSessionStore store = new MemcachedSessionStore(getMemcached());
   // given
   String key = "MemcachedSessionStoreTest#set_A$String$int$Object_" + System.currentTimeMillis();
   int expire = 2;
   String value = "aaa";
   // when
   store.set(key, expire, value);
   Thread.sleep(3000L);
   String actual = store.get(key);
   // then
   assertThat(actual, is(nullValue()));
 }
 private void waitForLocations(int locations) throws IOException, InterruptedException {
   for (int tries = 0; tries < RETRIES; )
     try {
       LocatedBlock locatedBlock = getLocatedBlock();
       assertThat(locatedBlock.getLocations().length, is(locations));
       break;
     } catch (AssertionError e) {
       if (++tries < RETRIES) {
         Thread.sleep(1000);
       } else {
         throw e;
       }
     }
 }
Ejemplo n.º 18
0
  @Test
  public void testChannelGroupReceiveWithTimeout() throws Exception {
    final Channel<String> channel1 = newChannel();
    final Channel<String> channel2 = newChannel();
    final Channel<String> channel3 = newChannel();

    final ReceivePortGroup<String> group =
        new ReceivePortGroup<String>(channel1, channel2, channel3);

    Fiber fib =
        new Fiber(
                "fiber",
                fjPool,
                new SuspendableRunnable() {
                  @Override
                  public void run() throws SuspendExecution, InterruptedException {
                    String m1 = group.receive();
                    String m2 = channel2.receive();
                    String m3 = group.receive(10, TimeUnit.MILLISECONDS);
                    String m4 = group.receive(200, TimeUnit.MILLISECONDS);

                    assertThat(m1, equalTo("hello"));
                    assertThat(m2, equalTo("world!"));
                    assertThat(m3, nullValue());
                    assertThat(m4, equalTo("foo"));
                  }
                })
            .start();

    Thread.sleep(100);
    channel3.send("hello");
    Thread.sleep(100);
    channel2.send("world!");
    Thread.sleep(100);
    channel1.send("foo");
    fib.join();
  }
Ejemplo n.º 19
0
 @Override
 public void failed(Throwable e, Description desc) {
   System.out.println("FAILED TEST " + desc.getMethodName() + ": " + e.getMessage());
   e.printStackTrace(System.err);
   if (Debug.isDebug() && !(e instanceof OutOfMemoryError)) {
     Debug.record(
         0,
         "EXCEPTION IN THREAD "
             + Thread.currentThread().getName()
             + ": "
             + e
             + " - "
             + Arrays.toString(e.getStackTrace()));
     Debug.dumpRecorder("~/quasar.dump");
   }
 }
  @Test
  public void runUploadThenDownload() throws Exception {
    final String trackingId = newName();

    IndyFoloContentClientModule module = client.module(IndyFoloContentClientModule.class);

    // upload
    module.store(trackingId, hosted, STORE, path, new ByteArrayInputStream(bytes));

    // download
    module.get(trackingId, hosted, STORE, path);

    Thread.sleep(2000); // wait for event being fired

    sealAndCheck(trackingId);
  }
Ejemplo n.º 21
0
  @Test
  public void testPrimitiveChannelClose() throws Exception {
    assumeThat(mailboxSize, not(equalTo(0)));

    final IntChannel ch = Channels.newIntChannel(mailboxSize, policy);

    Fiber fib =
        new Fiber(
                "fiber",
                fjPool,
                new SuspendableRunnable() {
                  @Override
                  public void run() throws SuspendExecution, InterruptedException {
                    for (int i = 1; i <= 5; i++) {
                      int m = ch.receiveInt();

                      assertThat(m, is(i));
                    }

                    try {
                      int m = ch.receiveInt();
                      fail("m = " + m);
                    } catch (QueueChannel.EOFException e) {
                    }

                    assertTrue(ch.isClosed());
                  }
                })
            .start();

    Thread.sleep(50);
    ch.send(1);
    ch.send(2);
    ch.send(3);
    ch.send(4);
    ch.send(5);

    ch.close();

    ch.send(6);
    ch.send(7);

    fib.join();
  }
Ejemplo n.º 22
0
  @Test
  public void testWeather() throws Exception {
    driver.get(baseUrl + "/");
    driver.findElement(By.linkText("Edmonton")).click();
    for (int second = 0; ; second++) {
      if (second >= 60) fail("timeout");
      try {
        if (isElementPresent(By.id("cityjump"))) break;
      } catch (Exception e) {
      }
      Thread.sleep(1000);
    }

    // Warning: verifyTextPresent may require manual changes
    try {
      assertTrue(
          driver
              .findElement(By.cssSelector("BODY"))
              .getText()
              .matches("^[\\s\\S]*Current Conditions[\\s\\S]*$"));
    } catch (Error e) {
      verificationErrors.append(e.toString());
    }
    // Warning: verifyTextPresent may require manual changes
    try {
      assertTrue(
          driver
              .findElement(By.cssSelector("BODY"))
              .getText()
              .matches("^[\\s\\S]*Forecast[\\s\\S]*$"));
    } catch (Error e) {
      verificationErrors.append(e.toString());
    }
    // Warning: verifyTextPresent may require manual changes
    try {
      assertTrue(
          driver
              .findElement(By.cssSelector("BODY"))
              .getText()
              .matches("^[\\s\\S]*Edmonton City Centre Airport[\\s\\S]*$"));
    } catch (Error e) {
      verificationErrors.append(e.toString());
    }
  }
Ejemplo n.º 23
0
 @Test
 public void testContactAdd() throws Exception {
   driver.get(LoginHelper.baseUrl + "/Account/Login?ReturnUrl=%2f");
   LoginHelper.login(driver);
   try {
     Thread.sleep(2000);
   } catch (InterruptedException x) {
   }
   driver.findElement(By.id("tileContactModule")).click();
   driver.findElement(By.linkText("Добавить новый")).click();
   driver.findElement(By.id("FirstName")).click();
   driver.findElement(By.id("FirstName")).clear();
   driver.findElement(By.id("FirstName")).sendKeys("AutoName");
   driver.findElement(By.id("LastName")).click();
   driver.findElement(By.id("LastName")).clear();
   driver.findElement(By.id("LastName")).sendKeys("Auto2Name");
   new Select(driver.findElement(By.id("SpecialityId"))).selectByVisibleText("Chirurg");
   driver.findElement(By.id("bntSave")).click();
 }
Ejemplo n.º 24
0
  // Test Case 1: Postal Code Missing - Error
  private void newProfilePostalCodeEmpty() throws InterruptedException {

    driver.manage().window().maximize();
    driver.findElement(By.cssSelector("li")).click();
    new Select(driver.findElement(By.id("profileGender"))).selectByVisibleText("Woman");
    driver.findElement(By.cssSelector("option[value=\"3\"]")).click();
    new Select(driver.findElement(By.id("profileLookingGender"))).selectByVisibleText("Man");
    driver.findElement(By.cssSelector("#profileLookingGender > option[value=\"2\"]")).click();
    driver.findElement(By.id("profileLookingMinAge")).click();
    new Select(driver.findElement(By.id("profileLookingMinAge"))).selectByVisibleText("20");
    driver.findElement(By.cssSelector("option[value=\"20\"]")).click();
    new Select(driver.findElement(By.id("profileLookingMaxAge"))).selectByVisibleText("36");
    driver.findElement(By.cssSelector("#profileLookingMaxAge > option[value=\"36\"]")).click();
    driver.findElement(By.cssSelector("#country > option[value=\"39\"]")).click();
    driver.findElement(By.id("submit")).click();

    System.out.println("ERROR: Postal Code is Empty");
    Thread.sleep(5000);
  }
Ejemplo n.º 25
0
  // Profile creation - step 1
  private void profilePage1() throws InterruptedException {

    driver.manage().window().maximize();
    driver.findElement(By.cssSelector("li")).click();
    new Select(driver.findElement(By.id("profileGender"))).selectByVisibleText("Woman");
    driver.findElement(By.cssSelector("option[value=\"3\"]")).click();
    new Select(driver.findElement(By.id("profileLookingGender"))).selectByVisibleText("Man");
    driver.findElement(By.cssSelector("#profileLookingGender > option[value=\"2\"]")).click();
    driver.findElement(By.id("profileLookingMinAge")).click();
    new Select(driver.findElement(By.id("profileLookingMinAge"))).selectByVisibleText("20");
    driver.findElement(By.cssSelector("option[value=\"20\"]")).click();
    new Select(driver.findElement(By.id("profileLookingMaxAge"))).selectByVisibleText("36");
    driver.findElement(By.cssSelector("#profileLookingMaxAge > option[value=\"36\"]")).click();
    driver.findElement(By.cssSelector("#country > option[value=\"39\"]")).click();
    driver.findElement(By.id(("postalCode"))).click();
    driver.findElement(By.id(("postalCode"))).clear();
    driver.findElement(By.id(("postalCode"))).sendKeys("H3S1H4");
    driver.findElement(By.id("submit")).click();
    Thread.sleep(5000);
  }
Ejemplo n.º 26
0
  @Test
  public void test1create() throws InterruptedException {
    long now = System.currentTimeMillis();

    Thread.sleep(20);

    String token = store.newToken("*****@*****.**", "domain.com");

    assertThat(token, is(notNullValue()));
    assertThat(token.length(), is(not(0)));
    assertThat(store.getSessions().size(), is(1));

    Session s = store.getSessions().get(0);

    assertThat(s.getId(), is(notNullValue()));
    assertThat(s.getDomain(), is("domain.com"));
    assertThat(s.getToken(), is(token));
    assertThat(s.getUser(), is("*****@*****.**"));
    assertThat(s.getSessionStart(), is(greaterThan(now)));
    assertThat(s.getSessionExpiration(), is(greaterThan(s.getSessionStart())));
  }
Ejemplo n.º 27
0
  @Test
  public void whenChannelClosedThenBlockedSendsComplete() throws Exception {
    assumeThat(policy, is(OverflowPolicy.BLOCK));
    final Channel<Integer> ch = newChannel();

    final SuspendableRunnable r =
        new SuspendableRunnable() {
          @Override
          public void run() throws SuspendExecution, InterruptedException {
            for (int i = 1; i <= 100; i++) {
              ch.send(i);
            }
          }
        };
    Fiber fib1 = new Fiber("fiber", fjPool, r).start();
    Fiber fib2 = new Fiber("fiber", fjPool, r).start();

    Thread.sleep(500);

    ch.close();
    fib1.join();
    fib2.join();
  }
Ejemplo n.º 28
0
  @Test
  public void sendMessageFromThreadToFiber() throws Exception {
    final Channel<String> ch = newChannel();

    Fiber fib =
        new Fiber(
                "fiber",
                fjPool,
                new SuspendableRunnable() {
                  @Override
                  public void run() throws SuspendExecution, InterruptedException {
                    String m = ch.receive();

                    assertThat(m, equalTo("a message"));
                  }
                })
            .start();

    Thread.sleep(50);
    ch.send("a message");

    fib.join();
  }
Ejemplo n.º 29
0
  private void viewEditProfile() throws InterruptedException {

    driver.findElement(By.linkText("My Profile")).click();
    driver.findElement(By.linkText("View Profile")).click();
    // driver.findElement(By.id("photoBlockClose")).click();
    driver.findElement(By.linkText("My Profile")).click();
    driver.findElement(By.linkText("Edit my profile")).click();

    new Select(driver.findElement(By.id("ethnicity"))).selectByVisibleText("Mixed Race");
    new Select(driver.findElement(By.id("height"))).selectByVisibleText("4ft. 10in.");
    Thread.sleep(4000);
    driver.findElement(By.id("submit_basic_information")).click();
    Thread.sleep(4000);

    driver.findElement(By.id("aboutMyself")).click();
    driver.findElement(By.id("aboutMyself")).clear();
    driver
        .findElement(By.id("aboutMyself"))
        .sendKeys("this is 5145502181, email [email protected], web: www.abc.com");
    Thread.sleep(4000);
    driver.findElement(By.id("submit_about_myself")).click();
    Thread.sleep(4000);

    driver.findElement(By.id("lookingFor")).click();
    driver.findElement(By.id("lookingFor")).clear();
    driver
        .findElement(By.id("lookingFor"))
        .sendKeys("my url is www.kala.com, 4389439088, email id is [email protected]");
    Thread.sleep(4000);
    driver.findElement(By.id("submit_who_im_looking_for")).click();
    Thread.sleep(4000);

    driver.findElement(By.linkText("My Profile")).click();
    driver.findElement(By.linkText("View Profile")).click();
    Thread.sleep(3000);

    verifyChanges();
  }
  @Test
  public void testMap2() throws Exception {
    driver.get(baseUrl + "/ModSolarPlatform/login.jsp;jsessionid=F33B6C551CBA0A359E87354993539EFA");
    driver.findElement(By.id("username")).clear();
    driver.findElement(By.id("username")).sendKeys("christianqa");
    driver.findElement(By.id("password")).clear();

    driver.findElement(By.id("password")).sendKeys("qa");
    driver.findElement(By.name("submit")).click();
    driver.findElement(By.cssSelector("div.newLeadList")).click();
    driver.findElement(By.id("tabResidential")).click();
    driver.findElement(By.id("firstNameResidential")).clear();
    driver.findElement(By.id("firstNameResidential")).sendKeys("christian");
    driver.findElement(By.id("lastNameResidential")).clear();
    driver.findElement(By.id("lastNameResidential")).sendKeys("Mabila");
    driver.findElement(By.id("addressResidential")).clear();
    driver.findElement(By.id("addressResidential")).sendKeys("600 Clipper rd");
    driver.findElement(By.id("cityResidential")).clear();
    driver.findElement(By.id("cityResidential")).sendKeys("Belmont");
    new Select(driver.findElement(By.id("stateResidential"))).selectByVisibleText("California");
    // driver.findElement(By.id("zipCodeResidential")).clear();
    // driver.findElement(By.id("zipCodeResidential")).sendKeys("90042");
    driver.findElement(By.cssSelector("#zipCodeResidential")).clear();
    driver.findElement(By.cssSelector("#zipCodeResidential")).sendKeys("90042");
    Thread.sleep(1500);
    driver.findElement(By.id("emailResidential")).clear();
    driver.findElement(By.id("emailResidential")).sendKeys("*****@*****.**");
    driver.findElement(By.id("utilityTaxRateInputAddressResidential")).clear();
    driver.findElement(By.id("utilityTaxRateInputAddressResidential")).sendKeys("1.2");
    driver.findElement(By.id("averageMonthlyBillResidential")).clear();
    driver.findElement(By.id("averageMonthlyBillResidential")).sendKeys("225");
    driver.findElement(By.id("nextBtn")).click();
    Thread.sleep(1000);

    WebElement mainCanvas = driver.findElement(By.xpath(".//*[@id='mapCanvas']/div/div[1]/div[2]"));

    Actions mouseAction = new Actions(driver);

    mouseAction.moveToElement(mainCanvas);

    mouseAction.contextClick(mainCanvas);

    mouseAction.moveByOffset(5, 25);

    mouseAction.sendKeys(Keys.ARROW_DOWN);

    mouseAction.sendKeys(Keys.RETURN);
    // mouseAction.keyDown(Keys.ARROW_DOWN);
    // mouseAction.moveToElement(subMenu);

    mouseAction.click();

    mouseAction.perform();

    WebElement mainCanvas2 =
        driver.findElement(
            By.xpath("html/body/div[1]/div/div[2]/div[5]/div[2]/div[2]/div/div[1]/div[2]"));

    Actions mouseAction2 = new Actions(driver);

    mouseAction2.moveToElement(mainCanvas2);

    mouseAction2.contextClick(mainCanvas2);

    mouseAction2.moveByOffset(70, 50);

    mouseAction2.sendKeys(Keys.ARROW_DOWN);

    mouseAction2.sendKeys(Keys.RETURN);
    // mouseAction.keyDown(Keys.ARROW_DOWN);
    // mouseAction.moveToElement(subMenu);

    mouseAction2.click();

    mouseAction2.perform();

    WebElement mainCanvas3 =
        driver.findElement(
            By.xpath("html/body/div[1]/div/div[2]/div[5]/div[2]/div[2]/div/div[1]/div[2]"));

    Actions mouseAction3 = new Actions(driver);

    mouseAction3.moveToElement(mainCanvas3);

    mouseAction3.contextClick(mainCanvas3);

    mouseAction3.moveToElement(mainCanvas2, 500, 220);

    mouseAction3.sendKeys(Keys.ARROW_DOWN);

    mouseAction3.sendKeys(Keys.RETURN);
    // mouseAction.keyDown(Keys.ARROW_DOWN);
    // mouseAction.moveToElement(subMenu);

    mouseAction3.click();

    mouseAction3.perform();

    // Clicking inside the Triangle

    WebElement e =
        driver.findElement(
            By.xpath("html/body/div[1]/div/div[2]/div[5]/div[2]/div[2]/div/div[1]/div[2]"));

    new Actions(driver).moveToElement(e, 0, 0).moveByOffset(520, 255).click().build().perform();
    driver.findElement(By.cssSelector("div.pgNext.right > input.btn")).click();
    driver.findElement(By.xpath("//div[@id='accordion']")).click();
    driver.findElement(By.id("regionsPaneTitle")).click();

    // Clicking inside the Triangle 1

    WebElement eI =
        driver.findElement(
            By.xpath("html/body/div[1]/div/div[2]/div[5]/div[2]/div[2]/div/div[1]/div[2]"));

    new Actions(driver).moveToElement(eI, 0, 0).moveByOffset(520, 255).click().build().perform();

    Thread.sleep(1000);

    // Clicking inside the Triangle 1

    WebElement eS =
        driver.findElement(
            By.xpath("html/body/div[1]/div/div[2]/div[5]/div[2]/div[2]/div/div[1]/div[2]"));

    new Actions(driver).moveToElement(eS, 0, 0).moveByOffset(520, 255).click().build().perform();
    Thread.sleep(1000);
    driver.findElement(By.id("accordion")).click();
    driver.findElement(By.id("mountTypeRegion1")).click();
    new Select(driver.findElement(By.id("mountTypeRegion1"))).selectByVisibleText("Flat Roof");
    driver.findElement(By.cssSelector("#mountTypeRegion1 > option[value=\"1\"]")).click();
    driver.findElement(By.id("mountTypeRegion1")).click();
    new Select(driver.findElement(By.id("mountTypeRegion1"))).selectByVisibleText("Ground Mount");
    driver.findElement(By.cssSelector("#mountTypeRegion1 > option[value=\"2\"]")).click();
    driver.findElement(By.id("mountTypeRegion1")).click();
    new Select(driver.findElement(By.id("mountTypeRegion1"))).selectByVisibleText("Flat Roof");
    driver.findElement(By.cssSelector("#mountTypeRegion1 > option[value=\"1\"]")).click();
    driver.findElement(By.id("mountTypeRegion1")).click();
    driver.findElement(By.id("mountTypeRegion1")).click();
    new Select(driver.findElement(By.id("mountTypeRegion1"))).selectByVisibleText("Sloped Roof");
    driver.findElement(By.cssSelector("#mountTypeRegion1 > option[value=\"0\"]")).click();
    ////
    // driver.findElement(By.xpath("/html/body/div[3]/div[1]/div/div[2]/div[4]/form/div[2]/div/div[3]/div[1]/div[2]/div/input")).click();
    driver
        .findElement(
            By.xpath(
                "/html/body/div[3]/div[1]/div/div[2]/div[4]/form/div[2]/div/div[3]/div[1]/div[2]/div/input"))
        .clear();
    driver
        .findElement(
            By.xpath(
                "/html/body/div[3]/div[1]/div/div[2]/div[4]/form/div[2]/div/div[3]/div[1]/div[2]/div/input"))
        .sendKeys("52");
    driver
        .findElement(
            By.xpath(
                "/html/body/div[3]/div[1]/div/div[2]/div[4]/form/div[2]/div/div[3]/div[1]/div[2]/div/input"))
        .click();
    driver
        .findElement(
            By.xpath(
                "/html/body/div[3]/div[1]/div/div[2]/div[4]/form/div[2]/div/div[3]/div[1]/div[2]/div/input"))
        .clear();
    driver
        .findElement(
            By.xpath(
                "/html/body/div[3]/div[1]/div/div[2]/div[4]/form/div[2]/div/div[3]/div[1]/div[2]/div/input"))
        .sendKeys("18");
    driver
        .findElement(
            By.xpath(
                "/html/body/div[3]/div[1]/div/div[2]/div[4]/form/div[2]/div/div[3]/div[1]/div[2]/div/input"))
        .click();
    driver
        .findElement(
            By.xpath(
                "/html/body/div[3]/div[1]/div/div[2]/div[4]/form/div[2]/div/div[3]/div[1]/div[2]/div/input"))
        .clear();
    driver
        .findElement(
            By.xpath(
                "/html/body/div[3]/div[1]/div/div[2]/div[4]/form/div[2]/div/div[3]/div[1]/div[2]/div/input"))
        .sendKeys("45");
    driver.findElement(By.id("mountTypeRegion1")).click();
    new Select(driver.findElement(By.id("mountTypeRegion1"))).selectByVisibleText("Flat Roof");
    driver.findElement(By.cssSelector("#mountTypeRegion1 > option[value=\"1\"]")).click();
    driver.findElement(By.id("mountTypeRegion1")).click();
    new Select(driver.findElement(By.id("mountTypeRegion1"))).selectByVisibleText("Sloped Roof");
    driver.findElement(By.cssSelector("#mountTypeRegion1 > option[value=\"0\"]")).click();
    driver.findElement(By.id("mountTypeRegion1")).click();

    new Select(driver.findElement(By.id("mountTypeRegion1"))).selectByVisibleText("Flat Roof");
    driver.findElement(By.cssSelector("#mountTypeRegion1 > option[value=\"1\"]")).click();
    driver.findElement(By.id("mountTypeRegion1")).click();
    new Select(driver.findElement(By.id("mountTypeRegion1"))).selectByVisibleText("Ground Mount");
    driver.findElement(By.cssSelector("#mountTypeRegion1 > option[value=\"2\"]")).click();
    driver.findElement(By.cssSelector("label.overTxtLabel")).click();
    driver.findElement(By.id("proposalName")).sendKeys("AUTOMATION TEST");
    driver.findElement(By.id("regionsPaneTitle")).click();
    driver.findElement(By.id("regionsPaneTitle")).click();
    Thread.sleep(500);
    /// driver.findElement(By.id("squareUpButton2")).click();
    driver.findElement(By.xpath("//input[@id='snapAzimuthButton1']")).click();
    driver.findElement(By.xpath("//input[@id='applySetbacksButton1']")).click();
    /// assertEquals("Setbacks cannot be less than zero.", closeAlertAndGetItsText());
    //// driver.findElement(By.id("delPolygonButton2")).click();
    Thread.sleep(1000);
    /// driver.findElement(By.id("squareUpButton3")).click();
    /// driver.findElement(By.id("squareUpButton3")).click();
    driver.findElement(By.id("accordion")).click();
    driver.findElement(By.cssSelector("div[title=\"Pan up\"]")).click();
    driver.findElement(By.cssSelector("div[title=\"Pan right\"]")).click();
    driver.findElement(By.cssSelector("div[title=\"Pan down\"]")).click();
    driver.findElement(By.cssSelector("div[title=\"Pan left\"]")).click();
    driver.findElement(By.cssSelector("div[title=\"Zoom out\"] > img")).click();
    driver.findElement(By.cssSelector("div[title=\"Zoom in\"] > img")).click();
    driver.findElement(By.id("accordion")).click();
    /////
    /////
    ////
    /// no need driver.findElement(By.xpath("//div[@id='solutionCategory']/ul/li[2]/h3")).click();
    /// no need driver.findElement(By.cssSelector("span.arrow")).click();
    driver.findElement(By.xpath("//input[@value='Next']")).click();
    driver.findElement(By.id("accordion")).click();
    driver.findElement(By.id("accordionTitleText")).click();
    driver.findElement(By.id("accordion")).click();
    driver.findElement(By.id("nextButton")).click();
    driver.findElement(By.id("accordion")).click();
    driver.findElement(By.id("contentUsagePaneTitle")).click();
    driver.findElement(By.id("accordion")).click();
    Thread.sleep(1000);
    // click on Inverters
    driver.findElement(By.xpath("//h3[text()= 'Inverters']")).click();

    // Click on Arrow

    driver.findElement(By.xpath("//span[@class = 'arrow']")).click();

    Thread.sleep(1000);
    // Default Invert select
    driver.findElement(By.xpath("html/body/ul/li[2]/span")).click();

    // Click on Arrow
    driver.findElement(By.xpath("//span[@class = 'arrow']")).click();

    Thread.sleep(2000);

    // Click on Next button
    driver.findElement(By.xpath("//input[@value='Next']")).click();
    Thread.sleep(2000);
    ////// errror--- driver.findElement(By.id("supplyLeadDetailsBtn1")).click();
    driver.findElement(By.id("accordion")).click();
    ///// driver.findElement(By.id("accordion")).click();
    ////// driver.findElement(By.id("accordion")).click();
    Thread.sleep(1500);

    ///// driver.findElement(By.id("backBtn")).click();
    //// driver.findElement(By.cssSelector("label > input[type=\"button\"]")).click();
    // Click on Next button

    driver.findElement(By.xpath("//input[@id='nextButton']")).click();

    /// PREVIEW PAGE STARTS HERE
    Thread.sleep(2000);

    driver.findElement(By.id("accordion")).click();
    Thread.sleep(250);
    driver.findElement(By.cssSelector("#buyForCashCheckbox")).click();
    Thread.sleep(250);
    driver.findElement(By.cssSelector("#nextButton")).click();
    Thread.sleep(1000);

    // ERROR: Caught exception [unknown command []]
  }