* ============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;
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 {
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() {
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
assertThat(sampleRestObj.getStatusCode()).isEqualTo(expectedStatusCode);
assertThat(parsedResult).isInstanceOf(String.class).isEqualTo(expectedResponse);
- assertThat(sampleRestObj.getUUID()).isNull();
}