diff options
author | waqas.ikram <waqas.ikram@est.tech> | 2019-08-01 16:19:31 +0000 |
---|---|---|
committer | Waqas Ikram <waqas.ikram@est.tech> | 2019-08-01 16:19:56 +0000 |
commit | 24805416f0502a1e06bf57fd15c27d56150f3b30 (patch) | |
tree | 47aab67e683b737431ead4d0f56189683a7f947e /plans/so/integration-etsi-testing/so-simulators/sdnc-simulator/src/test | |
parent | 0e44dde07934e744d3cce3b5d29b1f7d7b879545 (diff) |
Adding infrastructure for sdnc simulator
- Changing package names as csit jenkins jobs are trigger based on
component names defined in file path
Change-Id: Ib8b75ce11185c37bed0d8f4e3918b6660cf24ec8
Issue-ID: SO-1950
Signed-off-by: waqas.ikram <waqas.ikram@est.tech>
Diffstat (limited to 'plans/so/integration-etsi-testing/so-simulators/sdnc-simulator/src/test')
-rw-r--r-- | plans/so/integration-etsi-testing/so-simulators/sdnc-simulator/src/test/java/org/onap/so/sdncsimulator/controller/SdncSimulatorControllerTest.java | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/plans/so/integration-etsi-testing/so-simulators/sdnc-simulator/src/test/java/org/onap/so/sdncsimulator/controller/SdncSimulatorControllerTest.java b/plans/so/integration-etsi-testing/so-simulators/sdnc-simulator/src/test/java/org/onap/so/sdncsimulator/controller/SdncSimulatorControllerTest.java new file mode 100644 index 00000000..b5d6dc0d --- /dev/null +++ b/plans/so/integration-etsi-testing/so-simulators/sdnc-simulator/src/test/java/org/onap/so/sdncsimulator/controller/SdncSimulatorControllerTest.java @@ -0,0 +1,60 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2019 Nordix Foundation. + * ================================================================================ + * 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. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ +package org.onap.so.sdncsimulator.controller; + +import static org.junit.Assert.assertEquals; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.onap.so.sdncsimulator.utils.Constants; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; +import org.springframework.boot.test.web.client.TestRestTemplate; +import org.springframework.boot.web.server.LocalServerPort; +import org.springframework.context.annotation.Configuration; +import org.springframework.http.ResponseEntity; +import org.springframework.test.context.ActiveProfiles; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; + +/** + * @author Waqas Ikram (waqas.ikram@est.tech) + * + */ +@RunWith(SpringJUnit4ClassRunner.class) +@ActiveProfiles("test") +@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT) +@Configuration +public class SdncSimulatorControllerTest { + + @LocalServerPort + private int port; + + @Autowired + private TestRestTemplate restTemplate; + + @Test + public void test_healthCheck_matchContent() { + final String url = "http://localhost:" + port + Constants.BASE_URL + "/healthcheck"; + final ResponseEntity<String> object = restTemplate.getForEntity(url, String.class); + + assertEquals(Constants.HEALTHY, object.getBody()); + + } +} |