import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
-import org.openecomp.sdc.common.utils.SdcCommon;
import org.openecomp.sdc.vendorsoftwareproduct.dao.ComponentDao;
import org.openecomp.sdc.vendorsoftwareproduct.dao.ComputeDao;
import org.openecomp.sdc.vendorsoftwareproduct.dao.ImageDao;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.Collection;
-import java.util.HashMap;
-import java.util.Map;
import static org.mockito.Matchers.anyObject;
import static org.mockito.Mockito.doNothing;
private static final String DUMMY_COMPONENT_ID = "2495ef442f964cbfb00d82bd54292f89";
private static final String DUMMY_COMPUTE_ID = "3495ef442f964cbfb00d82bd54292f89";
private static final String DUMMY_IMAGE_ID = "4495ef442f964cbfb00d82bd54292f89";
- private static Map<String, Object> healingParams = new HashMap<>();
private static final String componentQuestionnaireData = "{\"compute\": {" +
"\"guestOS\": {\"bitSize\": 64},\"vmSizing\": {\"IOOperationsPerSec\": \"0\"}," +
"\"numOfVMs\": {\"CpuOverSubscriptionRatio\": \"1:1\",\"MemoryRAM\": \"2 GB\"}}," +
@Before
public void init() throws Exception {
MockitoAnnotations.initMocks(ComponentQuestionnaireHealerTest.this);
-
- healingParams.put(SdcCommon.VSP_ID, DUMMY_VSP_ID);
- healingParams.put(SdcCommon.VERSION, VERSION);
}
@Test
public void healQuestionnaireNullTest() throws Exception {
prepareHealingData();
componentEntity.setQuestionnaireData(null);
- Object returnObject = componentQuestionnaireHealer.heal(healingParams);
+ Object returnObject = componentQuestionnaireHealer.heal(DUMMY_VSP_ID, VERSION);
Assert.assertTrue(returnObject instanceof Collection);
Collection<ComponentEntity> componentEntities = (Collection<ComponentEntity>) returnObject;
componentEntities.forEach(componentEntity -> {
public void healAllCasesTest() throws Exception {
prepareHealingData();
- Object returnObject = componentQuestionnaireHealer.heal(healingParams);
+ Object returnObject = componentQuestionnaireHealer.heal(DUMMY_VSP_ID, VERSION);
Assert.assertTrue(returnObject instanceof Collection);
Collection<ComponentEntity> componentEntities = (Collection<ComponentEntity>) returnObject;
componentEntities.forEach(componentEntity -> {
public void healDiskAttrMissingTest() throws Exception {
prepareHealingData();
componentEntity.setQuestionnaireData(componentQuestionnaireMissingDiskAttrData);
- Object returnObject = componentQuestionnaireHealer.heal(healingParams);
+ Object returnObject = componentQuestionnaireHealer.heal(DUMMY_VSP_ID, VERSION);
Assert.assertTrue(returnObject instanceof Collection);
Collection<ComponentEntity> componentEntities = (Collection<ComponentEntity>) returnObject;
componentEntities.forEach(componentEntity -> {
.getDeclaredMethod(methodName, JsonObject.class, JsonObject.class);
method.setAccessible(true);
- method.invoke(componentQuestionnaireHealer,jsonObject.getAsJsonObject(COMPUTE), null);
+ method.invoke(componentQuestionnaireHealer, jsonObject.getAsJsonObject(COMPUTE), null);
}
private void prepareHealingData() {