summaryrefslogtreecommitdiffstats
path: root/cps-ncmp-service/src
diff options
context:
space:
mode:
authorleventecsanyi <levente.csanyi@est.tech>2023-11-24 11:40:19 +0100
committerleventecsanyi <levente.csanyi@est.tech>2023-11-24 14:55:48 +0100
commit605e2ad3d0e612a020d1a3236765e27154132afb (patch)
tree39bc748db8cea1dd6fb969f69768f51d157804a0 /cps-ncmp-service/src
parent13b8698611fcf3da3629d67360ba84d48f6049d7 (diff)
Fix @Ignore test
- removed EventPublisherSpec - fixed toDataStores test Issue-ID: CPS-1874 Signed-off-by: leventecsanyi <levente.csanyi@est.tech> Change-Id: I857c7bcb0aa52604da6692545456769a4ec151ec
Diffstat (limited to 'cps-ncmp-service/src')
-rw-r--r--cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/events/EventPublisherSpec.groovy89
1 files changed, 0 insertions, 89 deletions
diff --git a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/events/EventPublisherSpec.groovy b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/events/EventPublisherSpec.groovy
deleted file mode 100644
index 0e063834e4..0000000000
--- a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/events/EventPublisherSpec.groovy
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * ============LICENSE_START========================================================
- * Copyright (c) 2023 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.ncmp.api.impl.events
-
-import ch.qos.logback.classic.Level
-import ch.qos.logback.classic.Logger
-import ch.qos.logback.core.read.ListAppender
-import org.apache.kafka.clients.producer.ProducerRecord
-import org.apache.kafka.clients.producer.RecordMetadata
-import org.apache.kafka.common.TopicPartition
-import org.onap.cps.ncmp.init.CmDataSubscriptionModelLoader
-import org.slf4j.LoggerFactory
-import org.springframework.kafka.support.SendResult
-import spock.lang.Ignore
-import spock.lang.Specification
-
-class EventPublisherSpec extends Specification {
-
- def objectUnderTest = new EventsPublisher(null, null)
- def logger = (Logger) LoggerFactory.getLogger(objectUnderTest.getClass())
- def loggingListAppender
-
- void setup() {
- logger.setLevel(Level.DEBUG)
- loggingListAppender = new ListAppender()
- logger.addAppender(loggingListAppender)
- loggingListAppender.start()
- }
-
- void cleanup() {
- ((Logger) LoggerFactory.getLogger(CmDataSubscriptionModelLoader.class)).detachAndStopAllAppenders()
- }
-
- @Ignore
- def 'Callback handling on success.'() {
- given: 'a send result'
- def producerRecord = new ProducerRecord('topic-1', 'my value')
- def topicPartition = new TopicPartition('topic-2', 0)
- def recordMetadata = new RecordMetadata(topicPartition, 0, 0, 0, 0, 0)
- def sendResult = new SendResult(producerRecord, recordMetadata)
- when: 'the callback handler processes success'
- def callbackHandler = objectUnderTest.handleCallback('topic-3')
- callbackHandler.onSuccess(sendResult)
- then: 'an event is logged with level DEBUG'
- def loggingEvent = getLoggingEvent()
- loggingEvent.level == Level.DEBUG
- and: 'it contains the topic (from the record metadata) and the "value" (from the producer record)'
- loggingEvent.formattedMessage.contains('topic-2')
- loggingEvent.formattedMessage.contains('my value')
- }
-
-
- @Ignore
- def 'Callback handling on failure.'() {
- when: 'the callback handler processes a failure'
- def callbackHandler = objectUnderTest.handleCallback('my topic')
- callbackHandler.onFailure(new Exception('my exception'))
- then: 'an event is logged with level ERROR'
- def loggingEvent = getLoggingEvent()
- loggingEvent.level == Level.ERROR
- and: 'it contains the topic and exception message'
- loggingEvent.formattedMessage.contains('my topic')
- loggingEvent.formattedMessage.contains('my exception')
- }
-
- def getLoggingEvent() {
- return loggingListAppender.list[0]
- }
-
-
-}
6699; font-weight: bold } /* Name.Property */ .highlight .nt { color: #bb0066; font-weight: bold } /* Name.Tag */ .highlight .nv { color: #336699 } /* Name.Variable */ .highlight .ow { color: #008800 } /* Operator.Word */ .highlight .w { color: #bbbbbb } /* Text.Whitespace */ .highlight .mb { color: #0000DD; font-weight: bold } /* Literal.Number.Bin */ .highlight .mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */ .highlight .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */ .highlight .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */ .highlight .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */ .highlight .sa { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Affix */ .highlight .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */ .highlight .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */ .highlight .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */ .highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */ .highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */ .highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ .highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ .highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ .highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */ }
% enum CUST_TYPES = { STANDARD, SILVER, GOLD };
% enum ATTRIBUTES = { CORE_DC, DIRECT_CONN, MIN_GUARANTEE, SRIOV };
% enum METRICS = { AVG_CPU_UTILIZATION, PEAK_CPU_UTILIZATION };
% enum CLOUD_REGION_CAPACITY = {CPU_CLOUD, MEMORY_CLOUD};

NCR = 8;  % e-dc-1,2,3,4,5 core-dc-6,7,8
N_ATTR = 4;
N_UTILIZATION_METRICS = 2;
N_CAPM = 2;
N_VMS = 3;
C_ALLOC_THRESHOLD = 0.65;
CUST_ALLOC_THRESHOLD = 0.95;
AVG_CPU_UTILIZATION_THRESHOLD = 0.7;
PEAK_CPU_UTILIZATION_THRESHOLD = 0.95;

cust_type = GOLD;
N_WL = 5;
MIN_GUAR_ADDL_WT = 1000;

u_lat = 3;
u_lon = 3;
cr_lat = [0, 1, 2, 3, 4, 100, 100, 100];
cr_lon = [0, 1, 2, 3, 4, 100, 100, 100];
dist_norm = 1000.0;
max_dist_ue = 3.0;

% enum ATTRIBUTES = { CORE_DC, DIRECT_CONN, MIN_GUARANTEE, SRIOV };
w_attr = [0.1, 0.7, 0.1, 0.1]; 
capabilities = [| 0, 1, 0, 1    % edge dc 1
                | 0, 1, 1, 1    % edge dc 2
                | 0, 1, 0, 0    % edge dc 3
                | 0, 1, 0, 1    % edge dc 4
                | 0, 1, 0, 1    % edge dc 5
                | 1, 0, 1, 0    % core dc 6
                | 1, 0, 0, 0    % core dc 7
                | 1, 0, 0, 0 |];% core dc 8

% enum METRICS = { AVG_CPU_UTILIZATION, PEAK_CPU_UTILIZATION };
w_metrics       = [0.9,  0.1];
cpu_utilization = [| 0.1,  0.5
                   | 0.1,  0.5
                   | 0.1,  0.5
                   | 0.1,  0.5
                   | 0.1,  0.5
                   | 0.6,  0.8
                   | 0.6,  0.8
                   | 0.6,  0.8 |];

c_alloc_capacity = [| 600,  1200
                    | 600,  1200
                    | 600,  1200
                    | 600,  1200
                    | 600,  1200
                    | 2400, 4800
                    | 2400, 4800
                    | 2400, 4800 |];

c_total_capacity = [| 1000, 2000
                    | 1000, 2000
                    | 1000, 2000
                    | 1000, 2000
                    | 1000, 2000
                    | 4000, 8000
                    | 4000, 8000
                    | 4000, 8000 |];

c_alloc_capacity_norm = [| 0.6, 0.6
                         | 0.6, 0.6
                         | 0.6, 0.6
                         | 0.6, 0.6
                         | 0.6, 0.6
                         | 0.6, 0.6
                         | 0.6, 0.6
                         | 0.6, 0.6 |];

cust_alloc_capacity = [| 60, 120
                       | 60, 120
                       | 60, 120
                       | 60, 120
                       | 60, 120
                       | 240, 480
                       | 240, 480
                       | 240, 480 |];

cust_total_capacity = [| 100, 200
                       | 100, 200
                       | 100, 200
                       | 100, 200
                       | 100, 200
                       | 400, 800
                       | 400, 800
                       | 400, 800 |];

cust_alloc_capacity_norm = [| 0.6, 0.6
                            | 0.6, 0.6
                            | 0.6, 0.6
                            | 0.6, 0.6
                            | 0.6, 0.6
                            | 0.6, 0.6
                            | 0.6, 0.6
                            | 0.6, 0.6 |];

vm_reqs = [| 1, 4
           | 2, 8
           | 4, 16 |];

%vm_reqs_sums = [ 14, 56 ];

vm_reqs_sums_norm = [| 0.007, 0.014
                     | 0.007, 0.014
                     | 0.007, 0.014
                     | 0.007, 0.014
                     | 0.007, 0.014
                     | 0.00175, 0.0035
                     | 0.00175, 0.0035
                     | 0.00175, 0.0035 |];