Пример #1
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);
    }
  }
  @Test
  public void testCoordinateListenerConnectionDiesReconnectAfterTimeout() throws Exception {
    final CountDownLatch connectedLatch1 = new CountDownLatch(2);
    final CountDownLatch connectedLatch2 = new CountDownLatch(6);
    TestCoordinateListener listener = setUpListenerEnvironment(connectedLatch1, connectedLatch2);
    assertTrue(connectedLatch1.await(20, TimeUnit.SECONDS));
    assertEquals(
        CoordinateListener.Event.COORDINATE_OK, listener.events.get(listener.events.size() - 1));
    log.info("Killing connection");
    forwarder.terminate();

    log.info("Connection down.");

    Thread.sleep(9000);
    log.info("Recreating connection soon" + forwarderPort + "->" + zkport);
    Thread.sleep(1000);
    assertEquals(
        CoordinateListener.Event.NO_CONNECTION_TO_STORAGE,
        listener.events.get(listener.events.size() - 1));
    forwarder = new PortForwarder(forwarderPort, "127.0.0.1", zkport);
    assertTrue(connectedLatch2.await(20, TimeUnit.SECONDS));

    for (int c = 0; c < 100; c++) {
      if (CoordinateListener.Event.COORDINATE_OK
          == listener.events.get(listener.events.size() - 1)) {
        break;
      }
      Thread.sleep(300);
    }
    Thread.sleep(4500);
    assertEquals(
        CoordinateListener.Event.COORDINATE_OK, listener.events.get(listener.events.size() - 1));

    forwarder.terminate();
  }
  /**
   * Tests the behavior of Zookeeper upon a restart. ZK should clean up old coordinates.
   *
   * @throws Exception
   */
  @Test
  public void testZookeeperRestarts() throws Exception {
    final CountDownLatch connectedLatch1 = new CountDownLatch(1);
    final CountDownLatch connectedLatch2 = new CountDownLatch(3);
    TestCoordinateListener listener = setUpListenerEnvironment(connectedLatch1, connectedLatch2);
    assertTrue(connectedLatch1.await(20, TimeUnit.SECONDS));
    log.info("Killing zookeeper");
    forwarder.terminate();

    ezk.shutdown();
    ezk.del();
    ezk.init();
    Thread.sleep(2000);
    forwarder = new PortForwarder(forwarderPort, "127.0.0.1", zkport);

    int timeoutSecs = 30;
    while (--timeoutSecs > 0) {
      Thread.sleep(1000);
    }
    Coordinate c = Coordinate.parse("1.service.user.cell");
    cn.createCoordinate(c);

    Thread.sleep(9000);
    assertEquals(
        listener.events.get(listener.events.size() - 1), CoordinateListener.Event.COORDINATE_OK);
  }
Пример #4
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");
  }
 // *** 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();
 }
Пример #6
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());
    }
  }
Пример #7
0
 @Test
 public void testCreateBroker() {
   System.out.println("testCreateBroker");
   Platform.runLater(
       new Runnable() {
         @Override
         public void run() {
           synchronized (lock) {
             // Setup
             act = new ChildActivity();
             act.setScene(new HBox());
             Response response = new Response();
             response.setStatus(Status.OK);
             response.setActivity(act);
             browser.getBrowserPanel().receiveResponse(response);
           }
         }
       });
   try {
     Thread.sleep(100);
   } catch (InterruptedException ex) {
     ex.printStackTrace();
   }
   synchronized (lock) {
     assertNotNull(act.createBroker());
   }
 }
  @Test
  public void testCircularRouteDetection() throws Exception {
    String wildcardConfiguration =
        "{"
            + "\"nats_to_redis_map\" : ["
            + "{"
            + "\"subject\" : \"foo\","
            + "\"channel\" : \"NATS\""
            + "}"
            + "],"
            + "\"redis_to_nats_map\" : ["
            + "{"
            + "\"channel\" : \"NATS\","
            + "\"subject\" : \"foo\""
            + "}"
            + "]"
            + "}";

    System.setProperty(RedisPubSubPlugin.CONFIG_URL, generateContentFile(wildcardConfiguration));

    Connector c = new Connector();

    ExecutorService executor = Executors.newFixedThreadPool(1);
    executor.execute(c);
    Thread.sleep(1000);
    c.shutdown();

    // TODO - check logs for circular route message.
  }
 @StartSaga
 @SagaEventHandler(associationProperty = "myIdentifier")
 public void handleSomeEvent(SlowStartingEvent event) throws InterruptedException {
   event.getStartCdl().countDown();
   capturedEvents.add(event);
   Thread.sleep(event.getDuration());
 }
