Search in sources :

Example 6 with GlusterBricks

use of org.ovirt.engine.api.model.GlusterBricks in project ovirt-engine by oVirt.

the class BackendGlusterBricksResourceTest method testActivate.

@Test
public void testActivate() 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.StopRemoveGlusterVolumeBricks, GlusterVolumeRemoveBricksParameters.class, new String[] {}, new Object[] {}, true, true));
    Action action = new Action();
    action.setBricks(bricks);
    collection.stopMigrate(action);
}
Also used : Action(org.ovirt.engine.api.model.Action) GlusterVolume(org.ovirt.engine.api.model.GlusterVolume) GlusterBricks(org.ovirt.engine.api.model.GlusterBricks) GlusterBrick(org.ovirt.engine.api.model.GlusterBrick) GlusterVolumeRemoveBricksParameters(org.ovirt.engine.core.common.action.gluster.GlusterVolumeRemoveBricksParameters) Test(org.junit.Test) AbstractBackendCollectionResourceTest(org.ovirt.engine.api.restapi.resource.AbstractBackendCollectionResourceTest)

Example 7 with GlusterBricks

use of org.ovirt.engine.api.model.GlusterBricks in project ovirt-engine by oVirt.

the class BackendGlusterBricksResourceTest method testStopMigrate.

@Test
public void testStopMigrate() 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.StopRemoveGlusterVolumeBricks, GlusterVolumeRemoveBricksParameters.class, new String[] {}, new Object[] {}, true, true));
    Action action = new Action();
    action.setBricks(bricks);
    collection.stopMigrate(action);
}
Also used : Action(org.ovirt.engine.api.model.Action) GlusterVolume(org.ovirt.engine.api.model.GlusterVolume) GlusterBricks(org.ovirt.engine.api.model.GlusterBricks) GlusterBrick(org.ovirt.engine.api.model.GlusterBrick) GlusterVolumeRemoveBricksParameters(org.ovirt.engine.core.common.action.gluster.GlusterVolumeRemoveBricksParameters) Test(org.junit.Test) AbstractBackendCollectionResourceTest(org.ovirt.engine.api.restapi.resource.AbstractBackendCollectionResourceTest)

Example 8 with GlusterBricks

use of org.ovirt.engine.api.model.GlusterBricks in project ovirt-engine by oVirt.

the class BackendGlusterBricksResourceTest method getBrickModelsToRemove.

private GlusterBricks getBrickModelsToRemove() {
    GlusterBricks bricks = new GlusterBricks();
    GlusterBrick brick = new GlusterBrick();
    brick.setId(GUIDS[0].toString());
    bricks.getGlusterBricks().add(brick);
    return bricks;
}
Also used : GlusterBricks(org.ovirt.engine.api.model.GlusterBricks) GlusterBrick(org.ovirt.engine.api.model.GlusterBrick)

Example 9 with GlusterBricks

use of org.ovirt.engine.api.model.GlusterBricks in project ovirt-engine by oVirt.

the class BackendGlusterBricksResourceTest method createModel.

private GlusterBricks createModel() {
    GlusterBricks bricks = new GlusterBricks();
    GlusterBrick brick = new GlusterBrick();
    brick.setId(GUIDS[0].toString());
    brick.setGlusterVolume(new GlusterVolume());
    brick.getGlusterVolume().setId(volumeId.toString());
    brick.setServerId(serverId.toString());
    brick.setBrickDir(brickDir);
    bricks.getGlusterBricks().add(brick);
    return bricks;
}
Also used : GlusterBricks(org.ovirt.engine.api.model.GlusterBricks) GlusterVolume(org.ovirt.engine.api.model.GlusterVolume) GlusterBrick(org.ovirt.engine.api.model.GlusterBrick)

Example 10 with GlusterBricks

use of org.ovirt.engine.api.model.GlusterBricks in project ovirt-engine by oVirt.

the class BackendGlusterBricksResourceTest method testAdd.

@Test
public void testAdd() throws Exception {
    UriInfo uriInfo = setUpBasicUriExpectations();
    when(uriInfo.getPath()).thenReturn("clusters/" + clusterId + "/glustervolumes/" + volumeId + "/bricks");
    setUriInfo(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);
}
Also used : Response(javax.ws.rs.core.Response) GlusterBricks(org.ovirt.engine.api.model.GlusterBricks) UriInfo(javax.ws.rs.core.UriInfo) Test(org.junit.Test) AbstractBackendCollectionResourceTest(org.ovirt.engine.api.restapi.resource.AbstractBackendCollectionResourceTest)

Aggregations

GlusterBricks (org.ovirt.engine.api.model.GlusterBricks)16 GlusterBrick (org.ovirt.engine.api.model.GlusterBrick)7 Test (org.junit.Test)6 GlusterVolume (org.ovirt.engine.api.model.GlusterVolume)6 AbstractBackendCollectionResourceTest (org.ovirt.engine.api.restapi.resource.AbstractBackendCollectionResourceTest)6 Response (javax.ws.rs.core.Response)4 Action (org.ovirt.engine.api.model.Action)4 GlusterVolumeRemoveBricksParameters (org.ovirt.engine.core.common.action.gluster.GlusterVolumeRemoveBricksParameters)4 UriInfo (javax.ws.rs.core.UriInfo)3 WebApplicationException (javax.ws.rs.WebApplicationException)2 GlusterBrickEntity (org.ovirt.engine.core.common.businessentities.gluster.GlusterBrickEntity)2 IdQueryParameters (org.ovirt.engine.core.common.queries.IdQueryParameters)2 ArrayList (java.util.ArrayList)1 List (java.util.List)1 Cluster (org.ovirt.engine.api.model.Cluster)1 Options (org.ovirt.engine.api.model.Options)1 V3GlusterBricks (org.ovirt.engine.api.v3.types.V3GlusterBricks)1 V3GlusterVolume (org.ovirt.engine.api.v3.types.V3GlusterVolume)1 ActionReturnValue (org.ovirt.engine.core.common.action.ActionReturnValue)1 GlusterVolumeEntity (org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity)1