Search in sources :

Example 6 with Roles

use of org.ovirt.engine.api.model.Roles in project ovirt-engine by oVirt.

the class CompletenessAssertorTest method testCompleteListSubField.

@Test
public void testCompleteListSubField() throws Exception {
    User user = new User();
    user.setRoles(new Roles());
    user.getRoles().getRoles().add(new Role());
    user.getRoles().getRoles().get(0).setId("0");
    user.getRoles().getRoles().add(new Role());
    user.getRoles().getRoles().get(1).setId("0");
    CompletenessAssertor.validateParameters(user, "roles.id");
}
Also used : Role(org.ovirt.engine.api.model.Role) User(org.ovirt.engine.api.model.User) Roles(org.ovirt.engine.api.model.Roles) Test(org.junit.Test)

Example 7 with Roles

use of org.ovirt.engine.api.model.Roles in project ovirt-engine by oVirt.

the class CompletenessAssertorTest method testMissingListSubField.

@Test
public void testMissingListSubField() throws Exception {
    User user = new User();
    user.setRoles(new Roles());
    user.getRoles().getRoles().add(new Role());
    user.getRoles().getRoles().get(0).setId("0");
    user.getRoles().getRoles().add(new Role());
    user.getRoles().getRoles().get(1).setName("0");
    try {
        CompletenessAssertor.validateParameters(user, "roles.id");
        fail("expected WebApplicationException on incomplete model");
    } catch (WebApplicationException wae) {
        verifyIncompleteException(wae, "User", "roles.id");
    }
}
Also used : Role(org.ovirt.engine.api.model.Role) User(org.ovirt.engine.api.model.User) WebApplicationException(javax.ws.rs.WebApplicationException) Roles(org.ovirt.engine.api.model.Roles) Test(org.junit.Test)

Aggregations

Roles (org.ovirt.engine.api.model.Roles)7 User (org.ovirt.engine.api.model.User)5 Test (org.junit.Test)4 Role (org.ovirt.engine.api.model.Role)4 WebApplicationException (javax.ws.rs.WebApplicationException)2 Group (org.ovirt.engine.api.model.Group)1 Groups (org.ovirt.engine.api.model.Groups)1 V3Group (org.ovirt.engine.api.v3.types.V3Group)1 V3Roles (org.ovirt.engine.api.v3.types.V3Roles)1 V3User (org.ovirt.engine.api.v3.types.V3User)1