use of org.ovirt.engine.api.model.Methods in project ovirt-engine by oVirt.
the class SsoMapper method map.
@Mapping(from = SsoMethod.class, to = Sso.class)
public static Sso map(SsoMethod entity, Sso template) {
Sso model = (template == null) ? new Sso() : template;
model.setMethods(new Methods());
if (entity == SsoMethod.GUEST_AGENT) {
Method method = new Method();
method.setId(org.ovirt.engine.api.model.SsoMethod.GUEST_AGENT);
model.getMethods().getMethods().add(method);
}
return model;
}
use of org.ovirt.engine.api.model.Methods in project ovirt-engine by oVirt.
the class SsoMapperTest method mapNoMethodSsoFromRestToBackend.
@Test
public void mapNoMethodSsoFromRestToBackend() throws Exception {
Sso restSso = new Sso();
restSso.setMethods(new Methods());
SsoMethod expectedBackendSsoMethod = SsoMethod.NONE;
assertEquals(expectedBackendSsoMethod, SsoMapper.map(restSso, null));
}
use of org.ovirt.engine.api.model.Methods in project ovirt-engine by oVirt.
the class SsoMapperTest method mapGuestAgentSsoFromRestToBackend.
@Test
public void mapGuestAgentSsoFromRestToBackend() throws Exception {
Sso restSso = new Sso();
restSso.setMethods(new Methods());
Method guestAgent = new Method();
guestAgent.setId(org.ovirt.engine.api.model.SsoMethod.GUEST_AGENT);
restSso.getMethods().getMethods().add(guestAgent);
SsoMethod expectedBackendSsoMethod = SsoMethod.GUEST_AGENT;
assertEquals(expectedBackendSsoMethod, SsoMapper.map(restSso, null));
}
use of org.ovirt.engine.api.model.Methods in project ovirt-engine by oVirt.
the class V3SsoInAdapter method adapt.
@Override
public Sso adapt(V3Sso from) {
Sso to = new Sso();
if (from.isSetMethods()) {
to.setMethods(new Methods());
to.getMethods().getMethods().addAll(adaptIn(from.getMethods().getMethods()));
}
return to;
}