Moti Asayag has uploaded a new change for review.

Change subject: restapi: Fix broken test
......................................................................

restapi: Fix broken test

The patch avoids NPE when trying to access the OsRepository.

Change-Id: Ifd084c11ac6d1947e94490125431460916d5a294
Signed-off-by: Moti Asayag <masa...@redhat.com>
---
M 
backend/manager/modules/restapi/jaxrs/src/test/java/org/ovirt/engine/api/restapi/resource/BackendSnapshotsResourceTest.java
1 file changed, 14 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/11/28811/1

diff --git 
a/backend/manager/modules/restapi/jaxrs/src/test/java/org/ovirt/engine/api/restapi/resource/BackendSnapshotsResourceTest.java
 
b/backend/manager/modules/restapi/jaxrs/src/test/java/org/ovirt/engine/api/restapi/resource/BackendSnapshotsResourceTest.java
index 6d8e7d8..342533f 100644
--- 
a/backend/manager/modules/restapi/jaxrs/src/test/java/org/ovirt/engine/api/restapi/resource/BackendSnapshotsResourceTest.java
+++ 
b/backend/manager/modules/restapi/jaxrs/src/test/java/org/ovirt/engine/api/restapi/resource/BackendSnapshotsResourceTest.java
@@ -5,6 +5,7 @@
 import java.util.ArrayList;
 import java.util.Date;
 import java.util.GregorianCalendar;
+import java.util.HashMap;
 import java.util.List;
 
 import javax.ws.rs.WebApplicationException;
@@ -23,8 +24,10 @@
 import org.ovirt.engine.core.common.businessentities.AsyncTaskStatusEnum;
 import org.ovirt.engine.core.common.businessentities.Snapshot.SnapshotType;
 import org.ovirt.engine.core.common.businessentities.VM;
+import org.ovirt.engine.core.common.osinfo.OsRepository;
 import org.ovirt.engine.core.common.queries.IdQueryParameters;
 import org.ovirt.engine.core.common.queries.VdcQueryType;
+import org.ovirt.engine.core.common.utils.SimpleDependecyInjector;
 import org.ovirt.engine.core.compat.Guid;
 
 public class BackendSnapshotsResourceTest
@@ -32,6 +35,12 @@
 
     public BackendSnapshotsResourceTest() {
         super(new BackendSnapshotsResource(VM_ID), null, "");
+    }
+
+    @Override
+    public void setUp() {
+        super.setUp();
+        mockOsRepository();
     }
 
     static final Guid[] SNAPSHOT_IDS = GUIDS;
@@ -275,4 +284,9 @@
         return vm;
     }
 
+    private void mockOsRepository() {
+        OsRepository mockOsRepository = control.createMock(OsRepository.class);
+        expect(mockOsRepository.getUniqueOsNames()).andReturn(new 
HashMap<Integer, String>()).anyTimes();
+        SimpleDependecyInjector.getInstance().bind(OsRepository.class, 
mockOsRepository);
+    }
 }


-- 
To view, visit http://gerrit.ovirt.org/28811
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ifd084c11ac6d1947e94490125431460916d5a294
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Moti Asayag <masa...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to