@Test public void testSetClientProperties() throws IllegalAccessException, InvocationTargetException, MalformedURLException, NoSuchMethodException { CommandLineClient commandLineClient = new CommandLineClient(new String[] {"-clientConfigFile", "src/test/resources/conf/ClientConfig.groovy", "-readerConfigFile", "src/test/resources/ReaderConfig.groovy", "-listenerConfigFile", "src/test/resources/ListenerConfig.groovy"}); Client leoClient = new Client(); commandLineClient.setClientProperties(leoClient); assertEquals("TestEndpoint", leoClient.getEndpoint()); }
protected Client setClientProperties(Client leoClient) throws MalformedURLException, NoSuchMethodException, IllegalAccessException, InvocationTargetException { if (clientConfigFile.length != 1) { return leoClient; } ConfigSlurper configSlurper = new ConfigSlurper(); ConfigObject o = configSlurper.parse(clientConfigFile[0].toURI().toURL()); Set<Map.Entry> entries = o.entrySet(); for (Map.Entry e : entries) { System.out.println("Setting property " + e.getKey() + " on client to " + e.getValue() + "."); try { MethodUtils.invokeExactMethod(leoClient, "set" + StringUtils.capitalize(e.getKey().toString()), e.getValue()); } catch (NoSuchMethodException ex) { System.out.println("!!WARNING!! Found property '" + e.getKey() + "' in config file with value '" + e.getValue() + "', but property could not set it on the client."); } } return leoClient; }
CommandLineClient { protected Client setClientProperties(Client leoClient) throws MalformedURLException, NoSuchMethodException, IllegalAccessException, InvocationTargetException { if (clientConfigFile.length != 1) { return leoClient; } ConfigSlurper configSlurper = new ConfigSlurper(); ConfigObject o = configSlurper.parse(clientConfigFile[0].toURI().toURL()); Set<Map.Entry> entries = o.entrySet(); for (Map.Entry e : entries) { System.out.println("Setting property " + e.getKey() + " on client to " + e.getValue() + "."); try { MethodUtils.invokeExactMethod(leoClient, "set" + StringUtils.capitalize(e.getKey().toString()), e.getValue()); } catch (NoSuchMethodException ex) { System.out.println("!!WARNING!! Found property '" + e.getKey() + "' in config file with value '" + e.getValue() + "', but property could not set it on the client."); } } return leoClient; } }
CommandLineClient { protected Client setClientProperties(Client leoClient) throws MalformedURLException, NoSuchMethodException, IllegalAccessException, InvocationTargetException { if (clientConfigFile.length != 1) { return leoClient; } ConfigSlurper configSlurper = new ConfigSlurper(); ConfigObject o = configSlurper.parse(clientConfigFile[0].toURI().toURL()); Set<Map.Entry> entries = o.entrySet(); for (Map.Entry e : entries) { System.out.println("Setting property " + e.getKey() + " on client to " + e.getValue() + "."); try { MethodUtils.invokeExactMethod(leoClient, "set" + StringUtils.capitalize(e.getKey().toString()), e.getValue()); } catch (NoSuchMethodException ex) { System.out.println("!!WARNING!! Found property '" + e.getKey() + "' in config file with value '" + e.getValue() + "', but property could not set it on the client."); } } return leoClient; } CommandLineClient(String[] args);  CommandLineClient(File clientConfigFile, File readerConfig, File[] listenerConfigFiles); }
CommandLineClient { protected Client setClientProperties(Client leoClient) throws MalformedURLException, NoSuchMethodException, IllegalAccessException, InvocationTargetException { if (clientConfigFile.length != 1) { return leoClient; } ConfigSlurper configSlurper = new ConfigSlurper(); ConfigObject o = configSlurper.parse(clientConfigFile[0].toURI().toURL()); Set<Map.Entry> entries = o.entrySet(); for (Map.Entry e : entries) { System.out.println("Setting property " + e.getKey() + " on client to " + e.getValue() + "."); try { MethodUtils.invokeExactMethod(leoClient, "set" + StringUtils.capitalize(e.getKey().toString()), e.getValue()); } catch (NoSuchMethodException ex) { System.out.println("!!WARNING!! Found property '" + e.getKey() + "' in config file with value '" + e.getValue() + "', but property could not set it on the client."); } } return leoClient; } CommandLineClient(String[] args);  CommandLineClient(File clientConfigFile, File readerConfig, File[] listenerConfigFiles); String defaultClientConfig(); String defaultCollectionReaderConfig(); String[] defaultListenerConfig(); static List<UimaAsBaseCallbackListener> getListeners(File...configs); static LeoCollectionReaderInterface getReader(File config); void runClient(); static void main(String[] args); static void printUsage(); }
CommandLineClient { protected Client setClientProperties(Client leoClient) throws MalformedURLException, NoSuchMethodException, IllegalAccessException, InvocationTargetException { if (clientConfigFile.length != 1) { return leoClient; } ConfigSlurper configSlurper = new ConfigSlurper(); ConfigObject o = configSlurper.parse(clientConfigFile[0].toURI().toURL()); Set<Map.Entry> entries = o.entrySet(); for (Map.Entry e : entries) { System.out.println("Setting property " + e.getKey() + " on client to " + e.getValue() + "."); try { MethodUtils.invokeExactMethod(leoClient, "set" + StringUtils.capitalize(e.getKey().toString()), e.getValue()); } catch (NoSuchMethodException ex) { System.out.println("!!WARNING!! Found property '" + e.getKey() + "' in config file with value '" + e.getValue() + "', but property could not set it on the client."); } } return leoClient; } CommandLineClient(String[] args);  CommandLineClient(File clientConfigFile, File readerConfig, File[] listenerConfigFiles); String defaultClientConfig(); String defaultCollectionReaderConfig(); String[] defaultListenerConfig(); static List<UimaAsBaseCallbackListener> getListeners(File...configs); static LeoCollectionReaderInterface getReader(File config); void runClient(); static void main(String[] args); static void printUsage();  }