Package br.com.caelum.restfulie

Examples of br.com.caelum.restfulie.Resources


    happyPathTest(uri);
    }

    private static void happyPathTest(URI uri) throws Exception {

      Resources resources = new MappingConfig().getServer();

        // Place the order
        System.out.println(String.format("About to start happy path test. Placing order at [%s] via POST", uri.toString()));
        Order order = createOrder();
        order = resources.entryAt(uri).post(order);
       
        System.out.println(String.format("Order placed at [%s]", order.getSelfUri()));
       
        // Pay for the order
        Payment payment = new Payment("12345677878", "guilherme silveira", 12, 2999, order.getCost());
View Full Code Here


  "  <atom:link href=\"http://localhost:3000/orders/360\" xmlns:atom=\"http://www.w3.org/2005/Atom\" rel=\"cancel\"/>"+
  "  <atom:link href=\"http://localhost:3000/orders/360/payment\" xmlns:atom=\"http://www.w3.org/2005/Atom\" rel=\"pay\"/>"+
  "  <atom:link href=\"http://localhost:3000/orders/360\" xmlns:atom=\"http://www.w3.org/2005/Atom\" rel=\"update\"/>"+
  "</order>";
   
      Resources resources = new MappingConfig().getServer();
      Order order = (Order) resources.getDeserializer().fromXml(content);
      assertTrue(order!=null); // dumb test for config
  }
View Full Code Here

  "<location>takeAway</location>"+
  "<items></items>"+
  "<status>unpaid</status>"+
  "</order>";
   
      Resources resources = new MappingConfig().getServer();
      Order order = new Order("unpaid", new ArrayList<Item>(), Location.takeAway);
      StringWriter w  = new StringWriter();
      resources.getSerializerFor(w, order).serialize();
      assertEquals(expected, w.getBuffer().toString());
  }
View Full Code Here

TOP

Related Classes of br.com.caelum.restfulie.Resources

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.