Пример #10
0
 @Test
 public void testObserveOnWithSlowConsumer() {
   int NUM = (int) (Observable.bufferSize() * 0.2);
   AtomicInteger c = new AtomicInteger();
   TestSubscriber<Integer> ts = new TestSubscriber<>();
   incrementingIntegers(c)
       .observeOn(Schedulers.computation())
       .map(
           i -> {
             try {
               Thread.sleep(1);
             } catch (InterruptedException e) {
               e.printStackTrace();
             }
             return i;
           })
       .take(NUM)
       .subscribe(ts);
   ts.awaitTerminalEvent();
   ts.assertNoErrors();
   System.out.println(
       "testObserveOnWithSlowConsumer => Received: " + ts.valueCount() + "  Emitted: " + c.get());
   assertEquals(NUM, ts.valueCount());
   assertTrue(c.get() < Observable.bufferSize() * 2);
 }
Пример #11
0
  @Test(timeout = 2000)
  public void testFirehoseFailsAsExpected() {
    AtomicInteger c = new AtomicInteger();
    TestSubscriber<Integer> ts = new TestSubscriber<>();

    firehose(c)
        .observeOn(Schedulers.computation())
        .map(
            v -> {
              try {
                Thread.sleep(10);
              } catch (Exception e) {
                e.printStackTrace();
              }
              return v;
            })
        .subscribe(ts);

    ts.awaitTerminalEvent();
    System.out.println(
        "testFirehoseFailsAsExpected => Received: " + ts.valueCount() + "  Emitted: " + c.get());

    // FIXME it is possible slow is not slow enough or the main gets delayed and thus more than one
    // source value is emitted.
    int vc = ts.valueCount();
    assertTrue("10 < " + vc, vc <= 10);

    ts.assertError(MissingBackpressureException.class);
  }
 private void run(
     Runnable runnable, int numberOfRequests, final ConcurrentHashMap<String, Boolean> results)
     throws InterruptedException {
   Boolean finalResult = true;
   LOGGER.info("Tests start now!");
   final ArrayList<Thread> threads = new ArrayList<>();
   for (int i = 0; i < numberOfRequests; i++) {
     Thread t = new Thread(runnable, "pipeline" + i);
     threads.add(t);
   }
   for (Thread t : threads) {
     Thread.sleep(1000 * (new Random().nextInt(3) + 1));
     t.setUncaughtExceptionHandler(
         new Thread.UncaughtExceptionHandler() {
           public void uncaughtException(Thread t, Throwable e) {
             LOGGER.error("Exception " + e + " from thread " + t);
             results.put(t.getName(), false);
           }
         });
     t.start();
   }
   for (Thread t : threads) {
     int i = threads.indexOf(t);
     if (i == (numberOfRequests - 1)) {
       //                takeHeapDump(dumpDir, i);
     }
     t.join();
   }
   for (String threadId : results.keySet()) {
     finalResult = results.get(threadId) && finalResult;
   }
   assertThat(finalResult, is(true));
 }
