Examples of Flights


Examples of acme.dataapp.Flights

        String code = ac.getCode(par[0], par[1]);
        res.put("code", code);

      } else if (path.contains("/api/flights/all")) {
        // Gets the details of all flights
        Flights fs = Flights.getInstance();
        res = fs.getFlights();

      } else if (path.contains("/api/flight/")) {
        // Gets the details of a flight
        Flights fs = Flights.getInstance();
        int idx = path.indexOf("/api/flight/")
            + "/api/flight/".length();
        String flightId = path.substring(idx);
        res = fs.getFlightsByID(flightId);

      } else if (path.contains("/api/logout")) {
        // Logs out the user
        HttpSession cur = request.getSession(false);
        if (cur != null) {
View Full Code Here

Examples of acme.dataapp.Flights

        fc.addFlight(flightId, state);
        res.put("result", "added");

      } else if (path.contains("/api/flights")) {
        // adds a flight status
        Flights fs = Flights.getInstance();
        JSONObject o = new JSONObject(request.getInputStream());
        String flight = (String) o.get("flight");
        String depart = (String) o.get("depart");
        String arrive = (String) o.get("arrive");
        String time = (String) o.get("time");
        String flightTime = (String) o.get("flighttime");
        fs.add(flight, depart, arrive, time, flightTime);
        res.put("result", "added");

      } else if (path.contains("/api/addmyflight")) {

      } else if (path.contains("/api/login")) {
View Full Code Here

Examples of acme.dataapp.Flights

    JSONObject res = new JSONObject();

    try {
      if (path.contains("/api/flights")) {
        // deletes a flight status
        Flights fs = Flights.getInstance();
        JSONObject o = new JSONObject(request.getInputStream());
        String flight = (String) o.get("flight");
        fs.removeFlight(flight);

      } else if (path.contains("/api/fc/")) {
        // deletes a new flight status
        JSONObject o = new JSONObject(request.getInputStream());
        String flightId = o.getString("flightId");
View Full Code Here

Examples of acme.dataapp.Flights

    JSONObject res = new JSONObject();

    try {
      if (path.contains("/api/flightstatus")) {
        // updates a flight status
        Flights fs = Flights.getInstance();
        JSONObject o = new JSONObject(request.getInputStream());
        String flight = (String) o.get("flight");
        String depart = (String) o.get("depart");
        String arrive = (String) o.get("arrive");
        String time = (String) o.get("time");
        String flightTime = (String) o.get("flighttime");
        fs.update(flight, depart, arrive, time, flightTime);

      }

      else if (path.contains("/api/fc/")) {
        // Creates a new flight status
View Full Code Here

Examples of com.sun.jersey.samples.jsonfromjaxb.jaxb.Flights

     * Test check GET on the "flights" resource in "application/json" format.
     */
    @Test
    public void testGetOnFlightsJSONFormat() {
        // get the initial representation
        Flights flights = r.path("flights").
                accept("application/json").get(Flights.class);
        // check that there are two flight entries
        assertEquals("Expected number of initial entries not found",
                2, flights.getFlight().size());
    }
View Full Code Here

Examples of com.sun.jersey.samples.jsonfromjaxb.jaxb.Flights

     * Test checks PUT on the "flights" resource in "application/json" format.
     */
    @Test
    public void testPutOnFlightsJSONFormat() {
        // get the initial representation
        Flights flights = r.path("flights").
                accept("application/json").get(Flights.class);
        // check that there are two flight entries
        assertEquals("Expected number of initial entries not found",
                2, flights.getFlight().size());

        // remove the second flight entry
        if (flights.getFlight().size() > 1) {
            flights.getFlight().remove(1);
        }

        // update the first entry
        flights.getFlight().get(0).setNumber(125);
        flights.getFlight().get(0).setFlightId("OK125");

        // and send the updated list back to the server
        r.path("flights").type("application/json").put(flights);

        // get the updated list out from the server:
        Flights updatedFlights = r.path("flights").
                accept("application/json").get(Flights.class);
        //check that there is only one flight entry
        assertEquals("Remaining number of flight entries do not match the expected value",
                1, updatedFlights.getFlight().size());
        // check that the flight entry in retrieved list has FlightID OK!@%
        assertEquals("Retrieved flight ID doesn't match the expected value",
                "OK125", updatedFlights.getFlight().get(0).getFlightId());
    }
View Full Code Here

Examples of com.sun.jersey.samples.jsonfromjaxb.jaxb.Flights

     * Test checks GET on "flights" resource with mime-type "application/xml".
     */
    @Test
    public void testGetOnFlightsXMLFormat() {
        // get the initial representation
        Flights flights = r.path("flights").
                accept("application/xml").get(Flights.class);
        // check that there are two flight entries
        assertEquals("Expected number of initial entries not found",
                2, flights.getFlight().size());
    }
View Full Code Here

Examples of com.sun.jersey.samples.jsonfromjaxb.jaxb.Flights

     * Test checks PUT on "flights" resource with mime-type "application/xml".
     */
    @Test
    public void testPutOnFlightsXMLFormat() {
        // get the initial representation
        Flights flights = r.path("flights").
                accept("application/XML").get(Flights.class);
        // check that there are two flight entries
        assertEquals("Expected number of initial entries not found",
                2, flights.getFlight().size());

        // remove the second flight entry
        if (flights.getFlight().size() > 1) {
            flights.getFlight().remove(1);
        }

        // update the first entry
        flights.getFlight().get(0).setNumber(125);
        flights.getFlight().get(0).setFlightId("OK125");

        // and send the updated list back to the server
        r.path("flights").type("application/XML").put(flights);

        // get the updated list out from the server:
        Flights updatedFlights = r.path("flights").
                accept("application/XML").get(Flights.class);
        //check that there is only one flight entry
        assertEquals("Remaining number of flight entries do not match the expected value",
                1, updatedFlights.getFlight().size());
        // check that the flight entry in retrieved list has FlightID OK!@%
        assertEquals("Retrieved flight ID doesn't match the expected value",
                "OK125", updatedFlights.getFlight().get(0).getFlightId());
    }
View Full Code Here

Examples of com.sun.jersey.samples.jsonfromjaxb.jaxb.Flights

     * <p>
     * The flight lists will be constructed just once
     * when the first request to the flight list resource occurs.
     */
    public FlightList() {
        myFlights = new Flights();
        FlightType flight123 = new FlightType();
        flight123.setCompany("Czech Airlines");
        flight123.setNumber(123);
        flight123.setFlightId("OK123");
        flight123.setAircraft("B737");
View Full Code Here

Examples of com.sun.jersey.samples.jsonfromjaxb.jaxb.Flights

     * <p>
     * The flight lists will be constructed just once
     * when the first request to the flight list resource occurs.
     */
    public FlightList() {
        myFlights = new Flights();
        FlightType flight123 = new FlightType();
        flight123.setCompany("Czech Airlines");
        flight123.setNumber(123);
        flight123.setFlightId("OK123");
        flight123.setAircraft("B737");
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.