Juan Hernandez has uploaded a new change for review.

Change subject: restapi: Move Attached Storage remove from collection to entity
......................................................................

restapi: Move Attached Storage remove from collection to entity

This patch moves the method that implements the DELETE operation from
the collection interface to the entity interface. This is needed to
avoid issues with newer versions of Resteasy.

Change-Id: I3b41c2868bc37e0eeeac850cd0fdf6082001ea11
Related: https://gerrit.ovirt.org/41783
Signed-off-by: Juan Hernandez <juan.hernan...@redhat.com>
---
M 
backend/manager/modules/restapi/interface/definition/src/main/java/org/ovirt/engine/api/resource/AttachedStorageDomainResource.java
M 
backend/manager/modules/restapi/interface/definition/src/main/java/org/ovirt/engine/api/resource/AttachedStorageDomainsResource.java
M 
backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendAttachedStorageDomainResource.java
M 
backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendAttachedStorageDomainsResource.java
M 
backend/manager/modules/restapi/jaxrs/src/test/java/org/ovirt/engine/api/restapi/resource/BackendAttachedStorageDomainResourceTest.java
M 
backend/manager/modules/restapi/jaxrs/src/test/java/org/ovirt/engine/api/restapi/resource/BackendAttachedStorageDomainsResourceTest.java
6 files changed, 190 insertions(+), 139 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/85/41985/1

diff --git 
a/backend/manager/modules/restapi/interface/definition/src/main/java/org/ovirt/engine/api/resource/AttachedStorageDomainResource.java
 
b/backend/manager/modules/restapi/interface/definition/src/main/java/org/ovirt/engine/api/resource/AttachedStorageDomainResource.java
index 703d4a9..115dfcf 100644
--- 
a/backend/manager/modules/restapi/interface/definition/src/main/java/org/ovirt/engine/api/resource/AttachedStorageDomainResource.java
+++ 
b/backend/manager/modules/restapi/interface/definition/src/main/java/org/ovirt/engine/api/resource/AttachedStorageDomainResource.java
@@ -17,6 +17,7 @@
 package org.ovirt.engine.api.resource;
 
 import javax.ws.rs.Consumes;
+import javax.ws.rs.DELETE;
 import javax.ws.rs.GET;
 import javax.ws.rs.Path;
 import javax.ws.rs.PathParam;
@@ -30,25 +31,27 @@
 
 @Produces({ApiMediaType.APPLICATION_XML, ApiMediaType.APPLICATION_JSON, 
ApiMediaType.APPLICATION_X_YAML})
 public interface AttachedStorageDomainResource {
-
     @GET
-    public StorageDomain get();
+    StorageDomain get();
+
+    @DELETE
+    Response remove();
 
     @Path("{action: (activate|deactivate)}/{oid}")
-    public ActionResource getActionSubresource(@PathParam("action") String 
action, @PathParam("oid") String oid);
+    ActionResource getActionSubresource(@PathParam("action") String action, 
@PathParam("oid") String oid);
 
     @POST
     @Consumes({ApiMediaType.APPLICATION_XML, ApiMediaType.APPLICATION_JSON, 
ApiMediaType.APPLICATION_X_YAML})
     @Actionable
     @Path("activate")
-    public Response activate(Action action);
+    Response activate(Action action);
 
     @POST
     @Consumes({ApiMediaType.APPLICATION_XML, ApiMediaType.APPLICATION_JSON, 
ApiMediaType.APPLICATION_X_YAML})
     @Actionable
     @Path("deactivate")
-    public Response deactivate(Action action);
+    Response deactivate(Action action);
 
     @Path("disks")
-    public DisksResource getDisksResource();
+    DisksResource getDisksResource();
 }
diff --git 
a/backend/manager/modules/restapi/interface/definition/src/main/java/org/ovirt/engine/api/resource/AttachedStorageDomainsResource.java
 
b/backend/manager/modules/restapi/interface/definition/src/main/java/org/ovirt/engine/api/resource/AttachedStorageDomainsResource.java
index 6c43473..e64755f 100644
--- 
a/backend/manager/modules/restapi/interface/definition/src/main/java/org/ovirt/engine/api/resource/AttachedStorageDomainsResource.java
+++ 
b/backend/manager/modules/restapi/interface/definition/src/main/java/org/ovirt/engine/api/resource/AttachedStorageDomainsResource.java
@@ -17,7 +17,6 @@
 package org.ovirt.engine.api.resource;
 
 import javax.ws.rs.Consumes;
