identify macro services without instantiation type in BE by feature flag
[vid.git] / vid-app-common / src / test / java / org / onap / vid / scheduler / SchedulerRestInterfaceTest.java
index 0655aca..8765f02 100644 (file)
@@ -2,14 +2,14 @@
  * ============LICENSE_START=======================================================
  * VID
  * ================================================================================
- * Copyright (C) 2018 Nokia Intellectual Property. All rights reserved.
+ * Copyright (C) 2018 - 2019 Nokia Intellectual Property. All rights reserved.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- *
+ * 
  *      http://www.apache.org/licenses/LICENSE-2.0
- *
+ * 
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 
 package org.onap.vid.scheduler;
 
+import static org.assertj.core.api.AssertionsForClassTypes.assertThat;
+import static org.mockito.Mockito.mock;
+
 import com.fasterxml.jackson.core.JsonProcessingException;
 import com.xebialabs.restito.semantics.Action;
+import java.util.HashMap;
+import java.util.Map;
 import org.glassfish.grizzly.http.util.HttpStatus;
 import org.json.simple.parser.JSONParser;
 import org.json.simple.parser.ParseException;
@@ -31,15 +36,11 @@ import org.junit.BeforeClass;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.mockito.junit.MockitoJUnitRunner;
-import org.onap.vid.exceptions.GenericUncheckedException;
+import org.onap.vid.mso.RestObject;
 import org.onap.vid.testUtils.StubServerUtil;
+import org.onap.vid.utils.Logging;
 import org.testng.annotations.AfterMethod;
 
-import java.util.HashMap;
-import java.util.Map;
-
-import static org.assertj.core.api.AssertionsForClassTypes.assertThat;
-
 
 @RunWith(MockitoJUnitRunner.class)
 public class SchedulerRestInterfaceTest {
@@ -57,7 +58,7 @@ public class SchedulerRestInterfaceTest {
         put(SchedulerProperties.SCHEDULER_SERVER_URL_VAL, SAMPLE_SCHEDULER_SERVER_URL);
     }};
     private static StubServerUtil serverUtil;
-    private static SchedulerRestInterface schedulerInterface = new SchedulerRestInterface((key) -> DUMMY_SYSTEM_PROPERTIES.get(key));
+    private static SchedulerRestInterface schedulerInterface = new SchedulerRestInterface((key) -> DUMMY_SYSTEM_PROPERTIES.get(key), mock(Logging.class));
 
     @BeforeClass
     public static void setUpClass() {
@@ -82,19 +83,19 @@ public class SchedulerRestInterfaceTest {
         RestObject<String> sampleRestObj = new RestObject<>();
         serverUtil.prepareGetCall("/test", RESPONSE_CONTENT, Action.ok());
 
-        schedulerInterface.Get("", SAMPLE_SOURCE_ID, "", sampleRestObj);
+        schedulerInterface.Get("", "", sampleRestObj);
 
         assertResponseHasExpectedBodyAndStatus(sampleRestObj, RESPONSE_CONTENT, 200);
     }
 
-    @Test(expected = GenericUncheckedException.class)
+    @Test(expected = org.onap.vid.aai.ExceptionWithRequestInfo.class)
     public void shouldRaiseExceptionWhenErrorOccursDuringGet() throws JsonProcessingException {
         prepareEnvForTest();
         RestObject<String> sampleRestObj = new RestObject<>();
 
         serverUtil.prepareGetCall("/test", ERROR_RESPONSE, Action.status(HttpStatus.INTERNAL_SERVER_ERROR_500));
 
-        schedulerInterface.Get("", SAMPLE_SOURCE_ID, "", sampleRestObj);
+        schedulerInterface.Get("", "", sampleRestObj);
     }
 
     @Test
@@ -125,7 +126,6 @@ public class SchedulerRestInterfaceTest {
 
         assertThat(sampleRestObj.getStatusCode()).isEqualTo(expectedStatusCode);
         assertThat(parsedResult).isInstanceOf(String.class).isEqualTo(expectedResponse);
-        assertThat(sampleRestObj.getUUID()).isNull();
 
     }