Пример #13
0
 private void AreaOfStudy() throws IOException, InterruptedException {
   // Click Area of School
   driver
       .findElement(
           By.xpath(
               "//ul[@class='vertical-tabs-list']/li/a/strong[contains(text(), \"Area of Study\")]"))
       .click();
   // Select One Area Study
   new Select(driver.findElement(By.id("edit-area-of-study-parent")))
       .selectByVisibleText("Area, Ethnic, Cultural, and Gender Studies");
   // Wait For Another Select List To Load
   Thread.sleep(5000);
   // Select Subareas of Study
   new Select(driver.findElement(By.xpath("//div[@id='child-area-of-study-wrapper']//select")))
       .selectByVisibleText("Area, Ethnic, Cultural, and Gender Studies, Other");
   // Click Apply
   driver.findElement(By.id("edit-area-of-study-apply-filter")).click();
   // Check Result Received or Not
   try {
     assertTrue(
         func.isTextPresent(driver.findElement(By.className("search-total-results")).getText()));
   } catch (Error e) {
     verificationErrors.append(e.toString());
   }
   // Click All Selections
   driver.findElement(By.linkText("Clear All Selections")).click();
 }
  @Test
  public void testPersistenceTimer2() throws Exception {
    KieSession service = (KieSession) ctx.getBean("jpaSingleSessionCommandService2");

    int sessionId = service.getId();

    ProcessInstance processInstance = service.startProcess("org.drools.test.ProcessTimer2");
    log.info("Started process instance {}", processInstance.getId());

    Thread.sleep(2000);

    final Environment env = (Environment) ctx.getBean("env");
    /*
    Environment env = KnowledgeBaseFactory.newEnvironment();
    env.set( EnvironmentName.ENTITY_MANAGER_FACTORY,
             ctx.getBean( "myEmf" ) );
    env.set( EnvironmentName.TRANSACTION_MANAGER,
             ctx.getBean( "txManager" ) );
    */
    KieStoreServices kstore = (KieStoreServices) ctx.getBean("kstore1");
    KieBase kbase1 = (KieBase) ctx.getBean("kb_persistence");
    service = kstore.loadKieSession(sessionId, kbase1, null, env);

    processInstance = service.getProcessInstance(processInstance.getId());
    assertNull(processInstance);
  }
 private static void waitAQuarterSecond() {
   try {
     Thread.sleep(250);
   } catch (InterruptedException e) {
     e.printStackTrace();
   }
 }
  @Test
  public void testLoginToCamcast() throws Exception {
    driver.get(DataServiceProperties.APPURL);

    assertTrue(
        driver
            .findElement(By.cssSelector("BODY"))
            .getText()
            .matches("^[\\s\\S]*User name[\\s\\S]*$"));
    Thread.sleep(1000);
    assertTrue(
        driver
            .findElement(By.cssSelector("BODY"))
            .getText()
            .matches("^[\\s\\S]*Password[\\s\\S]*$"));

    userLogin.UserLoginCredentials(driver);

    // userLogin.ChangePassword(driver);

    assertTrue(
        driver
            .findElement(By.cssSelector("BODY"))
            .getText()
            .matches("^[\\s\\S]*Sign out[\\s\\S]*$"));
    driver.findElement(By.linkText("Sign out")).click();
  }
  @Test
  public void testRedisToNats() throws Exception {

    System.clearProperty(RedisPubSubPlugin.CONFIG_URL);

    Connector c = new Connector();

    ExecutorService executor = Executors.newFixedThreadPool(6);

    RedisPublisher rp = new RedisPublisher("rp", "Export_NATS", 5);
    NatsSubscriber ns = new NatsSubscriber("ns", "Import.Redis", 5);

    // start the connector
    executor.execute(c);

    // start the subsciber app
    executor.execute(ns);

    // wait for subscriber to be ready.
    ns.waitUntilReady();

    // let the connector start
    Thread.sleep(2000);

    // start the publisher
    executor.execute(rp);

    // wait for the subscriber to complete.
    ns.waitForCompletion();

    Assert.assertTrue("Invalid count", ns.getMessageCount() == 5);

    c.shutdown();
  }
  @Test
  public void testSendAndReceive() throws Exception {

    // Run the main controller
    ControllerRunner controllerRunner =
        new ControllerRunner(10, 9090, InetAddress.getLocalHost(), "127.0.0.1", 8008);
    controllerRunner.run();
    System.out.println("Controller running");

    Random random = new Random();
    int player = random.nextInt();

    // Connect a new controller and send test alarm
    Controller controller = new Controller(10);
    Socket connection1 = controller.connectTo(InetAddress.getLocalHost().getHostAddress(), 9090);
    Alarm alarm = new Alarm(player, System.currentTimeMillis(), new PlayerCause(player));
    controller.send(alarm, connection1);

    Controller controller2 = new Controller(10);
    Socket connection2 = controller2.connectTo(InetAddress.getLocalHost().getHostAddress(), 9090);
    long alarmtime = System.currentTimeMillis() + 500;
    Position position1 = new Position(player, System.currentTimeMillis(), 1, 2, 3);
    Position position2 = new Position(player, alarmtime, 100, 200, 300);
    controller2.send(position1, connection2);
    controller2.send(position2, connection2);
    controller2.send(new Request(player, DataType.ACCEL, -1, -1), connection2);
    controller2.send(new Request(player, DataType.POS, -1, -1), connection2);

    Thread.sleep(15000);
    List<Sendable> received = controller2.receive(connection2);
    List<Alarm> alarms = new ArrayList<Alarm>();
    List<Acceleration> accelerations = new ArrayList<Acceleration>();
    List<Position> positions = new ArrayList<Position>();

    // Distribute the sendable objects
    for (Sendable sendable : received) {
      if (sendable instanceof Alarm) {
        alarms.add((Alarm) sendable);

      } else if (sendable instanceof Service) {
        Service service = (Service) sendable;
        List<?> data = service.getData();
        for (Object o : data) {
          if (o instanceof Acceleration) {
            accelerations.add((Acceleration) o);
          } else if (o instanceof Position) {
            positions.add((Position) o);
          }
        }
      }
    }

    controller.disconnectFromClient(connection1);
    controller2.disconnectFromClient(connection2);

    assertTrue("Alarm was not sent from controller", alarms.size() >= 1);
    assertTrue("Acceleration not received from controller", accelerations.size() >= 1);
    assertTrue("Position 1 not contained in received positions", positions.contains(position1));
    assertTrue("Position 2 not contained in received positions", positions.contains(position2));
  }
