diff options
author | 2022-09-27 14:05:58 -0400 | |
---|---|---|
committer | 2022-09-27 15:04:41 -0400 | |
commit | 63d6a20970b8b37506141a2529fe5f3e8deaa3a1 (patch) | |
tree | 79c41453bfd8fe9d52b7878844249b8f82c01864 /components/slice-analysis-ms/src/test/java/org/onap/slice/analysis | |
parent | f747a433bc166881619f0253f6f12730b87caeea (diff) |
[SLICEANALYSIS] Bugfix for sliceanalysis startup Exception, break the circular dependency1.1.5-slice-analysis-ms
Break the circular dependency by seperating networkpolicymonitor from bandwidthEvaluator
Issue-ID: DCAEGEN2-3270
Signed-off-by: decheng zhang <decheng.zhang@huawei.com>
Change-Id: I2632e5ea500121b8c223bdbcda16bdc24dc36895
Signed-off-by: decheng zhang <decheng.zhang@huawei.com>
Diffstat (limited to 'components/slice-analysis-ms/src/test/java/org/onap/slice/analysis')
-rw-r--r-- | components/slice-analysis-ms/src/test/java/org/onap/slice/analysis/ms/service/ccvpn/NetworkPolicyMonitorTest.java | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/components/slice-analysis-ms/src/test/java/org/onap/slice/analysis/ms/service/ccvpn/NetworkPolicyMonitorTest.java b/components/slice-analysis-ms/src/test/java/org/onap/slice/analysis/ms/service/ccvpn/NetworkPolicyMonitorTest.java new file mode 100644 index 00000000..23366ab9 --- /dev/null +++ b/components/slice-analysis-ms/src/test/java/org/onap/slice/analysis/ms/service/ccvpn/NetworkPolicyMonitorTest.java @@ -0,0 +1,51 @@ +/******************************************************************************* + * ============LICENSE_START======================================================= + * slice-analysis-ms + * ================================================================================ + * Copyright (C) 2022 Huawei Canada Limited. + * ============================================================================== + * 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. + * ============LICENSE_END========================================================= + * + *******************************************************************************/ + +package org.onap.slice.analysis.ms.service.ccvpn; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.InjectMocks; +import org.mockito.Mockito; +import org.mockito.Spy; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = BandwidthEvaluatorTest.class) +public class NetworkPolicyMonitorTest { + + @Spy + @InjectMocks + NetworkPolicyMonitor NetworkPolicyMonitor; + @Test + public void initTest() { + NetworkPolicyMonitor.init(); + Mockito.verify(NetworkPolicyMonitor, Mockito.atLeastOnce()).init(); + } + + @Test + public void postTest() { + Event evt = new SimpleEvent(null, "{}"); + NetworkPolicyMonitor.post(evt); + Mockito.verify(NetworkPolicyMonitor, Mockito.atLeastOnce()).post(Mockito.any(Event.class)); + } +} |