-import javax.ws.rs.DELETE;
 import javax.ws.rs.GET;
 import javax.ws.rs.Path;
 import javax.ws.rs.PathParam;
@@ -30,18 +29,13 @@
 
 @Produces({ApiMediaType.APPLICATION_XML, ApiMediaType.APPLICATION_JSON, 
ApiMediaType.APPLICATION_X_YAML})
 public interface AttachedStorageDomainsResource {
-
     @GET
-    public StorageDomains list();
+    StorageDomains list();
 
     @POST
     @Consumes({ApiMediaType.APPLICATION_XML, ApiMediaType.APPLICATION_JSON, 
ApiMediaType.APPLICATION_X_YAML})
-    public Response add(StorageDomain storageDomain);
-
-    @DELETE
-    @Path("{id}")
-    public Response remove(@PathParam("id") String id);
+    Response add(StorageDomain storageDomain);
 
     @Path("{id}")
-    public AttachedStorageDomainResource 
getAttachedStorageDomainSubResource(@PathParam("id") String id);
+    AttachedStorageDomainResource 
getAttachedStorageDomainSubResource(@PathParam("id") String id);
 }
diff --git 
a/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendAttachedStorageDomainResource.java
 
b/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendAttachedStorageDomainResource.java
index 9d24c27..f4129a1 100644
--- 
a/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendAttachedStorageDomainResource.java
+++ 
b/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendAttachedStorageDomainResource.java
@@ -5,10 +5,13 @@
 import org.ovirt.engine.api.model.Action;
 import org.ovirt.engine.api.model.DataCenter;
 import org.ovirt.engine.api.model.StorageDomain;
+import org.ovirt.engine.api.model.StorageType;
 import org.ovirt.engine.api.resource.ActionResource;
 import org.ovirt.engine.api.resource.AttachedStorageDomainResource;
 import org.ovirt.engine.api.resource.DisksResource;
 import org.ovirt.engine.api.restapi.util.StorageDomainHelper;
+import 
org.ovirt.engine.core.common.action.DetachStorageDomainFromPoolParameters;
+import org.ovirt.engine.core.common.action.RemoveStorageDomainParameters;
 import org.ovirt.engine.core.common.action.StorageDomainPoolParametersBase;
 
 import 
org.ovirt.engine.core.common.queries.StorageDomainAndPoolQueryParameters;
@@ -80,4 +83,18 @@
     public DisksResource getDisksResource() {
         return inject(new BackendStorageDomainDisksResource(asGuid(id), 
subCollections));
     }
+
+    @Override
+    public Response remove() {
+        StorageDomain storageDomain = get();
+        if 
(storageDomain.getStorage().getType().equals(StorageType.LOCALFS.value())) {
+            RemoveStorageDomainParameters params = new 
RemoveStorageDomainParameters(guid);
+            params.setDoFormat(true);
+            return performAction(VdcActionType.RemoveStorageDomain, params);
+        }
+        else {
+            DetachStorageDomainFromPoolParameters params = new 
DetachStorageDomainFromPoolParameters(guid, dataCenterId);
+            return performAction(VdcActionType.DetachStorageDomainFromPool, 
params);
+        }
+    }
 }
diff --git 
a/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendAttachedStorageDomainsResource.java
 
b/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendAttachedStorageDomainsResource.java
index 46a258d..559ad46 100644
--- 
a/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendAttachedStorageDomainsResource.java
+++ 
b/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendAttachedStorageDomainsResource.java
@@ -7,13 +7,10 @@
 import org.ovirt.engine.api.model.DataCenter;
 import org.ovirt.engine.api.model.StorageDomain;
 import org.ovirt.engine.api.model.StorageDomains;
-import org.ovirt.engine.api.model.StorageType;
 import org.ovirt.engine.api.resource.AttachedStorageDomainResource;
 import org.ovirt.engine.api.resource.AttachedStorageDomainsResource;
 import org.ovirt.engine.api.restapi.util.StorageDomainHelper;
 import org.ovirt.engine.core.common.action.AttachStorageDomainToPoolParameters;
