Example #1
0
  public void testGetRelationshipsForSubSubEntity() throws Throwable {
    Entity<Contractor> contractorEntity = model.getEntity(Contractor.class);

    checkRelationships(
        contractorEntity.getRelationships(),
        Arrays.asList(
            new RelationInfo("address", "Address", null, Relationship.Type.TO_ONE),
            new RelationInfo("company", "Company", "employees", Relationship.Type.TO_ONE),
            new RelationInfo("directReports", "Employee", "manager", Relationship.Type.TO_MANY),
            new RelationInfo("manager", "Employee", "directReports", Relationship.Type.TO_ONE),
            new RelationInfo("passport", "Passport", "employee", Relationship.Type.TO_ONE)));
  }
Example #2
0
  public void testGetAttributesForBaseEntity() throws Throwable {
    Entity<Person> personEntity = model.getEntity(Person.class);

    checkAttributes(
        personEntity.getAttributes(),
        Arrays.asList(
            new AttrInfo("id", Integer.class),
            new AttrInfo("firstName", String.class),
            new AttrInfo("lastName", String.class),
            new AttrInfo("heightInCm", Float.class),
            new AttrInfo("dateOfBirth", Date.class)));
  }
Example #3
0
  public void testGetAttributesForSubEntity() throws Throwable {
    Entity<Employee> employeeEntity = model.getEntity(Employee.class);

    checkAttributes(
        employeeEntity.getAttributes(),
        Arrays.asList(
            new AttrInfo("id", Integer.class),
            new AttrInfo("firstName", String.class),
            new AttrInfo("lastName", String.class),
            new AttrInfo("heightInCm", Float.class),
            new AttrInfo("hourlyWage", Double.class),
            new AttrInfo("dateOfBirth", Date.class),
            new AttrInfo("active", Boolean.class)));
  }