use of org.ovirt.engine.api.model.GlusterBricks in project ovirt-engine by oVirt.
the class BackendGlusterVolumesResourceTest method createModel.
private GlusterVolume createModel() {
GlusterVolume volume = new GlusterVolume();
volume.setName("testVol1");
volume.setCluster(new Cluster());
volume.getCluster().setId(clusterId.toString());
volume.setVolumeType(org.ovirt.engine.api.model.GlusterVolumeType.DISTRIBUTE);
volume.setBricks(new GlusterBricks());
volume.getBricks().getGlusterBricks().add(createBrick("/export/vol1/brick1"));
return volume;
}
use of org.ovirt.engine.api.model.GlusterBricks in project ovirt-engine by oVirt.
the class BackendGlusterBricksResourceTest method testAddForce.
@Test
public void testAddForce() throws Exception {
UriInfo uriInfo = setUpBasicUriExpectations();
when(uriInfo.getPath()).thenReturn("clusters/" + clusterId + "/glustervolumes/" + volumeId + "/bricks");
setUriInfo(setUpGetMatrixConstraintsExpectations(BackendResource.FORCE_CONSTRAINT, true, "true", uriInfo));
setUpBrickCreationExpectation(true);
Response response = collection.add(createModel());
assertEquals(201, response.getStatus());
assertTrue(response.getEntity() instanceof GlusterBricks);
verifyModel(((GlusterBricks) response.getEntity()).getGlusterBricks().get(0), 0);
}
use of org.ovirt.engine.api.model.GlusterBricks in project ovirt-engine by oVirt.
the class BackendGlusterBricksResourceTest method testAddForceFalse.
@Test
public void testAddForceFalse() throws Exception {
UriInfo uriInfo = setUpBasicUriExpectations();
when(uriInfo.getPath()).thenReturn("clusters/" + clusterId + "/glustervolumes/" + volumeId + "/bricks");
setUriInfo(setUpGetMatrixConstraintsExpectations(BackendResource.FORCE_CONSTRAINT, false, "false", uriInfo));
setUpBrickCreationExpectation(false);
Response response = collection.add(createModel());
assertEquals(201, response.getStatus());
assertTrue(response.getEntity() instanceof GlusterBricks);
verifyModel(((GlusterBricks) response.getEntity()).getGlusterBricks().get(0), 0);
}
use of org.ovirt.engine.api.model.GlusterBricks 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.GlusterBricks in project ovirt-engine by oVirt.
the class BackendGlusterBricksResource method list.
@SuppressWarnings("unchecked")
@Override
public GlusterBricks list() {
List<GlusterBrickEntity> bricks = getBackendCollection(QueryType.GetGlusterVolumeBricks, new IdQueryParameters(asGuid(getVolumeId())));
GlusterBricks bricksModel = mapCollection(bricks);
return addActions(bricksModel);
}
Aggregations