-import 
org.ovirt.engine.core.common.action.DetachStorageDomainFromPoolParameters;
-import org.ovirt.engine.core.common.action.RemoveStorageDomainParameters;
 import org.ovirt.engine.core.common.action.VdcActionType;
 import org.ovirt.engine.core.common.queries.IdQueryParameters;
 import org.ovirt.engine.core.common.queries.NameQueryParameters;
@@ -67,19 +64,6 @@
         return performCreate(VdcActionType.AttachStorageDomainToPool,
                                new 
AttachStorageDomainToPoolParameters(storageDomainId, dataCenterId),
                                new StorageDomainIdResolver(storageDomainId));
-    }
-
-    @Override
-    public Response performRemove(String id) {
-        StorageDomain storageDomain = 
getAttachedStorageDomainSubResource(id).get();
-        if 
(storageDomain.getStorage().getType().equals(StorageType.LOCALFS.value())) {
-            RemoveStorageDomainParameters params = new 
RemoveStorageDomainParameters(asGuid(id));
-            params.setDoFormat(true);
-            return (performAction(VdcActionType.RemoveStorageDomain, params));
-        } else {
-            return (performAction(VdcActionType.DetachStorageDomainFromPool,
-                    new DetachStorageDomainFromPoolParameters(asGuid(id), 
dataCenterId)));
-        }
     }
 
     @Override
diff --git 
a/backend/manager/modules/restapi/jaxrs/src/test/java/org/ovirt/engine/api/restapi/resource/BackendAttachedStorageDomainResourceTest.java
 
b/backend/manager/modules/restapi/jaxrs/src/test/java/org/ovirt/engine/api/restapi/resource/BackendAttachedStorageDomainResourceTest.java
index 57c09f5..3f7638a 100644
--- 
a/backend/manager/modules/restapi/jaxrs/src/test/java/org/ovirt/engine/api/restapi/resource/BackendAttachedStorageDomainResourceTest.java
+++ 
b/backend/manager/modules/restapi/jaxrs/src/test/java/org/ovirt/engine/api/restapi/resource/BackendAttachedStorageDomainResourceTest.java
@@ -11,12 +11,14 @@
 import org.ovirt.engine.api.model.Action;
 import org.ovirt.engine.api.model.CreationStatus;
 import org.ovirt.engine.api.model.StorageDomain;
+import 
org.ovirt.engine.core.common.action.DetachStorageDomainFromPoolParameters;
+import org.ovirt.engine.core.common.action.RemoveStorageDomainParameters;
 import org.ovirt.engine.core.common.action.VdcActionParametersBase;
 import org.ovirt.engine.core.common.action.VdcActionType;
 import org.ovirt.engine.core.common.action.StorageDomainPoolParametersBase;
 import org.ovirt.engine.core.common.businessentities.AsyncTaskStatus;
 import org.ovirt.engine.core.common.businessentities.AsyncTaskStatusEnum;
-
+import org.ovirt.engine.core.common.businessentities.StorageDomainType;
 import org.ovirt.engine.core.common.businessentities.StorageServerConnections;
 import org.ovirt.engine.core.common.businessentities.storage.StorageType;
 import 
org.ovirt.engine.core.common.queries.StorageDomainAndPoolQueryParameters;
@@ -24,8 +26,7 @@
 import org.ovirt.engine.core.common.queries.VdcQueryType;
 import org.ovirt.engine.core.compat.Guid;
 
-import static 
org.ovirt.engine.api.restapi.resource.BackendAttachedStorageDomainsResourceTest.setUpEntityExpectations;
-import static 
org.ovirt.engine.api.restapi.resource.BackendAttachedStorageDomainsResourceTest.verifyStorageDomain;
+import static org.easymock.EasyMock.expect;
 
 public class BackendAttachedStorageDomainResourceTest
     extends AbstractBackendSubResourceTest<StorageDomain,
@@ -33,7 +34,8 @@
                                            
