use of org.ovirt.engine.core.common.businessentities.gluster.GlusterServer in project ovirt-engine by oVirt.
the class GlusterServerDaoTest method testGetById.
@Test
public void testGetById() {
GlusterServer entity = dao.getByServerId(FixturesTool.GLUSTER_BRICK_SERVER1);
assertNotNull(entity);
assertEquals(FixturesTool.GLUSTER_BRICK_SERVER1, entity.getId());
assertEquals(FixturesTool.GLUSTER_SERVER_UUID1, entity.getGlusterServerUuid());
}
use of org.ovirt.engine.core.common.businessentities.gluster.GlusterServer in project ovirt-engine by oVirt.
the class GlusterServerDaoTest method testSave.
@Test
public void testSave() {
GlusterServer newEntity = new GlusterServer();
newEntity.setId(FixturesTool.VDS_GLUSTER_SERVER2);
newEntity.setGlusterServerUuid(FixturesTool.GLUSTER_SERVER_UUID2);
newEntity.setPeerStatus(PeerStatus.CONNECTED);
dao.save(newEntity);
GlusterServer entity = dao.getByServerId(newEntity.getId());
assertEquals(newEntity, entity);
}
use of org.ovirt.engine.core.common.businessentities.gluster.GlusterServer in project ovirt-engine by oVirt.
the class GlusterServerDaoTest method testGetByGlusterServerUuid.
@Test
public void testGetByGlusterServerUuid() {
GlusterServer entity = dao.getByGlusterServerUuid(FixturesTool.GLUSTER_SERVER_UUID1);
assertNotNull(entity);
assertEquals(FixturesTool.GLUSTER_BRICK_SERVER1, entity.getId());
assertEquals(FixturesTool.GLUSTER_SERVER_UUID1, entity.getGlusterServerUuid());
}
use of org.ovirt.engine.core.common.businessentities.gluster.GlusterServer in project ovirt-engine by oVirt.
the class InitGlusterCommandHelper method saveGlusterHostUuid.
private void saveGlusterHostUuid(VDS vds, Guid addedServerUuid) {
GlusterServer glusterServer = glusterServerDao.getByServerId(vds.getId());
if (glusterServer == null) {
glusterServer = new GlusterServer();
glusterServer.setId(vds.getId());
glusterServer.setGlusterServerUuid(addedServerUuid);
glusterServer.setPeerStatus(PeerStatus.CONNECTED);
glusterServerDao.save(glusterServer);
} else if (!glusterServer.getGlusterServerUuid().equals(addedServerUuid)) {
// it's possible that the server is re-installed and gluster uuid has changed,
// update this in the database.
glusterServer.setGlusterServerUuid(addedServerUuid);
glusterServerDao.update(glusterServer);
}
}
Aggregations