use of org.ovirt.engine.api.model.GlusterVolume in project ovirt-engine by oVirt.
the class BackendGlusterBrickResourceTest method setupParentExpectations.
private void setupParentExpectations() {
volumeResourceMock = mock(BackendGlusterVolumeResource.class);
when(bricksResourceMock.getParent()).thenReturn(volumeResourceMock);
when(volumeResourceMock.getId()).thenReturn(volumeId.toString());
doAnswer(invocation -> {
GlusterBrick glusterBrick = (GlusterBrick) invocation.getArguments()[0];
Cluster cluster = new Cluster();
cluster.setId(clusterId.toString());
GlusterVolume volume = new GlusterVolume();
volume.setId(volumeId.toString());
volume.setCluster(cluster);
glusterBrick.setGlusterVolume(volume);
return glusterBrick;
}).when(bricksResourceMock).addParents(isA(GlusterBrick.class));
}
use of org.ovirt.engine.api.model.GlusterVolume in project ovirt-engine by oVirt.
the class BackendGlusterBricksResourceTest method testMigrate.
@Test
public void testMigrate() throws Exception {
GlusterBrick brick = new GlusterBrick();
GlusterVolume volume = new GlusterVolume();
brick.setName(serverName + ":" + brickDir);
volume.setId(volumeId.toString());
brick.setGlusterVolume(volume);
GlusterBricks bricks = mock(GlusterBricks.class);
when(bricks.getGlusterBricks()).thenReturn(Collections.singletonList(brick));
setUriInfo(setUpActionExpectations(ActionType.StartRemoveGlusterVolumeBricks, GlusterVolumeRemoveBricksParameters.class, new String[] {}, new Object[] {}, true, true));
Action action = new Action();
action.setBricks(bricks);
collection.migrate(action);
}
use of org.ovirt.engine.api.model.GlusterVolume in project ovirt-engine by oVirt.
the class BackendGlusterVolumesResourceTest method testAddForceFalse.
@Test
public void testAddForceFalse() {
UriInfo uriInfo = setUpBasicUriExpectations();
setUriInfo(setUpGetMatrixConstraintsExpectations(BackendResource.FORCE_CONSTRAINT, false, "false", uriInfo));
setUpVolumeCreationExpectations(false);
collection.setParent(parentMock);
Response response = collection.add(createModel());
assertEquals(201, response.getStatus());
assertTrue(response.getEntity() instanceof GlusterVolume);
verifyModel((GlusterVolume) response.getEntity(), 1);
}
Aggregations