Search in sources :

Example 1 with SsoMethod

use of org.ovirt.engine.core.common.businessentities.SsoMethod 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;
}
Also used : SsoMethod(org.ovirt.engine.core.common.businessentities.SsoMethod) Method(org.ovirt.engine.api.model.Method) Sso(org.ovirt.engine.api.model.Sso) Methods(org.ovirt.engine.api.model.Methods)

Example 2 with SsoMethod

use of org.ovirt.engine.core.common.businessentities.SsoMethod in project ovirt-engine by oVirt.

the class SsoMapperTest method mapGuestAgentSsoFromBackendToRest.

@Test
public void mapGuestAgentSsoFromBackendToRest() throws Exception {
    SsoMethod backendSsoMethod = SsoMethod.GUEST_AGENT;
    Sso restSso = SsoMapper.map(backendSsoMethod, null);
    assertNotNull(restSso);
    assertNotNull(restSso.getMethods());
    assertNotNull(restSso.getMethods().getMethods());
    assertEquals(1, restSso.getMethods().getMethods().size());
    assertEquals(org.ovirt.engine.api.model.SsoMethod.GUEST_AGENT, restSso.getMethods().getMethods().get(0).getId());
}
Also used : SsoMethod(org.ovirt.engine.core.common.businessentities.SsoMethod) Sso(org.ovirt.engine.api.model.Sso) Test(org.junit.Test)

Example 3 with SsoMethod

use of org.ovirt.engine.core.common.businessentities.SsoMethod 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));
}
Also used : SsoMethod(org.ovirt.engine.core.common.businessentities.SsoMethod) Sso(org.ovirt.engine.api.model.Sso) Methods(org.ovirt.engine.api.model.Methods) Test(org.junit.Test)

Example 4 with SsoMethod

use of org.ovirt.engine.core.common.businessentities.SsoMethod 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));
}
Also used : SsoMethod(org.ovirt.engine.core.common.businessentities.SsoMethod) SsoMethod(org.ovirt.engine.core.common.businessentities.SsoMethod) Method(org.ovirt.engine.api.model.Method) Sso(org.ovirt.engine.api.model.Sso) Methods(org.ovirt.engine.api.model.Methods) Test(org.junit.Test)

Example 5 with SsoMethod

use of org.ovirt.engine.core.common.businessentities.SsoMethod in project ovirt-engine by oVirt.

the class SsoMapperTest method mapNoneSsoFromBackendToRest.

@Test
public void mapNoneSsoFromBackendToRest() throws Exception {
    SsoMethod backendSsoMethod = SsoMethod.NONE;
    Sso restSso = SsoMapper.map(backendSsoMethod, null);
    assertNotNull(restSso);
    assertNotNull(restSso.getMethods());
    assertNotNull(restSso.getMethods().getMethods());
    assertTrue(restSso.getMethods().getMethods().isEmpty());
}
Also used : SsoMethod(org.ovirt.engine.core.common.businessentities.SsoMethod) Sso(org.ovirt.engine.api.model.Sso) Test(org.junit.Test)

Aggregations

Sso (org.ovirt.engine.api.model.Sso)5 SsoMethod (org.ovirt.engine.core.common.businessentities.SsoMethod)5 Test (org.junit.Test)4 Methods (org.ovirt.engine.api.model.Methods)3 Method (org.ovirt.engine.api.model.Method)2