RuleCompatibleHelper { public static String compatibleRule(String ruleStr) { ruleStr = StringUtils.replace(ruleStr, RULE_INTERACT_ROOT_NAME, RULE_CURRENT_ROOT_NAME); ruleStr = StringUtils.replace(ruleStr, RULE_INTERACT_TABLE_NAME, RULE_CURRENT_TABLE_NAME); ruleStr = StringUtils.replace(ruleStr, RULE_LE_ROOT_NAME, RULE_CURRENT_ROOT_NAME); ruleStr = StringUtils.replace(ruleStr, RULE_LE_TABLE_NAME, RULE_CURRENT_TABLE_NAME); ruleStr = StringUtils.replace(ruleStr, RULE_LE2_TABLE_NAME, RULE_CURRENT_TABLE_NAME); return ruleStr; }  static String compatibleRule(String ruleStr); static final String RULE_CURRENT_ROOT_NAME; static final String RULE_CURRENT_TABLE_NAME; static final String RULE_INTERACT_ROOT_NAME; static final String RULE_INTERACT_TABLE_NAME; static final String RULE_LE_ROOT_NAME; static final String RULE_LE_TABLE_NAME; static final String RULE_LE2_ROOT_NAME; static final String RULE_LE2_TABLE_NAME; }
@Test public void testCompatible_interact() { try { Resource resource = new PathMatchingResourcePatternResolver().getResource("classpath:compatible/interact-spring-context.xml"); String ruleStr = StringUtils.join(IOUtils.readLines(resource.getInputStream()), SystemUtils.LINE_SEPARATOR); ApplicationContext context = new StringXmlApplicationContext(RuleCompatibleHelper.compatibleRule(ruleStr)); VirtualTableRoot vtr1 = (VirtualTableRoot) context.getBean("vtabroot"); Assert.assertNotNull(vtr1); } catch (IOException e) { Assert.fail(ExceptionUtils.getFullStackTrace(e)); } }
@Test public void testCompatible_le() { try { Resource resource = new PathMatchingResourcePatternResolver().getResource("classpath:compatible/le-spring-context.xml"); String ruleStr = StringUtils.join(IOUtils.readLines(resource.getInputStream()), SystemUtils.LINE_SEPARATOR); ApplicationContext context = new StringXmlApplicationContext(RuleCompatibleHelper.compatibleRule(ruleStr)); VirtualTableRoot vtr1 = (VirtualTableRoot) context.getBean("vtabroot"); Assert.assertNotNull(vtr1); } catch (IOException e) { Assert.fail(ExceptionUtils.getFullStackTrace(e)); } }