BackendAttachedStorageDomainResource> {
 
     private static final Guid STORAGE_DOMAIN_ID = GUIDS[0];
-    private static final Guid DATA_CENTER_ID = GUIDS[NAMES.length - 1];
+    private static final Guid DATA_CENTER_ID = GUIDS[1];
+    private static final Guid STORAGE_CONNECTION_ID = GUIDS[2];
 
     public BackendAttachedStorageDomainResourceTest() {
         super(new 
BackendAttachedStorageDomainResource(STORAGE_DOMAIN_ID.toString(), 
DATA_CENTER_ID));
@@ -45,7 +47,8 @@
         try {
             new BackendAttachedStorageDomainResource("foo", null);
             fail("expected WebApplicationException");
-        } catch (WebApplicationException wae) {
+        }
+        catch (WebApplicationException wae) {
             verifyNotFoundException(wae);
         }
     }
@@ -53,38 +56,38 @@
     @Test
     public void testGetNotFound() throws Exception {
         setUriInfo(setUpBasicUriExpectations());
-        setUpGetEntityExpectations(true);
+        setUpGetDomainExpectations(StorageType.NFS, false);
         control.replay();
         try {
             resource.get();
             fail("expected WebApplicationException");
-        } catch (WebApplicationException wae) {
+        }
+        catch (WebApplicationException wae) {
             verifyNotFoundException(wae);
         }
     }
 
     @Test
     public void testGet() throws Exception {
-        setUpGetEntityExpectations(VdcQueryType.GetStorageServerConnectionById,
-                StorageServerConnectionQueryParametersBase.class,
-                new String[] { "ServerConnectionId" },
-                new Object[] { GUIDS[0].toString() },
-                setUpStorageServerConnection());
-        setUpGetEntityExpectations();
+        setUpGetDomainExpectations(StorageType.NFS, true);
+        setUpGetConnectionExpectations();
         setUriInfo(setUpBasicUriExpectations());
         control.replay();
-
-        verifyStorageDomain(resource.get(), 0);
+        verifyStorageDomain(resource.get());
     }
 
     @Test
     public void testActivate() throws Exception {
-        setUriInfo(setUpActionExpectations(VdcActionType.ActivateStorageDomain,
-                                           
StorageDomainPoolParametersBase.class,
-                                           new String[] { "StorageDomainId", 
"StoragePoolId" },
-                                           new Object[] { STORAGE_DOMAIN_ID, 
DATA_CENTER_ID }));
-
-        verifyActionResponse(resource.activate(new Action()));
+        setUriInfo(
+            setUpActionExpectations(
+                VdcActionType.ActivateStorageDomain,
+                StorageDomainPoolParametersBase.class,
+                new String[] { "StorageDomainId", "StoragePoolId" },
+                new Object[] { STORAGE_DOMAIN_ID, DATA_CENTER_ID }
+            )
+        );
+        Action action = new Action();
+        verifyActionResponse(resource.activate(action));
     }
 
     @Test
@@ -103,41 +106,117 @@
     }
 
     private void doTestActivateAsync(AsyncTaskStatusEnum asyncStatus, 
CreationStatus actionStatus) throws Exception {
-        setUriInfo(setUpActionExpectations(VdcActionType.ActivateStorageDomain,
-                                           
StorageDomainPoolParametersBase.class,
-                                           new String[] { "StorageDomainId", 
"StoragePoolId" },
-                                           new Object[] { STORAGE_DOMAIN_ID, 
DATA_CENTER_ID },
-                                           asList(GUIDS[1]),
-                                           asList(new 
AsyncTaskStatus(asyncStatus))));
-
+        setUriInfo(
+            setUpActionExpectations(
+                VdcActionType.ActivateStorageDomain,
+                StorageDomainPoolParametersBase.class,
+                new String[] { "StorageDomainId", "StoragePoolId" },
+                new Object[] { STORAGE_DOMAIN_ID, DATA_CENTER_ID },
+                asList(GUIDS[1]),
+                asList(new AsyncTaskStatus(asyncStatus))
+            )
+        );
         Response response = resource.activate(new Action());
-        verifyActionResponse(response, "datacenters/" + DATA_CENTER_ID + 
"/storagedomains/" + STORAGE_DOMAIN_ID, true, null, null);
-        Action action = (Action)response.getEntity();
+        verifyActionResponse(
+            response,
+            "datacenters/" + DATA_CENTER_ID + "/storagedomains/" + 
STORAGE_DOMAIN_ID,
+            true,
+            null,
+            null
+        );
+        Action action = (Action) response.getEntity();
         assertTrue(action.isSetStatus());
         assertEquals(actionStatus.value(), action.getStatus().getState());
-
     }
 
     @Test
     public void testDeactivate() throws Exception {
-        
setUriInfo(setUpActionExpectations(VdcActionType.DeactivateStorageDomainWithOvfUpdate,
-                                           
StorageDomainPoolParametersBase.class,
-                                           new String[] { "StorageDomainId", 
"StoragePoolId" },
-                                           new Object[] { STORAGE_DOMAIN_ID, 
DATA_CENTER_ID }));
-
-        verifyActionResponse(resource.deactivate(new Action()));
+        setUriInfo(
+            setUpActionExpectations(
+                VdcActionType.DeactivateStorageDomainWithOvfUpdate,
+                StorageDomainPoolParametersBase.class,
+                new String[]{"StorageDomainId", "StoragePoolId"},
+                new Object[]{STORAGE_DOMAIN_ID, DATA_CENTER_ID}
+            )
+        );
+        Action action = new Action();
+        verifyActionResponse(resource.deactivate(action));
     }
 
