Catalog alignment
[sdc.git] / common-be / src / test / java / org / openecomp / sdc / be / utils / CommonBeUtilsTest.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * SDC
4  * ================================================================================
5  * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6  * ================================================================================
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  * 
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  * 
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  * ============LICENSE_END=========================================================
19  * Modifications copyright (c) 2019 Nokia
20  * ================================================================================
21  */
22
23 package org.openecomp.sdc.be.utils;
24
25 import org.junit.Test;
26
27 import static org.junit.Assert.assertEquals;
28 import static org.junit.Assert.assertFalse;
29 import static org.junit.Assert.assertTrue;
30
31 public class CommonBeUtilsTest {
32
33         @Test
34         public void testCompareAsdcComponentVersions() {
35                 assertTrue(CommonBeUtils.compareAsdcComponentVersions("1.1", "0.15"));
36                 assertFalse(CommonBeUtils.compareAsdcComponentVersions("0.5", "0.5"));
37                 assertFalse(CommonBeUtils.compareAsdcComponentVersions("0.5", "0.6"));
38                 assertFalse(CommonBeUtils.compareAsdcComponentVersions("1.5", "2.6"));
39                 assertTrue(CommonBeUtils.compareAsdcComponentVersions("0.10", "0.1"));
40                 assertFalse(CommonBeUtils.compareAsdcComponentVersions("1", "1.0"));
41                 assertTrue(CommonBeUtils.compareAsdcComponentVersions("2", "1.15"));
42         }
43         
44         @Test
45         public void testConformanceLevelCompare() {
46                 assertTrue(CommonBeUtils.conformanceLevelCompare("1.1", "0.15") > 0);
47                 assertEquals(0, CommonBeUtils.conformanceLevelCompare("0.5", "0.5"));
48                 assertTrue(CommonBeUtils.conformanceLevelCompare("0.5", "0.6") < 0);
49                 assertTrue(CommonBeUtils.conformanceLevelCompare("1.5", "2.6") < 0);
50                 assertTrue(CommonBeUtils.conformanceLevelCompare("1.5", "1.5.3") < 0);
51                 assertTrue(CommonBeUtils.conformanceLevelCompare("2.5", "1.5.300") > 0);
52                 assertTrue(CommonBeUtils.conformanceLevelCompare("0.10", "0.1") > 0);
53                 assertTrue(CommonBeUtils.conformanceLevelCompare("2", "1.15") > 0);
54         }
55
56         @Test
57         public void testGenerateToscaResourceName(){
58                 assertEquals(CommonBeUtils.generateToscaResourceName("ANY_RESOURCE", "ANY_RESOURCE_SYSTEM_NAME"),
59                         "org.openecomp.resource.any_resource.ANY_RESOURCE_SYSTEM_NAME");
60         }
61 }