msb protocol synch change
[msb/apigateway.git] / msb-core / apiroute / apiroute-service / src / test / java / org / openo / msb / wrapper / util / RouteUtilTest.java
1 /**
2  * Copyright 2016 ZTE Corporation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 package org.openo.msb.wrapper.util;
17
18 import org.apache.commons.lang3.StringUtils;
19 import org.junit.Assert;
20 import org.junit.Test;
21
22 public class RouteUtilTest {
23     
24     @Test
25     public void testGetPrefixedKey(){
26         String path=RouteUtil.getPrefixedKey("","test","v1");
27         Assert.assertEquals("msb:routing:test:v1",path);
28     }
29     
30     @Test
31     public void testConcat(){
32         Object[] str1=new String[]{"test1","test2"}; 
33         Object[] str2=new String[]{"test3"}; 
34         Object[] str3=RouteUtil.concat(str1, str2);
35         
36         Assert.assertEquals(3,str3.length);
37     }
38     
39     @Test
40     public void testContainStr(){
41         String value="1";
42         String array[]={"1","2"};
43         boolean result=RouteUtil.contain(array, value);
44         Assert.assertTrue(result);
45     }
46     
47     @Test
48     public void testContainArray(){
49         String value[]={"0"};
50         String array[]={"1","2"};
51         boolean result=RouteUtil.contain(array, value);
52         Assert.assertFalse(result);
53         
54     }
55     
56     @Test
57     public void testShow(){
58         String array[]={"1","2"};
59         String result=RouteUtil.show(array);
60         Assert.assertEquals("1|2",result);
61         
62     }
63
64 }