Search in sources :

Example 16 with GlusterVolume

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));
}
Also used : GlusterVolume(org.ovirt.engine.api.model.GlusterVolume) Cluster(org.ovirt.engine.api.model.Cluster) GlusterBrick(org.ovirt.engine.api.model.GlusterBrick)

Example 17 with GlusterVolume

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);
}
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 18 with GlusterVolume

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);
}
Also used : Response(javax.ws.rs.core.Response) GlusterVolume(org.ovirt.engine.api.model.GlusterVolume) UriInfo(javax.ws.rs.core.UriInfo) Test(org.junit.Test) AbstractBackendCollectionResourceTest(org.ovirt.engine.api.restapi.resource.AbstractBackendCollectionResourceTest)

Aggregations

GlusterVolume (org.ovirt.engine.api.model.GlusterVolume)18 GlusterBrick (org.ovirt.engine.api.model.GlusterBrick)7 Test (org.junit.Test)6 GlusterBricks (org.ovirt.engine.api.model.GlusterBricks)6 AbstractBackendCollectionResourceTest (org.ovirt.engine.api.restapi.resource.AbstractBackendCollectionResourceTest)6 Cluster (org.ovirt.engine.api.model.Cluster)5 Response (javax.ws.rs.core.Response)3 Action (org.ovirt.engine.api.model.Action)3 GlusterVolumeRemoveBricksParameters (org.ovirt.engine.core.common.action.gluster.GlusterVolumeRemoveBricksParameters)3 UriInfo (javax.ws.rs.core.UriInfo)2 Options (org.ovirt.engine.api.model.Options)2 ClusterResource (org.ovirt.engine.api.resource.ClusterResource)2 GlusterVolumeEntity (org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity)2 ArrayList (java.util.ArrayList)1 Option (org.ovirt.engine.api.model.Option)1 TransportType (org.ovirt.engine.api.model.TransportType)1 V3GlusterVolume (org.ovirt.engine.api.v3.types.V3GlusterVolume)1 CreateGlusterVolumeParameters (org.ovirt.engine.core.common.action.gluster.CreateGlusterVolumeParameters)1 GlusterVolumeOptionEntity (org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeOptionEntity)1 IdQueryParameters (org.ovirt.engine.core.common.queries.IdQueryParameters)1