Пример #19
0
  @Test(
      dataProvider = "addNewAgentApplicant",
      dataProviderClass = applicantDataInternationalNewApplicant.class)
  public void testEnterDataAddNewApplicant(
      String loginEmail,
      String loginPassword,
      String firstName,
      String lastName,
      String birthDay,
      String birthMonth,
      String birthYear)
      throws Exception {

    // Add new applicant to Agent
    Thread.sleep(300);
    // Test case from HERE to CITIZENSHIP will fail if the applicant already exists.
    driver.findElement(By.id("field-email")).clear();
    driver.findElement(By.id("field-email")).sendKeys(loginEmail);
    Thread.sleep(150);
    driver.findElement(By.id("field-confirmEmail")).clear();
    driver.findElement(By.id("field-confirmEmail")).sendKeys(loginEmail);

    Thread.sleep(100);
    driver.findElement(By.id("field-firstName")).clear();
    driver.findElement(By.id("field-firstName")).sendKeys(firstName);

    driver.findElement(By.id("field-lastName")).clear();
    driver.findElement(By.id("field-lastName")).sendKeys(lastName);

    new Select(driver.findElement(By.name("dayOfBirth"))).selectByVisibleText(birthDay);
    new Select(driver.findElement(By.name("monthOfBirth"))).selectByVisibleText(birthMonth);
    new Select(driver.findElement(By.name("yearOfBirth"))).selectByVisibleText(birthYear);

    driver.findElement(By.xpath("//button[@type='submit']")).click();

    System.out.println("Applicant = " + loginEmail);
    Thread.sleep(500);

    try {
      assertEquals(
          "Profile Information", driver.findElement(By.cssSelector("h3.col-xs-12")).getText());
    } catch (Error e) {
      screenShots.takeScreenShot("enterDataAddNewAppl");
      verificationErrors.append(e.toString());
    }
  }
 public void fiveSecondTimeoutAndInterruptible(int timeoutMs) {
   Thread.interrupted();
   try {
     Thread.sleep(timeoutMs);
   } catch (InterruptedException e) {
     interrupted.set(true);
   }
 }
  @Test
  public void testPersistenceTimer() throws Exception {
    System.out.println("TMPDIR == " + TMPDIR);
    log.info("---> get bean jpaSingleSessionCommandService2");
    KieSession service = (KieSession) ctx.getBean("jpaSingleSessionCommandService2");

    int sessionId = service.getId();
    log.info("---> created SingleSessionCommandService id: " + sessionId);

    ProcessInstance processInstance = service.startProcess("org.drools.test.ProcessTimer");
    long procId = processInstance.getId();
    log.info("---> Started ProcessTimer id: {}", procId);

    service.dispose();
    log.info("---> session disposed");

    final Environment env = (Environment) ctx.getBean("env");
    /*
    Environment env = KnowledgeBaseFactory.newEnvironment();
    env.set( EnvironmentName.ENTITY_MANAGER_FACTORY,
             ctx.getBean( "myEmf" ) );
    env.set( EnvironmentName.TRANSACTION_MANAGER,
             ctx.getBean( "txManager" ) );
    */
    KieStoreServices kstore = (KieStoreServices) ctx.getBean("kstore1");
    KieBase kbase1 = (KieBase) ctx.getBean("kb_persistence");
    service = kstore.loadKieSession(sessionId, kbase1, null, env);

    log.info("---> load session: " + sessionId);
    processInstance = service.getProcessInstance(procId);
    log.info("---> GetProcessInstanceCommand id: " + procId);
    assertNotNull(processInstance);

    Thread.sleep(1000);
    log.info("---> session disposed");
    service.dispose();

    service = kstore.loadKieSession(sessionId, kbase1, null, env);
    log.info("---> load session: " + sessionId);
    Thread.sleep(3000);

    log.info("---> GetProcessInstanceCommand id: " + procId);
    processInstance = service.getProcessInstance(procId);
    log.info("---> session disposed");
    assertNull(processInstance);
  }
  @Test
  public void testNatsSubjectFanIntoRedis() throws Exception {

    int count = 5;

    String config =
        "{"
            + "\"nats_to_redis_map\" : ["
            + "{"
            + "\"subject\" : \"Export.Redis1\","
            + "\"channel\" : \"Import_NATS\""
            + "},"
            + "{"
            + "\"subject\" : \"Export.Redis2\","
            + "\"channel\" : \"Import_NATS\""
            + "},"
            + "{"
            + "\"subject\" : \"Export.Redis3\","
            + "\"channel\" : \"Import_NATS\""
            + "}"
            + "]"
            + "}";

    System.setProperty(RedisPubSubPlugin.CONFIG_URL, generateContentFile(config));

    Connector c = new Connector();

    ExecutorService executor = Executors.newFixedThreadPool(10);

    NatsPublisher np1 = new NatsPublisher("np1", "Export.Redis1", count);
    NatsPublisher np2 = new NatsPublisher("np2", "Export.Redis2", count);
    NatsPublisher np3 = new NatsPublisher("np3", "Export.Redis3", count);

    RedisSubscriber rs1 = new RedisSubscriber("rs1", "Import_NATS", count * 3);

    // start the subsciber apps
    executor.execute(rs1);

    // wait for subscribers to be ready.
    rs1.waitUntilReady();

    // start the connector
    executor.execute(c);
    Thread.sleep(1000);
    ;

    // start the publishers
    executor.execute(np1);
    executor.execute(np2);
    executor.execute(np3);

    // wait for the subscribers to complete.
    rs1.waitForCompletion();

    Assert.assertTrue("Invalid count", rs1.getMessageCount() == (count * 3));

    c.shutdown();
  }
