Java Code Examples for com.alibaba.dubbo.registry.common.route.ParseUtils#interpolate()

The following examples show how to use com.alibaba.dubbo.registry.common.route.ParseUtils#interpolate() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ParseUtilsTest.java    From dubbo3 with Apache License 2.0 6 votes vote down vote up
@Test
public void testInterpolateCollMap_NormalCase() throws Exception {
    List<String> expressions = new ArrayList<String>();
    expressions.add("xx$var1");
    expressions.add("yy${var2}zz");

    Map<String, String> params = new HashMap<String, String>();
    params.put("var1", "CAT");
    params.put("var2", "DOG");

    List<String> interpolate = ParseUtils.interpolate(expressions, params);

    List<String> expected = new ArrayList<String>();
    expected.add("xxCAT");
    expected.add("yyDOGzz");

    assertEquals(expected, interpolate);
}
 
Example 2
Source File: ParseUtilsTest.java    From dubbox with Apache License 2.0 6 votes vote down vote up
@Test
public void testInterpolateCollMap_NormalCase() throws Exception {
    List<String> expressions = new ArrayList<String>();
    expressions.add("xx$var1");
    expressions.add("yy${var2}zz");

    Map<String, String> params = new HashMap<String, String>();
    params.put("var1", "CAT");
    params.put("var2", "DOG");

    List<String> interpolate = ParseUtils.interpolate(expressions, params);

    List<String> expected = new ArrayList<String>();
    expected.add("xxCAT");
    expected.add("yyDOGzz");

    assertEquals(expected, interpolate);
}
 
Example 3
Source File: ParseUtilsTest.java    From dubbox with Apache License 2.0 6 votes vote down vote up
@Test
public void testInterpolateCollMap_NormalCase() throws Exception {
    List<String> expressions = new ArrayList<String>();
    expressions.add("xx$var1");
    expressions.add("yy${var2}zz");

    Map<String, String> params = new HashMap<String, String>();
    params.put("var1", "CAT");
    params.put("var2", "DOG");

    List<String> interpolate = ParseUtils.interpolate(expressions, params);

    List<String> expected = new ArrayList<String>();
    expected.add("xxCAT");
    expected.add("yyDOGzz");

    assertEquals(expected, interpolate);
}
 
Example 4
Source File: ParseUtilsTest.java    From dubbox with Apache License 2.0 6 votes vote down vote up
@Test
public void testInterpolateCollMap_NormalCase() throws Exception {
    List<String> expressions = new ArrayList<String>();
    expressions.add("xx$var1");
    expressions.add("yy${var2}zz");

    Map<String, String> params = new HashMap<String, String>();
    params.put("var1", "CAT");
    params.put("var2", "DOG");

    List<String> interpolate = ParseUtils.interpolate(expressions, params);

    List<String> expected = new ArrayList<String>();
    expected.add("xxCAT");
    expected.add("yyDOGzz");

    assertEquals(expected, interpolate);
}
 
Example 5
Source File: ParseUtilsTest.java    From dubbox-hystrix with Apache License 2.0 6 votes vote down vote up
@Test
public void testInterpolateCollMap_NormalCase() throws Exception {
    List<String> expressions = new ArrayList<String>();
    expressions.add("xx$var1");
    expressions.add("yy${var2}zz");

    Map<String, String> params = new HashMap<String, String>();
    params.put("var1", "CAT");
    params.put("var2", "DOG");

    List<String> interpolate = ParseUtils.interpolate(expressions, params);

    List<String> expected = new ArrayList<String>();
    expected.add("xxCAT");
    expected.add("yyDOGzz");

    assertEquals(expected, interpolate);
}
 
Example 6
Source File: ParseUtilsTest.java    From dubbox with Apache License 2.0 5 votes vote down vote up
@Test
public void testInterpolateVariableWithParentheses() throws Exception {
    Map<String, String> params = new HashMap<String, String>();
    params.put("consumer.address", "10.20.130.230");
    String regexp = ParseUtils.interpolate("xx${consumer.address}yy", params);
    assertEquals("xx10.20.130.230yy", regexp);
}
 
Example 7
Source File: ParseUtilsTest.java    From dubbo3 with Apache License 2.0 5 votes vote down vote up
@Test
public void testInterpolateVariableWithParentheses() throws Exception {
    Map<String, String> params = new HashMap<String, String>();
    params.put("consumer.address", "10.20.130.230");
    String regexp = ParseUtils.interpolate("xx${consumer.address}yy", params);
    assertEquals("xx10.20.130.230yy", regexp);
}
 
Example 8
Source File: ParseUtilsTest.java    From dubbo3 with Apache License 2.0 5 votes vote down vote up
@Test
public void testInterpolateVariable() throws Exception {
    Map<String, String> params = new HashMap<String, String>();
    params.put("consumer.address", "10.20.130.230");
    String regexp = ParseUtils.interpolate("xx$consumer.address", params);
    assertEquals("xx10.20.130.230", regexp);
}
 
