@Test(expected = IllegalArgumentException.class) public void testCreateMissingOpsPort() { OpenPatentWebServiceFacadeFactory factory = new OpenPatentWebServiceFacadeFactory(); Map<String, String> conf = prepareValidConfiguration(); conf.remove(PARAM_SERVICE_ENDPOINT_OPS_PORT); factory.instantiate(conf); }
@Override public PatentServiceFacade instantiate(Map<String, String> conf) { Preconditions.checkArgument(StringUtils.isNotBlank(conf.get(PARAM_CONSUMER_KEY))); Preconditions.checkArgument(StringUtils.isNotBlank(conf.get(PARAM_CONSUMER_SECRET))); Preconditions.checkArgument(StringUtils.isNotBlank(conf.get(PARAM_SERVICE_ENDPOINT_AUTH_HOST))); Preconditions.checkArgument(StringUtils.isNotBlank(conf.get(PARAM_SERVICE_ENDPOINT_AUTH_PORT))); Preconditions.checkArgument(StringUtils.isNotBlank(conf.get(PARAM_SERVICE_ENDPOINT_AUTH_SCHEME))); Preconditions.checkArgument(StringUtils.isNotBlank(conf.get(PARAM_SERVICE_ENDPOINT_AUTH_URI_ROOT))); Preconditions.checkArgument(StringUtils.isNotBlank(conf.get(PARAM_SERVICE_ENDPOINT_OPS_HOST))); Preconditions.checkArgument(StringUtils.isNotBlank(conf.get(PARAM_SERVICE_ENDPOINT_OPS_PORT))); Preconditions.checkArgument(StringUtils.isNotBlank(conf.get(PARAM_SERVICE_ENDPOINT_OPS_SCHEME))); Preconditions.checkArgument(StringUtils.isNotBlank(conf.get(PARAM_SERVICE_ENDPOINT_OPS_URI_ROOT))); String connectionTimeout = conf.getOrDefault(PARAM_SERVICE_ENDPOINT_CONNECTION_TIMEOUT, "60000"); String readTimeout = conf.getOrDefault(PARAM_SERVICE_ENDPOINT_READ_TIMEOUT, "60000"); String throttleSleepTime = conf.getOrDefault(PARAM_SERVICE_ENDPOINT_THROTTLE_SLEEP_TIME, "10000"); String retriesCount = conf.getOrDefault(PARAM_SERVICE_ENDPOINT_RETRIES_COUNT, "10"); return new OpenPatentWebServiceFacade(ConnectionDetailsBuilder.newBuilder() .withConnectionTimeout(Integer.parseInt(connectionTimeout)) .withReadTimeout(Integer.parseInt(readTimeout)) .withAuthHostName(conf.get(PARAM_SERVICE_ENDPOINT_AUTH_HOST)) .withAuthPort(Integer.parseInt(conf.get(PARAM_SERVICE_ENDPOINT_AUTH_PORT))) .withAuthScheme(conf.get(PARAM_SERVICE_ENDPOINT_AUTH_SCHEME)) .withAuthUriRoot(conf.get(PARAM_SERVICE_ENDPOINT_AUTH_URI_ROOT)) .withOpsHostName(conf.get(PARAM_SERVICE_ENDPOINT_OPS_HOST)) .withOpsPort(Integer.parseInt(conf.get(PARAM_SERVICE_ENDPOINT_OPS_PORT))) .withOpsScheme(conf.get(PARAM_SERVICE_ENDPOINT_OPS_SCHEME)) .withOpsUriRoot(conf.get(PARAM_SERVICE_ENDPOINT_OPS_URI_ROOT)) .withConsumerCredential(buildCredential(conf.get(PARAM_CONSUMER_KEY), conf.get(PARAM_CONSUMER_SECRET))) .withThrottleSleepTime(Long.parseLong(throttleSleepTime)) .withMaxRetriesCount(Integer.parseInt(retriesCount)).build()); }
OpenPatentWebServiceFacadeFactory implements ServiceFacadeFactory<PatentServiceFacade> { @Override public PatentServiceFacade instantiate(Map<String, String> conf) { Preconditions.checkArgument(StringUtils.isNotBlank(conf.get(PARAM_CONSUMER_KEY))); Preconditions.checkArgument(StringUtils.isNotBlank(conf.get(PARAM_CONSUMER_SECRET))); Preconditions.checkArgument(StringUtils.isNotBlank(conf.get(PARAM_SERVICE_ENDPOINT_AUTH_HOST))); Preconditions.checkArgument(StringUtils.isNotBlank(conf.get(PARAM_SERVICE_ENDPOINT_AUTH_PORT))); Preconditions.checkArgument(StringUtils.isNotBlank(conf.get(PARAM_SERVICE_ENDPOINT_AUTH_SCHEME))); Preconditions.checkArgument(StringUtils.isNotBlank(conf.get(PARAM_SERVICE_ENDPOINT_AUTH_URI_ROOT))); Preconditions.checkArgument(StringUtils.isNotBlank(conf.get(PARAM_SERVICE_ENDPOINT_OPS_HOST))); Preconditions.checkArgument(StringUtils.isNotBlank(conf.get(PARAM_SERVICE_ENDPOINT_OPS_PORT))); Preconditions.checkArgument(StringUtils.isNotBlank(conf.get(PARAM_SERVICE_ENDPOINT_OPS_SCHEME))); Preconditions.checkArgument(StringUtils.isNotBlank(conf.get(PARAM_SERVICE_ENDPOINT_OPS_URI_ROOT))); String connectionTimeout = conf.getOrDefault(PARAM_SERVICE_ENDPOINT_CONNECTION_TIMEOUT, "60000"); String readTimeout = conf.getOrDefault(PARAM_SERVICE_ENDPOINT_READ_TIMEOUT, "60000"); String throttleSleepTime = conf.getOrDefault(PARAM_SERVICE_ENDPOINT_THROTTLE_SLEEP_TIME, "10000"); String retriesCount = conf.getOrDefault(PARAM_SERVICE_ENDPOINT_RETRIES_COUNT, "10"); return new OpenPatentWebServiceFacade(ConnectionDetailsBuilder.newBuilder() .withConnectionTimeout(Integer.parseInt(connectionTimeout)) .withReadTimeout(Integer.parseInt(readTimeout)) .withAuthHostName(conf.get(PARAM_SERVICE_ENDPOINT_AUTH_HOST)) .withAuthPort(Integer.parseInt(conf.get(PARAM_SERVICE_ENDPOINT_AUTH_PORT))) .withAuthScheme(conf.get(PARAM_SERVICE_ENDPOINT_AUTH_SCHEME)) .withAuthUriRoot(conf.get(PARAM_SERVICE_ENDPOINT_AUTH_URI_ROOT)) .withOpsHostName(conf.get(PARAM_SERVICE_ENDPOINT_OPS_HOST)) .withOpsPort(Integer.parseInt(conf.get(PARAM_SERVICE_ENDPOINT_OPS_PORT))) .withOpsScheme(conf.get(PARAM_SERVICE_ENDPOINT_OPS_SCHEME)) .withOpsUriRoot(conf.get(PARAM_SERVICE_ENDPOINT_OPS_URI_ROOT)) .withConsumerCredential(buildCredential(conf.get(PARAM_CONSUMER_KEY), conf.get(PARAM_CONSUMER_SECRET))) .withThrottleSleepTime(Long.parseLong(throttleSleepTime)) .withMaxRetriesCount(Integer.parseInt(retriesCount)).build()); } }
OpenPatentWebServiceFacadeFactory implements ServiceFacadeFactory<PatentServiceFacade> { @Override public PatentServiceFacade instantiate(Map<String, String> conf) { Preconditions.checkArgument(StringUtils.isNotBlank(conf.get(PARAM_CONSUMER_KEY))); Preconditions.checkArgument(StringUtils.isNotBlank(conf.get(PARAM_CONSUMER_SECRET))); Preconditions.checkArgument(StringUtils.isNotBlank(conf.get(PARAM_SERVICE_ENDPOINT_AUTH_HOST))); Preconditions.checkArgument(StringUtils.isNotBlank(conf.get(PARAM_SERVICE_ENDPOINT_AUTH_PORT))); Preconditions.checkArgument(StringUtils.isNotBlank(conf.get(PARAM_SERVICE_ENDPOINT_AUTH_SCHEME))); Preconditions.checkArgument(StringUtils.isNotBlank(conf.get(PARAM_SERVICE_ENDPOINT_AUTH_URI_ROOT))); Preconditions.checkArgument(StringUtils.isNotBlank(conf.get(PARAM_SERVICE_ENDPOINT_OPS_HOST))); Preconditions.checkArgument(StringUtils.isNotBlank(conf.get(PARAM_SERVICE_ENDPOINT_OPS_PORT))); Preconditions.checkArgument(StringUtils.isNotBlank(conf.get(PARAM_SERVICE_ENDPOINT_OPS_SCHEME))); Preconditions.checkArgument(StringUtils.isNotBlank(conf.get(PARAM_SERVICE_ENDPOINT_OPS_URI_ROOT))); String connectionTimeout = conf.getOrDefault(PARAM_SERVICE_ENDPOINT_CONNECTION_TIMEOUT, "60000"); String readTimeout = conf.getOrDefault(PARAM_SERVICE_ENDPOINT_READ_TIMEOUT, "60000"); String throttleSleepTime = conf.getOrDefault(PARAM_SERVICE_ENDPOINT_THROTTLE_SLEEP_TIME, "10000"); String retriesCount = conf.getOrDefault(PARAM_SERVICE_ENDPOINT_RETRIES_COUNT, "10"); return new OpenPatentWebServiceFacade(ConnectionDetailsBuilder.newBuilder() .withConnectionTimeout(Integer.parseInt(connectionTimeout)) .withReadTimeout(Integer.parseInt(readTimeout)) .withAuthHostName(conf.get(PARAM_SERVICE_ENDPOINT_AUTH_HOST)) .withAuthPort(Integer.parseInt(conf.get(PARAM_SERVICE_ENDPOINT_AUTH_PORT))) .withAuthScheme(conf.get(PARAM_SERVICE_ENDPOINT_AUTH_SCHEME)) .withAuthUriRoot(conf.get(PARAM_SERVICE_ENDPOINT_AUTH_URI_ROOT)) .withOpsHostName(conf.get(PARAM_SERVICE_ENDPOINT_OPS_HOST)) .withOpsPort(Integer.parseInt(conf.get(PARAM_SERVICE_ENDPOINT_OPS_PORT))) .withOpsScheme(conf.get(PARAM_SERVICE_ENDPOINT_OPS_SCHEME)) .withOpsUriRoot(conf.get(PARAM_SERVICE_ENDPOINT_OPS_URI_ROOT)) .withConsumerCredential(buildCredential(conf.get(PARAM_CONSUMER_KEY), conf.get(PARAM_CONSUMER_SECRET))) .withThrottleSleepTime(Long.parseLong(throttleSleepTime)) .withMaxRetriesCount(Integer.parseInt(retriesCount)).build()); }  }
OpenPatentWebServiceFacadeFactory implements ServiceFacadeFactory<PatentServiceFacade> { @Override public PatentServiceFacade instantiate(Map<String, String> conf) { Preconditions.checkArgument(StringUtils.isNotBlank(conf.get(PARAM_CONSUMER_KEY))); Preconditions.checkArgument(StringUtils.isNotBlank(conf.get(PARAM_CONSUMER_SECRET))); Preconditions.checkArgument(StringUtils.isNotBlank(conf.get(PARAM_SERVICE_ENDPOINT_AUTH_HOST))); Preconditions.checkArgument(StringUtils.isNotBlank(conf.get(PARAM_SERVICE_ENDPOINT_AUTH_PORT))); Preconditions.checkArgument(StringUtils.isNotBlank(conf.get(PARAM_SERVICE_ENDPOINT_AUTH_SCHEME))); Preconditions.checkArgument(StringUtils.isNotBlank(conf.get(PARAM_SERVICE_ENDPOINT_AUTH_URI_ROOT))); Preconditions.checkArgument(StringUtils.isNotBlank(conf.get(PARAM_SERVICE_ENDPOINT_OPS_HOST))); Preconditions.checkArgument(StringUtils.isNotBlank(conf.get(PARAM_SERVICE_ENDPOINT_OPS_PORT))); Preconditions.checkArgument(StringUtils.isNotBlank(conf.get(PARAM_SERVICE_ENDPOINT_OPS_SCHEME))); Preconditions.checkArgument(StringUtils.isNotBlank(conf.get(PARAM_SERVICE_ENDPOINT_OPS_URI_ROOT))); String connectionTimeout = conf.getOrDefault(PARAM_SERVICE_ENDPOINT_CONNECTION_TIMEOUT, "60000"); String readTimeout = conf.getOrDefault(PARAM_SERVICE_ENDPOINT_READ_TIMEOUT, "60000"); String throttleSleepTime = conf.getOrDefault(PARAM_SERVICE_ENDPOINT_THROTTLE_SLEEP_TIME, "10000"); String retriesCount = conf.getOrDefault(PARAM_SERVICE_ENDPOINT_RETRIES_COUNT, "10"); return new OpenPatentWebServiceFacade(ConnectionDetailsBuilder.newBuilder() .withConnectionTimeout(Integer.parseInt(connectionTimeout)) .withReadTimeout(Integer.parseInt(readTimeout)) .withAuthHostName(conf.get(PARAM_SERVICE_ENDPOINT_AUTH_HOST)) .withAuthPort(Integer.parseInt(conf.get(PARAM_SERVICE_ENDPOINT_AUTH_PORT))) .withAuthScheme(conf.get(PARAM_SERVICE_ENDPOINT_AUTH_SCHEME)) .withAuthUriRoot(conf.get(PARAM_SERVICE_ENDPOINT_AUTH_URI_ROOT)) .withOpsHostName(conf.get(PARAM_SERVICE_ENDPOINT_OPS_HOST)) .withOpsPort(Integer.parseInt(conf.get(PARAM_SERVICE_ENDPOINT_OPS_PORT))) .withOpsScheme(conf.get(PARAM_SERVICE_ENDPOINT_OPS_SCHEME)) .withOpsUriRoot(conf.get(PARAM_SERVICE_ENDPOINT_OPS_URI_ROOT)) .withConsumerCredential(buildCredential(conf.get(PARAM_CONSUMER_KEY), conf.get(PARAM_CONSUMER_SECRET))) .withThrottleSleepTime(Long.parseLong(throttleSleepTime)) .withMaxRetriesCount(Integer.parseInt(retriesCount)).build()); }  @Override PatentServiceFacade instantiate(Map<String, String> conf); }
OpenPatentWebServiceFacadeFactory implements ServiceFacadeFactory<PatentServiceFacade> { @Override public PatentServiceFacade instantiate(Map<String, String> conf) { Preconditions.checkArgument(StringUtils.isNotBlank(conf.get(PARAM_CONSUMER_KEY))); Preconditions.checkArgument(StringUtils.isNotBlank(conf.get(PARAM_CONSUMER_SECRET))); Preconditions.checkArgument(StringUtils.isNotBlank(conf.get(PARAM_SERVICE_ENDPOINT_AUTH_HOST))); Preconditions.checkArgument(StringUtils.isNotBlank(conf.get(PARAM_SERVICE_ENDPOINT_AUTH_PORT))); Preconditions.checkArgument(StringUtils.isNotBlank(conf.get(PARAM_SERVICE_ENDPOINT_AUTH_SCHEME))); Preconditions.checkArgument(StringUtils.isNotBlank(conf.get(PARAM_SERVICE_ENDPOINT_AUTH_URI_ROOT))); Preconditions.checkArgument(StringUtils.isNotBlank(conf.get(PARAM_SERVICE_ENDPOINT_OPS_HOST))); Preconditions.checkArgument(StringUtils.isNotBlank(conf.get(PARAM_SERVICE_ENDPOINT_OPS_PORT))); Preconditions.checkArgument(StringUtils.isNotBlank(conf.get(PARAM_SERVICE_ENDPOINT_OPS_SCHEME))); Preconditions.checkArgument(StringUtils.isNotBlank(conf.get(PARAM_SERVICE_ENDPOINT_OPS_URI_ROOT))); String connectionTimeout = conf.getOrDefault(PARAM_SERVICE_ENDPOINT_CONNECTION_TIMEOUT, "60000"); String readTimeout = conf.getOrDefault(PARAM_SERVICE_ENDPOINT_READ_TIMEOUT, "60000"); String throttleSleepTime = conf.getOrDefault(PARAM_SERVICE_ENDPOINT_THROTTLE_SLEEP_TIME, "10000"); String retriesCount = conf.getOrDefault(PARAM_SERVICE_ENDPOINT_RETRIES_COUNT, "10"); return new OpenPatentWebServiceFacade(ConnectionDetailsBuilder.newBuilder() .withConnectionTimeout(Integer.parseInt(connectionTimeout)) .withReadTimeout(Integer.parseInt(readTimeout)) .withAuthHostName(conf.get(PARAM_SERVICE_ENDPOINT_AUTH_HOST)) .withAuthPort(Integer.parseInt(conf.get(PARAM_SERVICE_ENDPOINT_AUTH_PORT))) .withAuthScheme(conf.get(PARAM_SERVICE_ENDPOINT_AUTH_SCHEME)) .withAuthUriRoot(conf.get(PARAM_SERVICE_ENDPOINT_AUTH_URI_ROOT)) .withOpsHostName(conf.get(PARAM_SERVICE_ENDPOINT_OPS_HOST)) .withOpsPort(Integer.parseInt(conf.get(PARAM_SERVICE_ENDPOINT_OPS_PORT))) .withOpsScheme(conf.get(PARAM_SERVICE_ENDPOINT_OPS_SCHEME)) .withOpsUriRoot(conf.get(PARAM_SERVICE_ENDPOINT_OPS_URI_ROOT)) .withConsumerCredential(buildCredential(conf.get(PARAM_CONSUMER_KEY), conf.get(PARAM_CONSUMER_SECRET))) .withThrottleSleepTime(Long.parseLong(throttleSleepTime)) .withMaxRetriesCount(Integer.parseInt(retriesCount)).build()); }  @Override PatentServiceFacade instantiate(Map<String, String> conf); static final Charset DEFAULT_CHARSET; static final String PARAM_CONSUMER_KEY; static final String PARAM_CONSUMER_SECRET; static final String PARAM_SERVICE_ENDPOINT_AUTH_HOST; static final String PARAM_SERVICE_ENDPOINT_AUTH_PORT; static final String PARAM_SERVICE_ENDPOINT_AUTH_SCHEME; static final String PARAM_SERVICE_ENDPOINT_AUTH_URI_ROOT; static final String PARAM_SERVICE_ENDPOINT_OPS_HOST; static final String PARAM_SERVICE_ENDPOINT_OPS_PORT; static final String PARAM_SERVICE_ENDPOINT_OPS_SCHEME; static final String PARAM_SERVICE_ENDPOINT_OPS_URI_ROOT; static final String PARAM_SERVICE_ENDPOINT_READ_TIMEOUT; static final String PARAM_SERVICE_ENDPOINT_CONNECTION_TIMEOUT; static final String PARAM_SERVICE_ENDPOINT_THROTTLE_SLEEP_TIME; static final String PARAM_SERVICE_ENDPOINT_RETRIES_COUNT; }