Search in sources :

Example 1 with Ssh

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

the class HostMapper method map.

@Mapping(from = VdsStatic.class, to = Ssh.class)
public static Ssh map(VdsStatic entity, Ssh template) {
    Ssh model = template != null ? template : new Ssh();
    model.setPort(entity.getSshPort());
    model.setUser(new User());
    model.getUser().setUserName(entity.getSshUsername());
    model.setFingerprint(entity.getSshKeyFingerprint());
    return model;
}
Also used : User(org.ovirt.engine.api.model.User) Ssh(org.ovirt.engine.api.model.Ssh)

Example 2 with Ssh

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

the class HostMapperTest method testUpdateSshHost.

@Test
public void testUpdateSshHost() {
    Ssh sshConf = new Ssh();
    sshConf.setPort(22);
    sshConf.setUser(new User());
    sshConf.getUser().setUserName("root");
    sshConf.setFingerprint("1234");
    VdsStatic vdsStatic = new VdsStatic();
    vdsStatic.setSshUsername("root");
    vdsStatic.setSshPort(22);
    vdsStatic.setSshKeyFingerprint("1234");
    VdsStatic mappedVdsStatic = HostMapper.map(sshConf, vdsStatic);
    assertEquals(22, mappedVdsStatic.getSshPort());
    assertEquals("1234", mappedVdsStatic.getSshKeyFingerprint());
    assertEquals("root", mappedVdsStatic.getSshUsername());
}
Also used : VdsStatic(org.ovirt.engine.core.common.businessentities.VdsStatic) User(org.ovirt.engine.api.model.User) Ssh(org.ovirt.engine.api.model.Ssh) Test(org.junit.Test)

Aggregations

Ssh (org.ovirt.engine.api.model.Ssh)2 User (org.ovirt.engine.api.model.User)2 Test (org.junit.Test)1 VdsStatic (org.ovirt.engine.core.common.businessentities.VdsStatic)1