Package de.marcusschiesser.dbpendler.server.utils

Examples of de.marcusschiesser.dbpendler.server.utils.HTTPSession


    }
  }

  public List<ConnectionVO> getConnection(StationVO start, StationVO destination, Date date) {
    try {
      HTTPSession session = Login.getInstance().loginAnonymous();
      Collection<ConnectionVO> result = new ArrayList<ConnectionVO>();
      Date actTime = timeFormat.parse("00:00");
      final Date endTime = timeFormat.parse("23:59");
      do{
        List<ConnectionVO> connections = getConnectionTime(session, start, destination, date, actTime);
View Full Code Here


  // parse click_id (optionally) and mId from action attribute
  // curl -b mycookie -k -d
  // "login=marcus.schiesser&pin=8X5VF1&button.login_p=Login"
  // "https://fahrkarten.bahn.de/mobile/st/li.post?lang=de"
  public HTTPSession login(String login, String pin) throws IOException, SAXException {
    HTTPSession session = new HTTPSession();
    session.getMethod(startURL);
    final String params = "login=" + login + "&pin=" + pin + "&button.login_p=Login";
    String response = session.postMethod(loginURL, params);
    InputStream inputStream = HTTPUtils.stringToStream(response);
    LoginValidationHandler handler = new LoginValidationHandler();
    reader.setContentHandler(handler);
    reader.parse(new InputSource(inputStream));
    if(!handler.isValid()) {
View Full Code Here

    String response = HTTPUtils.getMethod(loginAnonymousURL);
    InputStream inputStream = HTTPUtils.stringToStream(response);

    reader.setContentHandler(handler);
    reader.parse(new InputSource(inputStream));
    return new HTTPSession(handler.ldValue, handler.iValue);
  }
View Full Code Here

//    }
    StationVO start = starts.get(0);
    StationVO destination = destinations.get(0);
    // do transaction
    try {
      HTTPSession session = Login.getInstance().login(login, pin);
      Date bookDate = DateUtils.getDateFormat().parse(date);
      Date bookTime = DateUtils.getTimeFormat().parse(time);
      CommitVO commitData = Booking.getInstance().doBooking(session, start, destination,
          bookDate, bookTime, bookingType, reservationType, paymentType,
          creditCardCheckNumber);
View Full Code Here

  private double doPreBooking(BookingType bookingType) throws SAXException, IOException, ParseException {
    PreCommitValidationHandler handler = null;
    for (ReservationType reservationType : ReservationType.values()) {
      for (PaymentType paymentType : PaymentType.values()) {
        HTTPSession session = Login.getInstance().login(LoginTest.TEST_USER_LOGIN, LoginTest.TEST_USER_PIN);
        Date date = DateUtils.getDateFormat().parse("25.07.2011");
        Date queryTime = DateUtils.getTimeFormat().parse("08:00");
        handler = Booking.getInstance().doPreBooking(session, new StationVO("Karlsruhe Hbf"), new StationVO("Frankfurt(Main)Hbf"),
            date, queryTime, bookingType, reservationType, paymentType);
        Assert.assertTrue("precommit price must not be undefined for payment:" + paymentType.name() + " and reservation: " + reservationType.name(), handler.getPrice()!=null);
View Full Code Here

    helper.tearDown();
  }

  @Test
  public void testLoginOk() throws IOException, SAXException {
    HTTPSession session = Login.getInstance().login(TEST_USER_LOGIN, TEST_USER_PIN);
    Assert.assertNotNull("Login with test user failed.", session);
  }
View Full Code Here

TOP

Related Classes of de.marcusschiesser.dbpendler.server.utils.HTTPSession

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.