@Test void create() { Plc4xSchemaFactory factory = new Plc4xSchemaFactory(); assertThatThrownBy(() -> factory.create(null, "", Collections.emptyMap())) .isInstanceOf(NullPointerException.class) .hasMessageContaining("Please specify operand 'config'..."); }
@Override public Schema create(SchemaPlus parentSchema, String name, Map<String, Object> operand) { Object config = operand.get("config"); Validate.notNull(config, "No configuration file given. Please specify operand 'config'...'"); ScraperConfiguration configuration; try { configuration = ScraperConfiguration.fromFile(config.toString(), ScraperConfigurationTriggeredImpl.class); } catch (IOException e) { throw new IllegalArgumentException("Unable to load configuration file!", e); } Object limit = operand.get("limit"); Validate.notNull(limit, "No limit for the number of rows for a table. Please specify operand 'config'...'"); long parsedLimit; try { parsedLimit = Long.parseLong(limit.toString()); } catch (NumberFormatException e) { throw new IllegalArgumentException("Given limit '" + limit + "' cannot be parsed to valid long!", e); } try { return new Plc4xSchema(configuration, parsedLimit); } catch (ScraperException e) { LOGGER.warn("Could not evaluate Plc4xSchema",e); return null; } }
Plc4xSchemaFactory implements SchemaFactory { @Override public Schema create(SchemaPlus parentSchema, String name, Map<String, Object> operand) { Object config = operand.get("config"); Validate.notNull(config, "No configuration file given. Please specify operand 'config'...'"); ScraperConfiguration configuration; try { configuration = ScraperConfiguration.fromFile(config.toString(), ScraperConfigurationTriggeredImpl.class); } catch (IOException e) { throw new IllegalArgumentException("Unable to load configuration file!", e); } Object limit = operand.get("limit"); Validate.notNull(limit, "No limit for the number of rows for a table. Please specify operand 'config'...'"); long parsedLimit; try { parsedLimit = Long.parseLong(limit.toString()); } catch (NumberFormatException e) { throw new IllegalArgumentException("Given limit '" + limit + "' cannot be parsed to valid long!", e); } try { return new Plc4xSchema(configuration, parsedLimit); } catch (ScraperException e) { LOGGER.warn("Could not evaluate Plc4xSchema",e); return null; } } }
Plc4xSchemaFactory implements SchemaFactory { @Override public Schema create(SchemaPlus parentSchema, String name, Map<String, Object> operand) { Object config = operand.get("config"); Validate.notNull(config, "No configuration file given. Please specify operand 'config'...'"); ScraperConfiguration configuration; try { configuration = ScraperConfiguration.fromFile(config.toString(), ScraperConfigurationTriggeredImpl.class); } catch (IOException e) { throw new IllegalArgumentException("Unable to load configuration file!", e); } Object limit = operand.get("limit"); Validate.notNull(limit, "No limit for the number of rows for a table. Please specify operand 'config'...'"); long parsedLimit; try { parsedLimit = Long.parseLong(limit.toString()); } catch (NumberFormatException e) { throw new IllegalArgumentException("Given limit '" + limit + "' cannot be parsed to valid long!", e); } try { return new Plc4xSchema(configuration, parsedLimit); } catch (ScraperException e) { LOGGER.warn("Could not evaluate Plc4xSchema",e); return null; } }  }
Plc4xSchemaFactory implements SchemaFactory { @Override public Schema create(SchemaPlus parentSchema, String name, Map<String, Object> operand) { Object config = operand.get("config"); Validate.notNull(config, "No configuration file given. Please specify operand 'config'...'"); ScraperConfiguration configuration; try { configuration = ScraperConfiguration.fromFile(config.toString(), ScraperConfigurationTriggeredImpl.class); } catch (IOException e) { throw new IllegalArgumentException("Unable to load configuration file!", e); } Object limit = operand.get("limit"); Validate.notNull(limit, "No limit for the number of rows for a table. Please specify operand 'config'...'"); long parsedLimit; try { parsedLimit = Long.parseLong(limit.toString()); } catch (NumberFormatException e) { throw new IllegalArgumentException("Given limit '" + limit + "' cannot be parsed to valid long!", e); } try { return new Plc4xSchema(configuration, parsedLimit); } catch (ScraperException e) { LOGGER.warn("Could not evaluate Plc4xSchema",e); return null; } }  @Override Schema create(SchemaPlus parentSchema, String name, Map<String, Object> operand); }
Plc4xSchemaFactory implements SchemaFactory { @Override public Schema create(SchemaPlus parentSchema, String name, Map<String, Object> operand) { Object config = operand.get("config"); Validate.notNull(config, "No configuration file given. Please specify operand 'config'...'"); ScraperConfiguration configuration; try { configuration = ScraperConfiguration.fromFile(config.toString(), ScraperConfigurationTriggeredImpl.class); } catch (IOException e) { throw new IllegalArgumentException("Unable to load configuration file!", e); } Object limit = operand.get("limit"); Validate.notNull(limit, "No limit for the number of rows for a table. Please specify operand 'config'...'"); long parsedLimit; try { parsedLimit = Long.parseLong(limit.toString()); } catch (NumberFormatException e) { throw new IllegalArgumentException("Given limit '" + limit + "' cannot be parsed to valid long!", e); } try { return new Plc4xSchema(configuration, parsedLimit); } catch (ScraperException e) { LOGGER.warn("Could not evaluate Plc4xSchema",e); return null; } }  @Override Schema create(SchemaPlus parentSchema, String name, Map<String, Object> operand);  }