@Test public void testConfigLoading() throws Exception { InputStream config = mtWhitespaceRemoval.loadConfigFromResources(); java.util.Scanner s = new java.util.Scanner(config).useDelimiter("\\A"); StringBuilder configString = new StringBuilder(); while (s.hasNext()) { configString.append(s.next()); } config.close(); String regex = mtWhitespaceRemoval.config.getRegex(); assertNotNull(regex); Pattern compile = Pattern.compile(regex); Matcher matcher = compile.matcher(" {123} "); assertEquals(6, matcher.groupCount()); assertEquals(mtWhitespaceRemoval.config.getLeftCaptureGroup(), new Integer(1)); assertEquals(mtWhitespaceRemoval.config.getLeftIgnoreCaptureGroup(), new Integer(2)); assertEquals(mtWhitespaceRemoval.config.getCenterCaptureGroup(), new Integer(3)); assertEquals(mtWhitespaceRemoval.config.getCompareCaptureGroup(), new Integer(4)); assertEquals(mtWhitespaceRemoval.config.getRightIgnoreCaptureGroup(), new Integer(5)); assertEquals(mtWhitespaceRemoval.config.getRightCaptureGroup(), new Integer(6)); }
protected InputStream loadConfigFromResources() throws WSException { InputStream resource = getClass().getResourceAsStream(CONFIG_FILE_NAME); if (resource == null) { throw new WSException(new FileNotFoundException("Unable to load Resource " + CONFIG_FILE_NAME + " stored in package resources.")); } return resource; }
SegmentFixMTWhitespaceRemoval extends WSTaskAutomaticAction { protected InputStream loadConfigFromResources() throws WSException { InputStream resource = getClass().getResourceAsStream(CONFIG_FILE_NAME); if (resource == null) { throw new WSException(new FileNotFoundException("Unable to load Resource " + CONFIG_FILE_NAME + " stored in package resources.")); } return resource; } }
SegmentFixMTWhitespaceRemoval extends WSTaskAutomaticAction { protected InputStream loadConfigFromResources() throws WSException { InputStream resource = getClass().getResourceAsStream(CONFIG_FILE_NAME); if (resource == null) { throw new WSException(new FileNotFoundException("Unable to load Resource " + CONFIG_FILE_NAME + " stored in package resources.")); } return resource; }  }
SegmentFixMTWhitespaceRemoval extends WSTaskAutomaticAction { protected InputStream loadConfigFromResources() throws WSException { InputStream resource = getClass().getResourceAsStream(CONFIG_FILE_NAME); if (resource == null) { throw new WSException(new FileNotFoundException("Unable to load Resource " + CONFIG_FILE_NAME + " stored in package resources.")); } return resource; }  @Override String getDescription(); @Override String getName(); @Override String getVersion(); @Override String[] getReturns(); @Override WSActionResult execute(WSContext context, Map parameters, WSTask task); String fixWhitespace(String source, String target); }
SegmentFixMTWhitespaceRemoval extends WSTaskAutomaticAction { protected InputStream loadConfigFromResources() throws WSException { InputStream resource = getClass().getResourceAsStream(CONFIG_FILE_NAME); if (resource == null) { throw new WSException(new FileNotFoundException("Unable to load Resource " + CONFIG_FILE_NAME + " stored in package resources.")); } return resource; }  @Override String getDescription(); @Override String getName(); @Override String getVersion(); @Override String[] getReturns(); @Override WSActionResult execute(WSContext context, Map parameters, WSTask task); String fixWhitespace(String source, String target);  }