diff options
author | leventecsanyi <levente.csanyi@est.tech> | 2024-06-21 10:50:06 +0200 |
---|---|---|
committer | Levente Csanyi <levente.csanyi@est.tech> | 2024-07-25 09:40:23 +0000 |
commit | b33ea92a29a2724750554ebb412cf841fbe8c2a8 (patch) | |
tree | 7e41b2a211eb3166ff6429572b77ae853f44ad1a /integration-test/src/test/java | |
parent | d3c3d49849ce81b82ec1e5c40b885ee08c368b09 (diff) |
Integration test for the writeDataJob
- added Stub controller
- created integration test for writeDataJob
Issue-ID: CPS-2236
Change-Id: I067a11dc5bfe629d50128cf303b2a81abc75a348
Signed-off-by: leventecsanyi <levente.csanyi@est.tech>
Diffstat (limited to 'integration-test/src/test/java')
-rw-r--r-- | integration-test/src/test/java/org/onap/cps/integration/DmiStubTestContainer.java | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/integration-test/src/test/java/org/onap/cps/integration/DmiStubTestContainer.java b/integration-test/src/test/java/org/onap/cps/integration/DmiStubTestContainer.java new file mode 100644 index 0000000000..1bffb35c14 --- /dev/null +++ b/integration-test/src/test/java/org/onap/cps/integration/DmiStubTestContainer.java @@ -0,0 +1,61 @@ +/* + * ============LICENSE_START======================================================= + * Copyright (C) 2024 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.cps.integration; + +import org.testcontainers.containers.GenericContainer; +import org.testcontainers.utility.DockerImageName; + +public class DmiStubTestContainer extends GenericContainer<DmiStubTestContainer> { + + public static final String IMAGE_NAME_AND_VERSION = + "nexus3.onap.org:10003/onap/dmi-plugin-demo-and-csit-stub:latest"; + public static final String DMI_STUB_URL = "http://localhost:8784"; + + private static DmiStubTestContainer dmiStubTestContainer; + + private DmiStubTestContainer() { + super(DockerImageName.parse(IMAGE_NAME_AND_VERSION)); + } + + /** + * Provides an instance of the Dmi Plugin Stub test container wrapper. + * This will allow to interact with the DMI Stub in our acceptance tests. + * + * @return DmiStubTestContainer + */ + public static DmiStubTestContainer getInstance() { + if (dmiStubTestContainer == null) { + dmiStubTestContainer = new DmiStubTestContainer(); + dmiStubTestContainer.addFixedExposedPort(8784, 8092); + Runtime.getRuntime().addShutdownHook(new Thread(dmiStubTestContainer::close)); + } + return dmiStubTestContainer; + } + + @Override + public void start() { + super.start(); + } + + @Override + public void stop() { + // Method intentionally left blank + } +} |