Skip to content
Browse files

removed the webdriver stuff and cleaned the dependencies

  • Loading branch information...
1 parent 5632d33 commit ded32aa88e357d02bb3c0a34fb092367496057d2 @jettro jettro committed Mar 2, 2012
Showing with 15 additions and 125 deletions.
  1. +15 −15 web-ui/pom.xml
  2. +0 −110 web-ui/src/test/java/org/axonframework/samples/trader/test/BasicWebDriverTest.java
View
30 web-ui/pom.xml
@@ -127,18 +127,6 @@
<artifactId>xstream</artifactId>
<version>1.3.1</version>
</dependency>
- <dependency>
- <groupId>org.codehaus.groovy</groupId>
- <artifactId>groovy-all</artifactId>
- <version>1.8.6</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.codehaus.groovy.modules.http-builder</groupId>
- <artifactId>http-builder</artifactId>
- <version>0.5.2</version>
- <scope>test</scope>
- </dependency>
<!-- web -->
<dependency>
@@ -176,10 +164,22 @@
<!-- test dependencies -->
<dependency>
- <groupId>org.seleniumhq.webdriver</groupId>
- <artifactId>webdriver-htmlunit</artifactId>
- <version>0.9.7376</version>
+ <groupId>org.codehaus.groovy</groupId>
+ <artifactId>groovy-all</artifactId>
+ <version>1.8.6</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.codehaus.groovy.modules.http-builder</groupId>
+ <artifactId>http-builder</artifactId>
+ <version>0.5.2</version>
<scope>test</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>org.codehaus.groovy</groupId>
+ <artifactId>groovy</artifactId>
+ </exclusion>
+ </exclusions>
</dependency>
</dependencies>
View
110 web-ui/src/test/java/org/axonframework/samples/trader/test/BasicWebDriverTest.java
@@ -1,110 +0,0 @@
-/*
- * Copyright (c) 2010-2012. Axon Framework
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.axonframework.samples.trader.test;
-
-import org.openqa.selenium.By;
-import org.openqa.selenium.WebDriver;
-import org.openqa.selenium.WebElement;
-import org.openqa.selenium.htmlunit.HtmlUnitDriver;
-
-import java.util.Date;
-import java.util.List;
-import java.util.Random;
-
-/**
- * @author Jettro Coenradie
- */
-public class BasicWebDriverTest {
-
- private static final String SERVER = "http://axon-trader.cloudfoundry.com/";
-
- public static void main(String[] args) {
-
- WebDriver driver = new HtmlUnitDriver();
-
- LoginPage login = new LoginPage(driver);
- CompaniesPage companies = new CompaniesPage(driver);
- login.login("buyer1", "buyer1");
-
- Random randomFactory = new Random();
- String[] orderActions = {"Buy »", "Sell »"};
-
- long start = new Date().getTime();
- for (int i = 0; i < 1000; i++) {
- placeOrder(driver, companies, randomFactory, orderActions);
- }
-
- long end = new Date().getTime();
- System.out.println("Total milli seconds : " + (end - start));
- }
-
- private static void placeOrder(WebDriver driver, CompaniesPage companies, Random randomFactory,
- String[] orderActions) {
- long start = new Date().getTime();
- int randomCompany = randomFactory.nextInt(3);
- String randomOrderAction = orderActions[randomFactory.nextInt(2)];
- int randomPrice = randomFactory.nextInt(500) + 1;
- int randomAmount = randomFactory.nextInt(50) + 1;
-
-
- companies.selectCompany(randomCompany);
-
- // company details
- driver.findElement(By.linkText(randomOrderAction)).click();
-
- // buy screen
- driver.findElement(By.id("itemPrice")).sendKeys(String.valueOf(randomPrice));
- driver.findElement(By.id("tradeCount")).sendKeys(String.valueOf(randomAmount));
- driver.findElement(By.name("submit")).submit();
- long duration = new Date().getTime() - start;
- System.out.println("order : (" + duration + ") "
- + randomOrderAction + " " + randomCompany + " " + randomAmount + " " + randomPrice);
- }
-
-
- private static class CompaniesPage {
-
- private WebDriver driver;
-
- private CompaniesPage(WebDriver driver) {
- this.driver = driver;
- }
-
- public void selectCompany(int itemToSelect) {
- driver.get(SERVER + "company/");
- List<WebElement> elements = driver.findElements(By.xpath("//table[@id='available-stock']/tbody/tr"));
- WebElement webElement = elements.get(itemToSelect);
- webElement.findElement(By.tagName("a")).click();
- }
- }
-
- private static class LoginPage {
-
- private WebDriver driver;
-
- public LoginPage(WebDriver driver) {
- this.driver = driver;
- }
-
- public void login(String username, String password) {
- driver.get(SERVER + "login.jsp");
- driver.findElement(By.name("j_username")).sendKeys("buyer1");
- driver.findElement(By.name("j_password")).sendKeys("buyer1");
- driver.findElement(By.name("submit")).submit();
- }
- }
-}

0 comments on commit ded32aa

Please sign in to comment.
Something went wrong with that request. Please try again.