-    protected void setUpGetEntityExpectations() throws Exception {
-        setUpGetEntityExpectations(false);
+    @Test
+    public void testRemove() throws Exception {
+        setUpGetDomainExpectations(StorageType.NFS, true);
+        setUpGetConnectionExpectations();
+        setUriInfo(
+            setUpActionExpectations(
+                VdcActionType.DetachStorageDomainFromPool,
+                DetachStorageDomainFromPoolParameters.class,
+                new String[] { "StorageDomainId", "StoragePoolId" },
+                new Object[] { STORAGE_DOMAIN_ID, DATA_CENTER_ID },
+                true,
+                true
+            )
+        );
+        verifyRemove(resource.remove());
     }
 
-    protected void setUpGetEntityExpectations(boolean notFound) throws 
Exception {
-        
setUpGetEntityExpectations(VdcQueryType.GetStorageDomainByIdAndStoragePoolId,
-                                   StorageDomainAndPoolQueryParameters.class,
-                                   new String[] { "StorageDomainId", 
"StoragePoolId" },
-                                   new Object[] { STORAGE_DOMAIN_ID, 
DATA_CENTER_ID },
-                                   notFound ? null : getEntity(0));
+    @Test
+    public void testRemoveLocalStorage() throws Exception {
+        setUpGetDomainExpectations(StorageType.LOCALFS, true);
+        setUpGetConnectionExpectations();
+        setUriInfo(
+            setUpActionExpectations(
+                VdcActionType.RemoveStorageDomain,
+                RemoveStorageDomainParameters.class,
+                new String[] { "StorageDomainId"},
+                new Object[] { STORAGE_DOMAIN_ID },
+                true,
+                true
+            )
+        );
+        verifyRemove(resource.remove());
+    }
+
+    @Test
+    public void testRemoveCantDo() throws Exception {
+        doTestBadRemove(false, true, CANT_DO);
+    }
+
+    @Test
+    public void testRemoveFailed() throws Exception {
+        doTestBadRemove(true, false, FAILURE);
+    }
+
+    private void doTestBadRemove(boolean canDo, boolean success, String 
detail) throws Exception {
+        setUpGetDomainExpectations(StorageType.NFS, true);
+        setUpGetConnectionExpectations();
+        setUriInfo(
+            setUpActionExpectations(
+                VdcActionType.DetachStorageDomainFromPool,
+                DetachStorageDomainFromPoolParameters.class,
+                new String[]{"StorageDomainId", "StoragePoolId"},
+                new Object[]{STORAGE_DOMAIN_ID, DATA_CENTER_ID},
+                canDo,
+                success
+            )
+        );
+        try {
+            resource.remove();
+            fail("expected WebApplicationException");
+        }
+        catch (WebApplicationException wae) {
+            verifyFault(wae, detail);
+        }
+    }
+
+    private void setUpGetDomainExpectations(StorageType storageType, boolean 
succeed) throws Exception {
+        setUpGetEntityExpectations(
+            VdcQueryType.GetStorageDomainByIdAndStoragePoolId,
+            StorageDomainAndPoolQueryParameters.class,
+            new String[]{"StorageDomainId", "StoragePoolId"},
+            new Object[]{STORAGE_DOMAIN_ID, DATA_CENTER_ID},
+            succeed ? setUpDomainExpectations(storageType) : null
+        );
     }
 
     protected UriInfo setUpActionExpectations(VdcActionType task,
@@ -161,15 +240,41 @@
         verifyActionResponse(r, "datacenters/" + DATA_CENTER_ID + 
"/storagedomains/" + STORAGE_DOMAIN_ID, false);
     }
 
-    @Override
-    protected org.ovirt.engine.core.common.businessentities.StorageDomain 
getEntity(int index) {
-        return 
setUpEntityExpectations(control.createMock(org.ovirt.engine.core.common.businessentities.StorageDomain.class),
 index, StorageType.NFS);
+    private org.ovirt.engine.core.common.businessentities.StorageDomain 
setUpDomainExpectations(StorageType type) {
+        org.ovirt.engine.core.common.businessentities.StorageDomain domain =
+            
control.createMock(org.ovirt.engine.core.common.businessentities.StorageDomain.class);
+        expect(domain.getId()).andReturn(STORAGE_DOMAIN_ID).anyTimes();
+        
expect(domain.getStorageDomainType()).andReturn(StorageDomainType.Master).anyTimes();
+        expect(domain.getStorageType()).andReturn(type).anyTimes();
+        
expect(domain.getStorage()).andReturn(STORAGE_CONNECTION_ID.toString()).anyTimes();
+        return domain;
     }
 
-    static StorageServerConnections setUpStorageServerConnection() {
-        StorageServerConnections cnx = new StorageServerConnections();
-            cnx.setid(GUIDS[0].toString());
-            cnx.setconnection("10.11.12.13" + ":" + "/1");
-        return cnx;
+    private StorageServerConnections setUpConnectionExpectations() {
+        StorageServerConnections connection = new StorageServerConnections();
+        connection.setid(STORAGE_CONNECTION_ID.toString());
+        connection.setconnection("10.11.12.13" + ":" + "/1");
+        return connection;
+    }
+
+    private void setUpGetConnectionExpectations() throws Exception {
+        setUpGetEntityExpectations(
+            VdcQueryType.GetStorageServerConnectionById,
+            StorageServerConnectionQueryParametersBase.class,
+            new String[] { "ServerConnectionId" },
+            new Object[] { STORAGE_CONNECTION_ID.toString() },
+            setUpConnectionExpectations()
+        );
+    }
+
+    private void verifyStorageDomain(StorageDomain model) {
+        assertEquals(STORAGE_DOMAIN_ID.toString(), model.getId());
+        assertNotNull(model.getDataCenter());
+        assertEquals(DATA_CENTER_ID.toString(), model.getDataCenter().getId());
+    }
+
+    @Override
+    protected org.ovirt.engine.core.common.businessentities.StorageDomain 
getEntity(int index) {
+        return setUpDomainExpectations(StorageType.NFS);
     }
 }
diff --git 
a/backend/manager/modules/restapi/jaxrs/src/test/java/org/ovirt/engine/api/restapi/resource/BackendAttachedStorageDomainsResourceTest.java
 
b/backend/manager/modules/restapi/jaxrs/src/test/java/org/ovirt/engine/api/restapi/resource/BackendAttachedStorageDomainsResourceTest.java
index b208dc9..c2962c2 100644
--- 
a/backend/manager/modules/restapi/jaxrs/src/test/java/org/ovirt/engine/api/restapi/resource/BackendAttachedStorageDomainsResourceTest.java
+++ 
b/backend/manager/modules/restapi/jaxrs/src/test/java/org/ovirt/engine/api/restapi/resource/BackendAttachedStorageDomainsResourceTest.java
@@ -15,8 +15,6 @@
 import org.junit.Test;
 import org.ovirt.engine.api.model.StorageDomain;
 import org.ovirt.engine.core.common.action.AttachStorageDomainToPoolParameters;
-import 
org.ovirt.engine.core.common.action.DetachStorageDomainFromPoolParameters;
-import org.ovirt.engine.core.common.action.RemoveStorageDomainParameters;
 import org.ovirt.engine.core.common.action.VdcActionType;
 import org.ovirt.engine.core.common.businessentities.StorageDomainStatus;
 import org.ovirt.engine.core.common.businessentities.StorageDomainType;
@@ -156,31 +154,6 @@
         }
     }
 
-    @Test
-    public void testRemove() throws Exception {
-        setUpGetConnection(2);
-        setUpGetEntityExpectations(GUIDS[0], 2, getEntity(0));
-        
setUriInfo(setUpActionExpectations(VdcActionType.DetachStorageDomainFromPool,
-                                           
DetachStorageDomainFromPoolParameters.class,
-                                           new String[] { "StorageDomainId", 
"StoragePoolId" },
-                                           new Object[] { GUIDS[0], 
GUIDS[NAMES.length-1] },
-                                           true,
-                                           true));
-        verifyRemove(collection.remove(GUIDS[0].toString()));
-    }
-
-    @Test
-    public void testRemoveLocalStorage() throws Exception {
-        setUpGetConnection(2);
-        setUpGetEntityExpectations(GUIDS[0], 2, getEntity(0, 
StorageType.LOCALFS));
-        setUriInfo(setUpActionExpectations(VdcActionType.RemoveStorageDomain,
-                                           RemoveStorageDomainParameters.class,
-                                           new String[] { "StorageDomainId"},
-                                           new Object[] { GUIDS[0] },
-                                           true,
-                                           true));
-        verifyRemove(collection.remove(GUIDS[0].toString()));
-    }
 
     private void setUpGetConnection(int times) throws Exception {
         for (int i=0; i<times; i++) {
@@ -219,15 +192,6 @@
                 entity);
     }
 
-    @Test
-    public void testRemoveCantDo() throws Exception {
-        doTestBadRemove(false, true, CANT_DO);
-    }
-
-    @Test
-    public void testRemoveFailed() throws Exception {
-        doTestBadRemove(true, false, FAILURE);
-    }
 
     @Override
     @Test
@@ -245,22 +209,6 @@
         verifyCollection(getCollection());
     }
 