Пример #23
0
 protected void waitForDelete(String tableName) throws Exception {
   for (int i = 0; i < MAX_WAIT_ITERATION; i++) {
     if (!admin.tableExists(tableName)) {
       return;
     }
     Thread.sleep(WAIT_INTERVAL);
   }
   Assert.fail(getMethodName() + " failed");
 }
 // *** 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();
 }
Пример #25
0
 @Test
 public void testSimpleText() throws Exception {
   try {
     lcd.backlightOff();
     Thread.sleep(500);
     lcd.backlightOn();
     Thread.sleep(500);
     lcd.backlightPercent(30);
     Thread.sleep(500);
     lcd.backlightPercent(70);
     Thread.sleep(500);
     for (int i = 0; i < 32; i++) {
       lcd.clearDisplay();
       lcd.moveCursorTo(i);
       lcd.sendByte(("" + i).charAt(0));
       Thread.sleep(300);
     }
     lcd.clearDisplay();
     lcd.send2LineMessage("boo!", "yah!");
     Thread.sleep(500);
     lcd.clearDisplay();
     lcd.sendWrappedMessage("A wrapped message...Yeah that's it!");
   } catch (Exception e) {
     e.printStackTrace();
     throw e;
   }
 }
  @Before
  public void setUp() throws InterruptedException {
    pojo = new Pojo(serverInstance);
    PojoSlice slice = new PojoSlice(pojo);

    server = new SliceServer(slice, 100);
    server.start();

    Thread.sleep(1000);

    proxyProvider = new ProxyProviderImpl("default", clientInstance);
    proxyProvider.setLocalCallOptimizationEnabled(false);
  }
