Search in sources :

Example 1 with Roles

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

the class CompletenessAssertorTest method testMissingListSubFieldAlternatives.

@Test
public void testMissingListSubFieldAlternatives() 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).setDescription("0");
    try {
        CompletenessAssertor.validateParameters(user, "roles.id|name");
        fail("expected WebApplicationException on incomplete model");
    } catch (WebApplicationException wae) {
        verifyIncompleteException(wae, "User", "roles.id|name");
    }
}
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)

Example 2 with Roles

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

the class V3GroupInAdapter method adapt.

@Override
public Group adapt(V3Group from) {
    Group to = new Group();
    if (from.isSetLinks()) {
        to.getLinks().addAll(adaptIn(from.getLinks()));
    }
    if (from.isSetActions()) {
        to.setActions(adaptIn(from.getActions()));
    }
    if (from.isSetComment()) {
        to.setComment(from.getComment());
    }
    if (from.isSetDescription()) {
        to.setDescription(from.getDescription());
    }
    if (from.isSetDomain()) {
        to.setDomain(adaptIn(from.getDomain()));
    }
    if (from.isSetDomainEntryId()) {
        to.setDomainEntryId(from.getDomainEntryId());
    }
    if (from.isSetId()) {
        to.setId(from.getId());
    }
    if (from.isSetHref()) {
        to.setHref(from.getHref());
    }
    if (from.isSetName()) {
        to.setName(from.getName());
    }
    if (from.isSetNamespace()) {
        to.setNamespace(from.getNamespace());
    }
    if (from.isSetRoles()) {
        to.setRoles(new Roles());
        to.getRoles().getRoles().addAll(adaptIn(from.getRoles().getRoles()));
    }
    return to;
}
Also used : Group(org.ovirt.engine.api.model.Group) V3Group(org.ovirt.engine.api.v3.types.V3Group) Roles(org.ovirt.engine.api.model.Roles)

Example 3 with Roles

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

the class V3UserInAdapter method adapt.

@Override
public User adapt(V3User from) {
    User to = new User();
    if (from.isSetLinks()) {
        to.getLinks().addAll(adaptIn(from.getLinks()));
    }
    if (from.isSetActions()) {
        to.setActions(adaptIn(from.getActions()));
    }
    if (from.isSetComment()) {
        to.setComment(from.getComment());
    }
    if (from.isSetDepartment()) {
        to.setDepartment(from.getDepartment());
    }
    if (from.isSetDescription()) {
        to.setDescription(from.getDescription());
    }
    if (from.isSetDomain()) {
        to.setDomain(adaptIn(from.getDomain()));
    }
    if (from.isSetDomainEntryId()) {
        to.setDomainEntryId(from.getDomainEntryId());
    }
    if (from.isSetEmail()) {
        to.setEmail(from.getEmail());
    }
    if (from.isSetGroups()) {
        to.setGroups(new Groups());
        to.getGroups().getGroups().addAll(adaptIn(from.getGroups().getGroups()));
    }
    if (from.isSetId()) {
        to.setId(from.getId());
    }
    if (from.isSetHref()) {
        to.setHref(from.getHref());
    }
    if (from.isSetLastName()) {
        to.setLastName(from.getLastName());
    }
    if (from.isSetLoggedIn()) {
        to.setLoggedIn(from.isLoggedIn());
    }
    if (from.isSetName()) {
        to.setName(from.getName());
    }
    if (from.isSetNamespace()) {
        to.setNamespace(from.getNamespace());
    }
    if (from.isSetPassword()) {
        to.setPassword(from.getPassword());
    }
    if (from.isSetPrincipal()) {
        to.setPrincipal(from.getPrincipal());
    }
    if (from.isSetRoles()) {
        to.setRoles(new Roles());
        to.getRoles().getRoles().addAll(adaptIn(from.getRoles().getRoles()));
    }
    if (from.isSetUserName()) {
        to.setUserName(from.getUserName());
    }
    return to;
}
Also used : V3User(org.ovirt.engine.api.v3.types.V3User) User(org.ovirt.engine.api.model.User) Groups(org.ovirt.engine.api.model.Groups) Roles(org.ovirt.engine.api.model.Roles)

Example 4 with Roles

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

the class V3RolesInAdapter method adapt.

@Override
public Roles adapt(V3Roles from) {
    Roles to = new Roles();
    if (from.isSetActions()) {
        to.setActions(adaptIn(from.getActions()));
    }
    if (from.isSetActive()) {
        to.setActive(from.getActive());
    }
    if (from.isSetSize()) {
        to.setSize(from.getSize());
    }
    if (from.isSetTotal()) {
        to.setTotal(from.getTotal());
    }
    to.getRoles().addAll(adaptIn(from.getRoles()));
    return to;
}
Also used : Roles(org.ovirt.engine.api.model.Roles) V3Roles(org.ovirt.engine.api.v3.types.V3Roles)

Example 5 with Roles

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

the class CompletenessAssertorTest method testCompleteListSubFieldAlternatives.

@Test
public void testCompleteListSubFieldAlternatives() 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");
    CompletenessAssertor.validateParameters(user, "roles.id|name");
}
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)

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