2 * Copyright 2016-2017 ZTE, Inc. and others.
4 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
5 * in compliance with the License. You may obtain a copy of the License at
7 * http://www.apache.org/licenses/LICENSE-2.0
9 * Unless required by applicable law or agreed to in writing, software distributed under the License
10 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
11 * or implied. See the License for the specific language governing permissions and limitations under
15 package org.onap.msb.sdk.discovery.util;
17 import org.junit.Assert;
18 import org.junit.Test;
22 public class RegExpTestUtilTest {
25 public void testhostRegExpTest() {
26 Assert.assertTrue(RegExpTestUtil.hostRegExpTest("127.0.0.1:8080"));
28 Assert.assertFalse(RegExpTestUtil.hostRegExpTest("0.0.0.1:89"));
32 public void testipRegExpTest() {
34 Assert.assertTrue(RegExpTestUtil.ipRegExpTest("10.74.151.26"));
36 Assert.assertFalse(RegExpTestUtil.ipRegExpTest("0.74.0.26"));
40 public void testportRegExpTest() {
41 Assert.assertTrue(RegExpTestUtil.portRegExpTest("8989"));
42 Assert.assertFalse(RegExpTestUtil.portRegExpTest("99999"));
46 public void testversionRegExpTest() {
48 Assert.assertTrue(RegExpTestUtil.versionRegExpTest("v1"));
50 Assert.assertFalse(RegExpTestUtil.versionRegExpTest("vv2"));
54 public void testurlRegExpTest() {
56 Assert.assertTrue(RegExpTestUtil.urlRegExpTest("/test/v1"));
58 Assert.assertTrue(RegExpTestUtil.urlRegExpTest("/"));
60 Assert.assertFalse(RegExpTestUtil.urlRegExpTest("test/#?qwe"));
64 public void testserviceNameRegExpTest() {
66 Assert.assertTrue(RegExpTestUtil.serviceNameRegExpTest("servive_1"));
69 Assert.assertFalse(RegExpTestUtil.serviceNameRegExpTest("servive%_1"));