/** * Create an instance of {@link Porsche } * */ public Porsche createPorsche() { return new Porsche(); }
/** * Create an instance of {@link GetSedans } * */ public GetSedans createGetSedans() { return new GetSedans(); }
/** * Create an instance of {@link GetSedansResponse } * */ public GetSedansResponse createGetSedansResponse() { return new GetSedansResponse(); }
List<Car> cars = dealer.getSedans("porsche"); assertEquals(2, cars.size()); Porsche car = (Porsche) cars.get(0); assertNotNull(car); if (car != null && "Porsche".equals(car.getMake()) && "Boxster".equals(car.getModel()) && "1998".equals(car.getYear()) && "white".equals(car.getColor())) { Porsche oldCar = new Porsche(); oldCar.setMake("Porsche"); oldCar.setColor("white"); oldCar.setModel("GT2000"); oldCar.setYear("2000"); Porsche newCar = (Porsche)dealer.tradeIn(oldCar); assertNotNull(newCar); if (newCar != null && "Porsche".equals(newCar.getMake()) && "911GT3".equals(newCar.getModel()) && "2007".equals(newCar.getYear()) && "black".equals(newCar.getColor())) {
@SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE) public Car tradeIn(Car oldCar) { if (!(oldCar instanceof Porsche)) { throw new WebServiceException("Expected Porsche, received, " + oldCar.getClass().getName()); } Porsche porsche = (Porsche)oldCar; if ("Porsche".equals(porsche.getMake()) && "GT2000".equals(porsche.getModel()) && "2000".equals(porsche.getYear()) && "white".equals(porsche.getColor())) { return newPorsche("911GT3", "2007", "black"); } throw new WebServiceException("Invalid Porsche Car"); }
private CarDealer getCardealer() throws NumberFormatException, MalformedURLException { URL wsdl = getClass().getResource("/wsdl/cardealer.wsdl"); assertNotNull("WSDL is null", wsdl); CarDealerService service = new CarDealerService(wsdl, serviceName); assertNotNull("Service is null ", service); CarDealer dealer = service.getCarDealerPort(); updateAddressPort(dealer, PORT); return dealer; } }