use of org.ovirt.engine.core.common.businessentities.gluster.GlusterBrickEntity in project ovirt-engine by oVirt.
the class GlusterBrickDaoTest method testReplaceBrick.
@Test
public void testReplaceBrick() {
GlusterBrickEntity firstBrick = dao.getById(FixturesTool.GLUSTER_BRICK_UUID1);
assertNotNull(firstBrick);
GlusterBrickEntity newBrick = new GlusterBrickEntity();
newBrick.setVolumeId(FixturesTool.GLUSTER_VOLUME_UUID1);
newBrick.setServerId(FixturesTool.GLUSTER_SERVER_UUID3);
newBrick.setServerName(FixturesTool.GLUSTER_SERVER_NAME3);
newBrick.setBrickDirectory(BRICK_EXPORT_DIR);
GlusterAsyncTask asyncTask = new GlusterAsyncTask();
asyncTask.setTaskId(FixturesTool.GLUSTER_ASYNC_TASK_ID1);
newBrick.setAsyncTask(asyncTask);
newBrick.setStatus(GlusterStatus.UP);
newBrick.setBrickOrder(0);
assertNull(dao.getById(newBrick.getId()));
dao.replaceBrick(firstBrick, newBrick);
assertNull(dao.getById(FixturesTool.GLUSTER_BRICK_UUID1));
GlusterBrickEntity retrievedBrick = dao.getById(newBrick.getId());
assertNotNull(retrievedBrick);
assertEquals(newBrick, retrievedBrick);
}
use of org.ovirt.engine.core.common.businessentities.gluster.GlusterBrickEntity in project ovirt-engine by oVirt.
the class GlusterBrickDaoTest method testUpdateBrickStatuses.
@Test
public void testUpdateBrickStatuses() {
GlusterBrickEntity existingBrick = dao.getById(FixturesTool.GLUSTER_BRICK_UUID1);
GlusterBrickEntity existingBrick1 = dao.getById(FixturesTool.GLUSTER_BRICK_UUID2);
assertNotNull(existingBrick);
assertNotNull(existingBrick1);
assertEquals(GlusterStatus.UP, existingBrick.getStatus());
assertEquals(GlusterStatus.UP, existingBrick1.getStatus());
List<GlusterBrickEntity> bricks = new ArrayList<>();
bricks.add(existingBrick);
bricks.add(existingBrick1);
dao.updateBrickStatuses(bricks);
}
use of org.ovirt.engine.core.common.businessentities.gluster.GlusterBrickEntity in project ovirt-engine by oVirt.
the class GlusterBrickDaoTest method testRemoveBricksInBatch.
@Test
public void testRemoveBricksInBatch() {
GlusterBrickEntity existingBrick1 = dao.getById(FixturesTool.GLUSTER_BRICK_UUID1);
GlusterBrickEntity existingBrick2 = dao.getById(FixturesTool.GLUSTER_BRICK_UUID2);
List<GlusterBrickEntity> bricks = new ArrayList<>();
bricks.add(existingBrick1);
bricks.add(existingBrick2);
dao.removeAllInBatch(bricks);
GlusterBrickEntity newEnity1 = dao.getById(FixturesTool.GLUSTER_BRICK_UUID1);
GlusterBrickEntity newEnity2 = dao.getById(FixturesTool.GLUSTER_BRICK_UUID2);
assertNull(newEnity1);
assertNull(newEnity2);
}
use of org.ovirt.engine.core.common.businessentities.gluster.GlusterBrickEntity in project ovirt-engine by oVirt.
the class GlusterBrickDaoTest method testUpdateAllBrickTasksByHostIdBrickDir.
@Test
public void testUpdateAllBrickTasksByHostIdBrickDir() {
GlusterBrickEntity existingBrick = dao.getById(FixturesTool.GLUSTER_BRICK_UUID1);
GlusterBrickEntity existingBrick2 = dao.getById(FixturesTool.GLUSTER_BRICK_UUID2);
GlusterAsyncTask asyncTask = new GlusterAsyncTask();
asyncTask.setTaskId(FixturesTool.GLUSTER_ASYNC_TASK_ID1);
GlusterBrickEntity updateBrick = new GlusterBrickEntity();
updateBrick.setBrickDirectory(existingBrick.getBrickDirectory());
updateBrick.setServerId(existingBrick.getServerId());
updateBrick.setAsyncTask(asyncTask);
GlusterBrickEntity updateBrick2 = new GlusterBrickEntity();
updateBrick2.setBrickDirectory(existingBrick2.getBrickDirectory());
updateBrick2.setServerId(existingBrick2.getServerId());
updateBrick2.setAsyncTask(asyncTask);
List<GlusterBrickEntity> bricks = new ArrayList<>();
bricks.add(updateBrick);
bricks.add(updateBrick2);
dao.updateAllBrickTasksByHostIdBrickDirInBatch(bricks);
GlusterBrickEntity newEntity1 = dao.getById(FixturesTool.GLUSTER_BRICK_UUID1);
GlusterBrickEntity newEntity2 = dao.getById(FixturesTool.GLUSTER_BRICK_UUID1);
assertEquals(FixturesTool.GLUSTER_ASYNC_TASK_ID1, newEntity1.getAsyncTask().getTaskId());
assertEquals(FixturesTool.GLUSTER_ASYNC_TASK_ID1, newEntity2.getAsyncTask().getTaskId());
}
use of org.ovirt.engine.core.common.businessentities.gluster.GlusterBrickEntity in project ovirt-engine by oVirt.
the class GlusterBrickDaoTest method testUpdateBrickTasksInBatch.
@Test
public void testUpdateBrickTasksInBatch() {
GlusterBrickEntity existingBrick1 = dao.getById(FixturesTool.GLUSTER_BRICK_UUID1);
GlusterBrickEntity existingBrick2 = dao.getById(FixturesTool.GLUSTER_BRICK_UUID2);
GlusterAsyncTask asyncTask = new GlusterAsyncTask();
asyncTask.setTaskId(FixturesTool.GLUSTER_ASYNC_TASK_ID1);
assertNotNull(existingBrick1);
assertNotNull(existingBrick2);
assertEquals(GlusterStatus.UP, existingBrick1.getStatus());
assertEquals(GlusterStatus.UP, existingBrick2.getStatus());
existingBrick1.setAsyncTask(asyncTask);
existingBrick2.setAsyncTask(asyncTask);
List<GlusterBrickEntity> bricks = new ArrayList<>();
bricks.add(existingBrick1);
bricks.add(existingBrick2);
dao.updateBrickTasksInBatch(bricks);
GlusterBrickEntity newEnity1 = dao.getById(FixturesTool.GLUSTER_BRICK_UUID1);
GlusterBrickEntity newEnity2 = dao.getById(FixturesTool.GLUSTER_BRICK_UUID2);
assertEquals(FixturesTool.GLUSTER_ASYNC_TASK_ID1, newEnity1.getAsyncTask().getTaskId());
assertEquals(FixturesTool.GLUSTER_ASYNC_TASK_ID1, newEnity2.getAsyncTask().getTaskId());
}
Aggregations