classes().that().resideInAPackage("org.onap.cps.ncmp.rest..").should().onlyHaveDependentClassesThat()
.resideInAPackage("org.onap.cps.ncmp.rest..");
+ @ArchTest
+ static final ArchRule nothingDependsOnTestCpsNcmpRest =
+ classes().that().resideInAPackage("org.onap.cps.ncmp.testapi..").should().onlyHaveDependentClassesThat()
+ .resideInAPackage("org.onap.cps.ncmp.testapi..")
+ .allowEmptyShould(true);
+
@ArchTest
static final ArchRule ncmpRestControllerShouldOnlyDependOnNcmpService =
classes().that().resideInAPackage("org.onap.cps.ncmp.rest..")
@SpringBean
NcmpPassthroughResourceRequestHandler StubbedNcmpPassthroughResourceRequestHandler = Stub()
- @SpringBean
- DataJobControllerForTest stubbedDataJobControllerForTest = Stub()
-
@SpringBean
RestOutputCmHandleMapper mockRestOutputCmHandleMapper = Mock()
+++ /dev/null
-/*
- * ============LICENSE_START=======================================================
- * Copyright (C) 2025 OpenInfra Foundation Europe. 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.
- * 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.ncmp.api.datajobs.models
-
-import spock.lang.Specification
-
-class DataJobRequestSpec extends Specification {
-
- def dataJobMetaData = new DataJobMetadata('some destination', 'some accept type', 'some content type')
- def writeOperation = new WriteOperation('some path', 'some operation', 'some id', 'some value')
- def dataJobWriteRequest = new DataJobWriteRequest([writeOperation])
-
- def objectUnderTest = new DataJobRequest(dataJobMetaData, dataJobWriteRequest)
-
- //TODO This class is only used for a test Controller. Maybe it can be removed, see https://lf-onap.atlassian.net/browse/CPS-3062
- def 'a Data Job Request.'() {
- expect: 'a data job request consisting out of meta data and a write request'
- assert objectUnderTest.dataJobMetadata == dataJobMetaData
- assert objectUnderTest.dataJobWriteRequest == dataJobWriteRequest
- }
-}
<artifactId>cps-ncmp-rest</artifactId>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>test-dcm-rest</artifactId>
+ <version>${project.version}</version>
+ <scope>test</scope>
+ </dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>cps-ri</artifactId>
<artifactId>policy-executor-stub</artifactId>
<version>${project.version}</version>
</dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>test-dcm-rest</artifactId>
+ <version>${project.version}</version>
+ </dependency>
</dependencies>
<module>cps-application</module>\r
<module>jacoco-report</module>\r
<module>policy-executor-stub</module>\r
+ <module>test-dcm-rest</module>\r
</modules>\r
\r
<distributionManagement>\r
--- /dev/null
+# Test DCM REST Module
+
+## Purpose
+
+This module contains REST controllers and models used exclusively for testing and performance measurement purposes.
+
+## Contents
+
+- `DataJobControllerForTest`: A REST controller that exposes an internal test endpoint for data job write operations
+- `DataJobRequest`: A request model used by the test controller
+
+## Important Notes
+
+- This module should ONLY be used in test/development environments
+- The endpoint is marked with `@Hidden` to exclude it from production API documentation
+- The endpoint path `/do-not-use/dataJobs` clearly indicates its test-only nature
+- No production module should depend on this module (enforced by architecture tests)
+
+## Architecture
+
+This module depends on:
+- `cps-ncmp-service` (for DataJobService and related models)
+- Spring Boot Web (for REST controller support)
+
+No other module should depend on `test-dcm-rest`.
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ============LICENSE_START=======================================================
+ Copyright (C) 2026 OpenInfra Foundation Europe. 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.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+ SPDX-License-Identifier: Apache-2.0
+ ============LICENSE_END=========================================================
+-->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.onap.cps</groupId>
+ <artifactId>cps-parent</artifactId>
+ <version>3.7.7-SNAPSHOT</version>
+ <relativePath>../cps-parent/pom.xml</relativePath>
+ </parent>
+
+ <artifactId>test-dcm-rest</artifactId>
+
+ <dependencies>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>cps-ncmp-service</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-web</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>io.swagger.core.v3</groupId>
+ <artifactId>swagger-annotations</artifactId>
+ </dependency>
+ <!-- T E S T D E P E N D E N C I E S -->
+ <dependency>
+ <groupId>org.codehaus.groovy</groupId>
+ <artifactId>groovy</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.spockframework</groupId>
+ <artifactId>spock-core</artifactId>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+</project>
/*
* ============LICENSE_START=======================================================
- * Copyright (C) 2025 OpenInfra Foundation Europe. All rights reserved.
+ * Copyright (C) 2025-2026 OpenInfra Foundation Europe. 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.
* ============LICENSE_END=========================================================
*/
-package org.onap.cps.ncmp.rest.controller;
+package org.onap.cps.ncmp.testapi.controller;
import io.swagger.v3.oas.annotations.Hidden;
import java.util.List;
import lombok.extern.slf4j.Slf4j;
import org.onap.cps.ncmp.api.datajobs.DataJobService;
import org.onap.cps.ncmp.api.datajobs.models.DataJobMetadata;
-import org.onap.cps.ncmp.api.datajobs.models.DataJobRequest;
import org.onap.cps.ncmp.api.datajobs.models.DataJobWriteRequest;
import org.onap.cps.ncmp.api.datajobs.models.SubJobWriteResponse;
+import org.onap.cps.ncmp.testapi.controller.models.DataJobRequest;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
return ResponseEntity.ok(subJobWriteResponses);
}
}
-
/*
* ============LICENSE_START=======================================================
- * Copyright (C) 2025 OpenInfra Foundation Europe. All rights reserved.
+ * Copyright (C) 2025-2026 OpenInfra Foundation Europe. 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.
* ============LICENSE_END=========================================================
*/
-package org.onap.cps.ncmp.api.datajobs.models;
+package org.onap.cps.ncmp.testapi.controller.models;
+
+import org.onap.cps.ncmp.api.datajobs.models.DataJobMetadata;
+import org.onap.cps.ncmp.api.datajobs.models.DataJobWriteRequest;
public record DataJobRequest(DataJobMetadata dataJobMetadata, DataJobWriteRequest dataJobWriteRequest) {
}
/*
* ============LICENSE_START=======================================================
- * Copyright (C) 2025 OpenInfra Foundation Europe. All rights reserved.
+ * Copyright (C) 2025-2026 OpenInfra Foundation Europe. 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.
* ============LICENSE_END=========================================================
*/
-package org.onap.cps.ncmp.rest.controller
+package org.onap.cps.ncmp.testapi.controller
import org.onap.cps.ncmp.api.datajobs.DataJobService
import org.onap.cps.ncmp.api.datajobs.models.DataJobMetadata
-import org.onap.cps.ncmp.api.datajobs.models.DataJobRequest
import org.onap.cps.ncmp.api.datajobs.models.DataJobWriteRequest
import org.onap.cps.ncmp.api.datajobs.models.WriteOperation
+import org.onap.cps.ncmp.testapi.controller.models.DataJobRequest
import org.springframework.http.HttpStatus
import spock.lang.Specification