added svcapi ui and camunda code
[it/otf.git] / otf-service-api / src / test / java / org / oran / otf / api / tests / integration / services / OtfOpenRouteIT.java
1 /*  Copyright (c) 2019 AT&T Intellectual Property.                             #\r
2 #                                                                              #\r
3 #   Licensed under the Apache License, Version 2.0 (the "License");            #\r
4 #   you may not use this file except in compliance with the License.           #\r
5 #   You may obtain a copy of the License at                                    #\r
6 #                                                                              #\r
7 #       http://www.apache.org/licenses/LICENSE-2.0                             #\r
8 #                                                                              #\r
9 #   Unless required by applicable law or agreed to in writing, software        #\r
10 #   distributed under the License is distributed on an "AS IS" BASIS,          #\r
11 #   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   #\r
12 #   See the License for the specific language governing permissions and        #\r
13 #   limitations under the License.                                             #\r
14 ##############################################################################*/\r
15 \r
16 \r
17 package org.oran.otf.api.tests.integration.services;\r
18 \r
19 import org.oran.otf.api.Application;\r
20 import org.oran.otf.api.tests.shared.MemoryDatabase;\r
21 import io.restassured.RestAssured;\r
22 import org.junit.AfterClass;\r
23 import org.junit.Before;\r
24 import org.junit.BeforeClass;\r
25 import org.junit.Ignore;\r
26 import org.junit.Test;\r
27 import org.junit.runner.RunWith;\r
28 import org.springframework.boot.test.context.SpringBootTest;\r
29 import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;\r
30 import org.springframework.boot.web.server.LocalServerPort;\r
31 import org.springframework.test.context.ActiveProfiles;\r
32 import org.springframework.test.context.TestPropertySource;\r
33 import org.springframework.test.context.junit4.SpringRunner;\r
34 \r
35 @RunWith(SpringRunner.class)\r
36 @SpringBootTest(\r
37     webEnvironment = WebEnvironment.RANDOM_PORT,\r
38     classes = {Application.class}\r
39 )\r
40 @TestPropertySource("classpath:application-test.properties")\r
41 @ActiveProfiles("test")\r
42 public class OtfOpenRouteIT {\r
43   @LocalServerPort\r
44   private int port;\r
45 \r
46   @BeforeClass\r
47   public static void setup() throws Exception{\r
48     MemoryDatabase.setup();\r
49   }\r
50   @AfterClass\r
51   public static void cleanup(){\r
52     MemoryDatabase.cleanup();\r
53   }\r
54   @Before\r
55   public void setupRestAssured(){\r
56     RestAssured.port =port;\r
57     RestAssured.urlEncodingEnabled = false;\r
58     RestAssured.baseURI="https://localhost";\r
59     RestAssured.basePath="/otf/api";\r
60     RestAssured.useRelaxedHTTPSValidation();\r
61   }\r
62   @Ignore("Ignoring test because it fails since it tries to request to specific port, uncomment to view error")\r
63   @Test\r
64   public void testOtfOpenRouteRespondsWith200(){\r
65     RestAssured.given().log().all().header("Accept", "application/json").get("/demo/openapi.json").then().statusCode(200);\r
66   }\r
67 }\r