Example 9
Source File: ParseUtilsTest.java    From dubbox-hystrix with Apache License 2.0 5 votes vote down vote up
@Test
public void testInterpolateVariableWithParentheses() throws Exception {
    Map<String, String> params = new HashMap<String, String>();
    params.put("consumer.address", "10.20.130.230");
    String regexp = ParseUtils.interpolate("xx${consumer.address}yy", params);
    assertEquals("xx10.20.130.230yy", regexp);
}
 
Example 10
Source File: ParseUtilsTest.java    From dubbox-hystrix with Apache License 2.0 5 votes vote down vote up
@Test
public void testInterpolateVariable() throws Exception {
    Map<String, String> params = new HashMap<String, String>();
    params.put("consumer.address", "10.20.130.230");
    String regexp = ParseUtils.interpolate("xx$consumer.address", params);
    assertEquals("xx10.20.130.230", regexp);
}
 
Example 11
Source File: ParseUtilsTest.java    From dubbox with Apache License 2.0 5 votes vote down vote up
@Test
public void testInterpolateVariableWithParentheses() throws Exception {
    Map<String, String> params = new HashMap<String, String>();
    params.put("consumer.address", "10.20.130.230");
    String regexp = ParseUtils.interpolate("xx${consumer.address}yy", params);
    assertEquals("xx10.20.130.230yy", regexp);
}
 
Example 12
Source File: ParseUtilsTest.java    From dubbox-hystrix with Apache License 2.0 4 votes vote down vote up
@Test
public void testInterpolateSequence() throws Exception {
    String regexp = ParseUtils.interpolate("1.0.[0-9]", new HashMap<String, String>());
    assertEquals("1.0.[0-9]", regexp.toString());
}
 
Example 13
Source File: ParseUtilsTest.java    From dubbox-hystrix with Apache License 2.0 4 votes vote down vote up
@Test
public void testInterpolateWildcard() throws Exception {
    String regexp = ParseUtils.interpolate("com.alibaba.morgan.*",
            new HashMap<String, String>());
    assertEquals("com.alibaba.morgan.*", regexp);
}
 
Example 14
Source File: ParseUtilsTest.java    From dubbo3 with Apache License 2.0 4 votes vote down vote up
@Test
public void testInterpolateDot() throws Exception {
    String regexp = ParseUtils.interpolate("com.alibaba.morgan.MemberService",
            new HashMap<String, String>());
    assertEquals("com.alibaba.morgan.MemberService", regexp);
}
 
Example 15
Source File: ParseUtilsTest.java    From dubbo3 with Apache License 2.0 4 votes vote down vote up
@Test
public void testInterpolateWildcard() throws Exception {
    String regexp = ParseUtils.interpolate("com.alibaba.morgan.*",
            new HashMap<String, String>());
    assertEquals("com.alibaba.morgan.*", regexp);
}
 
Example 16
Source File: ParseUtilsTest.java    From dubbox with Apache License 2.0 4 votes vote down vote up
@Test
public void testInterpolateDot() throws Exception {
    String regexp = ParseUtils.interpolate("com.alibaba.morgan.MemberService",
            new HashMap<String, String>());
    assertEquals("com.alibaba.morgan.MemberService", regexp);
}
 
Example 17
Source File: ParseUtilsTest.java    From dubbox with Apache License 2.0 4 votes vote down vote up
@Test
public void testInterpolateSequence() throws Exception {
    String regexp = ParseUtils.interpolate("1.0.[0-9]", new HashMap<String, String>());
    assertEquals("1.0.[0-9]", regexp.toString());
}
 
Example 18
Source File: ParseUtilsTest.java    From dubbox with Apache License 2.0 4 votes vote down vote up
@Test
public void testInterpolateDot() throws Exception {
    String regexp = ParseUtils.interpolate("com.alibaba.morgan.MemberService",
            new HashMap<String, String>());
    assertEquals("com.alibaba.morgan.MemberService", regexp);
}
 
Example 19
Source File: ParseUtilsTest.java    From dubbox with Apache License 2.0 4 votes vote down vote up
@Test
public void testInterpolateDot() throws Exception {
    String regexp = ParseUtils.interpolate("com.alibaba.morgan.MemberService",
            new HashMap<String, String>());
    assertEquals("com.alibaba.morgan.MemberService", regexp);
}
 
Example 20
Source File: ParseUtilsTest.java    From dubbox with Apache License 2.0 4 votes vote down vote up
@Test
public void testInterpolateWildcard() throws Exception {
    String regexp = ParseUtils.interpolate("com.alibaba.morgan.*",
            new HashMap<String, String>());
    assertEquals("com.alibaba.morgan.*", regexp);
}