Пример #27
0
  private void assertNodeHandshakeEnded(Jedis node, int timeoutMs) {
    int sleepInterval = 100;
    for (int sleepTime = 0; sleepTime <= timeoutMs; sleepTime += sleepInterval) {
      boolean isHandshaking = isAnyNodeHandshaking(node);
      if (!isHandshaking) return;

      try {
        Thread.sleep(sleepInterval);
      } catch (InterruptedException e) {
      }
    }

    throw new JedisException("Node handshaking is not ended");
  }
 private void waitForConnectorSync(int timeoutInSeconds) throws InterruptedException {
   int t = 0;
   while (ConsistentHash.emptyRing().equals(connector1.getConsistentHash())
       || !connector1.getConsistentHash().equals(connector2.getConsistentHash())) {
     // don't have a member for String yet, which means we must wait a little longer
     if (t++ > timeoutInSeconds * 10) {
       fail(
           "Connectors did not manage to synchronize consistent hash ring within "
               + timeoutInSeconds
               + " seconds...");
     }
     Thread.sleep(100);
   }
 }
Пример #29
0
  /** Shutting down the cluster should act as the ExecutorService shutdown */
  @Test(expected = RejectedExecutionException.class)
  public void testClusterShutdown() throws Exception {
    ExecutorService executor = createSingleNodeExecutorService("testClusterShutdown");
    shutdownNodeFactory();
    Thread.sleep(2000);

    assertNotNull(executor);
    assertTrue(executor.isShutdown());
    assertTrue(executor.isTerminated());

    // New tasks must be rejected
    Callable<String> task = new BasicTestTask();
    executor.submit(task);
  }
  @Test
  public void whenTimeoutNotInterruptible() throws InterruptedException {
    TestService testService = proxyProvider.getProxy(TestService.class);

    try {
      testService.fiveSecondTimeoutNotInterruptible(10000);
      fail();
    } catch (DistributedMethodTimeoutException expected) {

    }
    Thread.sleep(10000);

    assertFalse(pojo.testService.interrupted.get());
  }