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;
}
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());
}