Package com.google.greaze.end2end.definition

Examples of com.google.greaze.end2end.definition.Employee


        stub, RESOURCE_PATH, Employee.class, new GsonBuilder(), false);
  }

  public void testGet() throws Exception {
    Id<Employee> id = Id.get("1");
    employees.put(new Employee(id, "bob"));
    Employee e = client.get(id, new WebContext());
    assertEquals("bob", e.getName());
  }
View Full Code Here


      assertEquals(ErrorReason.BAD_REQUEST, expected.getReason());
    }
  }

  public void testPost() throws Exception {
    Employee e = client.post(new Employee("bob"), new WebContext());
    assertEquals("bob", e.getName());
    assertTrue(Id.isValid(e.getId()));
  }
View Full Code Here

    assertEquals("bob", e.getName());
    assertTrue(Id.isValid(e.getId()));
  }

  public void testPut() throws Exception {
    Employee bob = client.post(new Employee("bob"), new WebContext());
    assertEquals("bob", bob.getName());
    Employee sam = client.put(new Employee(bob.getId(), "sam"), new WebContext());
    assertEquals("sam", sam.getName());
    assertEquals(bob.getId(), sam.getId());
  }
View Full Code Here

    assertEquals("sam", sam.getName());
    assertEquals(bob.getId(), sam.getId());
  }

  public void testDelete() throws Exception {
    Employee bob = client.post(new Employee("bob"), new WebContext());
    assertEquals("bob", bob.getName());
    client.delete(bob.getId(), new WebContext());
    assertNull(client.get(bob.getId(), new WebContext()));
  }
View Full Code Here

  @Override
  public List<Employee> query(QueryEmployeeByName query, WebContext context) {
    List<Employee> results = Lists.newArrayList();
    for (int i = 0; i < employees.size(); ++i) {
      Id<Employee> id = Id.get(String.valueOf(i));
      Employee employee = employees.get(id);
      if (employee != null && employee.getName().equals(query.getName())) {
        results.add(employee);
      }
    }
    return results;
  }
View Full Code Here

  }

  public void timeGet(int reps) throws Exception {
    for (int i=0; i<reps; ++i) {
      Id<Employee> id = Id.get(String.valueOf(i), Employee.class);
      employees.put(new Employee(id, "bob"));
      Employee e = client.get(id, context);
      Preconditions.checkArgument("bob".equals(e.getName()));
    }
  }
View Full Code Here

    }
  }

  public void timePost(int reps) throws Exception {
    for (int i=0; i<reps; ++i) {
      Employee e = client.post(new Employee("bob"), context);
      Preconditions.checkArgument("bob".equals(e.getName()));
      Preconditions.checkArgument(Id.isValid(e.getId()));
    }
  }
View Full Code Here

    }
  }

  public void timePut(int reps) throws Exception {
    for (int i=0; i<reps; ++i) {
      Employee bob = client.post(new Employee("bob"), context);
      Preconditions.checkArgument("bob".equals(bob.getName()));
      Employee sam = client.put(new Employee(bob.getId(), "sam"), context);
      Preconditions.checkArgument("sam".equals(sam.getName()));
      Preconditions.checkArgument(bob.getId().equals(sam.getId()));
    }
  }
View Full Code Here

    }
  }

  public void timeDelete(int reps) throws Exception {
    for (int i=0; i<reps; ++i) {
      Employee bob = client.post(new Employee("bob"), context);
      Preconditions.checkArgument("bob".equals(bob.getName()));
      client.delete(bob.getId(), context);
      Preconditions.checkArgument(client.get(bob.getId(), context) == null);
    }
  }
View Full Code Here

      .build();
  }

  public void testGet() throws Exception {
    Id<Employee> id = Id.get("1");
    employees.put(new Employee(id, "bob"));
    Employee e = client.get(id, context);
    assertEquals("bob", e.getName());
  }
View Full Code Here

TOP

Related Classes of com.google.greaze.end2end.definition.Employee

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.