-    protected void doTestBadRemove(boolean canDo, boolean success, String 
detail) throws Exception {
-        setUpGetConnection(2);
-        setUpGetEntityExpectations(GUIDS[0], 2, getEntity(0));
-        
setUriInfo(setUpActionExpectations(VdcActionType.DetachStorageDomainFromPool,
-                                           
DetachStorageDomainFromPoolParameters.class,
-                                           new String[] { "StorageDomainId", 
"StoragePoolId" },
-                                           new Object[] { GUIDS[0], 
GUIDS[NAMES.length-1] },
-                                           canDo,
-                                           success));
-        try {
-            collection.remove(GUIDS[0].toString());
-            fail("expected WebApplicationException");
-        } catch (WebApplicationException wae) {
-            verifyFault(wae, detail);
-        }
-    }
 
     @Override
     protected void setUpQueryExpectations(String query, Object failure) throws 
Exception {
@@ -307,7 +255,7 @@
         return setUpEntityExpectations(entity, index, storageType);
     }
 
-    static org.ovirt.engine.core.common.businessentities.StorageDomainStatic 
setUpEntityExpectations(org.ovirt.engine.core.common.businessentities.StorageDomainStatic
 entity,
+    private static 
org.ovirt.engine.core.common.businessentities.StorageDomainStatic 
setUpEntityExpectations(org.ovirt.engine.core.common.businessentities.StorageDomainStatic
 entity,
             int index,
             StorageType storageType) {
         expect(entity.getId()).andReturn(GUIDS[index]).anyTimes();
@@ -317,7 +265,7 @@
         return entity;
     }
 
-    static org.ovirt.engine.core.common.businessentities.StorageDomain 
setUpEntityExpectations(org.ovirt.engine.core.common.businessentities.StorageDomain
 entity, int index, StorageType storageType) {
+    private static org.ovirt.engine.core.common.businessentities.StorageDomain 
setUpEntityExpectations(org.ovirt.engine.core.common.businessentities.StorageDomain
 entity, int index, StorageType storageType) {
         expect(entity.getId()).andReturn(GUIDS[index]).anyTimes();
         
expect(entity.getStatus()).andReturn(StorageDomainStatus.Active).anyTimes();
         
expect(entity.getStorageDomainType()).andReturn(StorageDomainType.Master).anyTimes();
@@ -332,7 +280,7 @@
         verifyLinks(model);
     }
 
-    static void verifyStorageDomain(StorageDomain model, int index) {
+    private static void verifyStorageDomain(StorageDomain model, int index) {
         assertEquals(GUIDS[index].toString(), model.getId());
         assertNotNull(model.getDataCenter());
         assertEquals(GUIDS[NAMES.length-1].toString(), 
model.getDataCenter().getId());


-- 
To view, visit https://gerrit.ovirt.org/41985
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I3b41c2868bc37e0eeeac850cd0fdf6082001ea11
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Juan Hernandez <juan.hernan...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to