use of org.platformlayer.PlatformLayerClient in project platformlayer by platformlayer.
the class PlatformLayerTestContext method buildPlatformLayerClient.
public PlatformLayerClient buildPlatformLayerClient() throws IOException, OpsException {
PlatformLayerClient client;
if (configFile == null) {
throw new IllegalArgumentException("Config file is required");
}
InputStream is = null;
try {
if (!configFile.exists()) {
throw new FileNotFoundException("Configuration file not found: " + configFile);
}
is = new FileInputStream(configFile);
Properties properties = new Properties();
try {
properties.load(is);
} catch (IOException e) {
throw new IOException("Error reading configuration file", e);
}
HttpStrategy httpStrategy = new JreHttpStrategy();
client = HttpPlatformLayerClient.buildUsingProperties(httpStrategy, properties);
} finally {
if (is != System.in) {
IoUtils.safeClose(is);
}
}
return client;
}
Aggregations