diff options
author | MichaelMorris <michael.morris@est.tech> | 2019-03-13 17:24:42 +0000 |
---|---|---|
committer | MichaelMorris <michael.morris@est.tech> | 2019-03-13 17:24:42 +0000 |
commit | 8aeffa0e56e595e46968d62211b4dccdb6c023f5 (patch) | |
tree | 609b12c5a17fbcc6a5375ebd606027b6f70192cb /adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test | |
parent | c1a2f4b9a33f6b2bec77dbfbc6b43663ad9cca1f (diff) |
Create VNFM adapter shell
Create maven structure, spring boot application and docker image for the VNFM adapter. Implementation of functionality will follow in subsequent stories.
Issue-ID: SO-1620
Change-Id: I735ead3f1c34bf33e6813a3741609409b0da851c
Signed-off-by: MichaelMorris <michael.morris@est.tech>
Diffstat (limited to 'adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test')
2 files changed, 74 insertions, 0 deletions
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/HealthCheckTest.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/HealthCheckTest.java new file mode 100644 index 0000000000..ee22e03f87 --- /dev/null +++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/HealthCheckTest.java @@ -0,0 +1,55 @@ +/*- + * ============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.adapters.vnfmadapter.rest; + +import static org.junit.Assert.assertEquals; +import java.net.URI; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.onap.so.adapters.vnfmadapter.VnfmAdapterApplication; +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.http.RequestEntity; +import org.springframework.http.ResponseEntity; +import org.springframework.test.context.ActiveProfiles; +import org.springframework.test.context.junit4.SpringRunner; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = VnfmAdapterApplication.class, webEnvironment = WebEnvironment.RANDOM_PORT) +@ActiveProfiles("test") +public class HealthCheckTest { + + @LocalServerPort + private int port; + + private final TestRestTemplate restTemplate = new TestRestTemplate(); + + @Test + public void testHealthcheck() throws Exception { + final RequestEntity<Void> request = + RequestEntity.get(new URI("http://localhost:" + port + "/manage/health")).build(); + final ResponseEntity<Void> response = restTemplate.exchange(request, Void.class); + assertEquals(200, response.getStatusCode().value()); + } + +} diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/resources/application-test.yaml b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/resources/application-test.yaml new file mode 100644 index 0000000000..cc5a068d69 --- /dev/null +++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/resources/application-test.yaml @@ -0,0 +1,19 @@ +# Copyright © 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. +spring: + security: + usercredentials: + - username: test + password: '$2a$12$Zi3AuYcZoZO/gBQyUtST2.F5N6HqcTtaNci2Et.ufsQhski56srIu' + role: BPEL-Client
\ No newline at end of file |