2 * ============LICENSE_START=======================================================
3 * Copyright (C) 2025 Nordix Foundation
4 * ================================================================================
5 * Licensed under the Apache License, Version 2.0 (the 'License');
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an 'AS IS' BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
17 * SPDX-License-Identifier: Apache-2.0
18 * ============LICENSE_END=========================================================
21 package org.onap.cps.integration.performance.ncmp
23 import org.onap.cps.integration.ResourceMeter
24 import org.onap.cps.integration.base.CpsIntegrationSpecBase
25 import org.onap.cps.ncmp.api.datajobs.DataJobService
26 import org.onap.cps.ncmp.api.datajobs.models.DataJobMetadata
27 import org.onap.cps.ncmp.api.datajobs.models.DataJobWriteRequest
28 import org.onap.cps.ncmp.api.datajobs.models.WriteOperation
29 import org.springframework.beans.factory.annotation.Autowired
30 import spock.lang.Ignore
33 * This test does not depend on common performance test data. Hence it just extends the integration spec base.
35 class WriteDataJobPerfTest extends CpsIntegrationSpecBase {
38 DataJobService dataJobService
40 def resourceMeter = new ResourceMeter()
42 def populateDataJobWriteRequests(int numberOfWriteOperations) {
43 def writeOperations = []
44 for (int i = 1; i <= numberOfWriteOperations; i++) {
45 def basePath = "/SubNetwork=Europe/SubNetwork=Ireland/MeContext=MyRadioNode${i}/ManagedElement=MyManagedElement${i}"
46 writeOperations.add(new WriteOperation("${basePath}/SomeChild=child-1", 'operation1', '1', null))
47 writeOperations.add(new WriteOperation("${basePath}/SomeChild=child-2", 'operation2', '2', null))
48 writeOperations.add(new WriteOperation(basePath, 'operation3', '3', null))
50 return new DataJobWriteRequest(writeOperations)
54 def 'Performance test for writeDataJob method'() {
55 given: 'register 10_000 cm handles (with alternative ids)'
56 registerSequenceOfCmHandlesWithManyModuleReferencesButDoNotWaitForReady(DMI1_URL, 'tagA', 10_000, 1, ModuleNameStrategy.UNIQUE, { it -> "/SubNetwork=Europe/SubNetwork=Ireland/MeContext=MyRadioNode${it}/ManagedElement=MyManagedElement${it}" })
57 def dataJobWriteRequest = populateDataJobWriteRequests(10_000)
58 when: 'sending a write job to NCMP with dynamically generated write operations'
60 dataJobService.writeDataJob('', '', new DataJobMetadata('d1', '', ''), dataJobWriteRequest)
62 then: 'record the result. Not asserted, just recorded in See https://lf-onap.atlassian.net/browse/CPS-2691'
63 println "*** CPS-2691 Execution time: ${resourceMeter.totalTimeInSeconds} seconds"
64 cleanup: 'deregister test cm handles'
65 deregisterSequenceOfCmHandles(DMI1_URL, 10_000, 1)