no.sb1.troxy.util.VersionUtil Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of troxy-core Show documentation
Show all versions of troxy-core Show documentation
Troxy is a proxy intended for simulating a remote service without actually
connecting to the server. Incoming requests are matched using regular
expressions and responses are created from a recorded response from the remote
service and optionally modified by inserting values caught from the regular
expression used to match the request.
package no.sb1.troxy.util;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;
public class VersionUtil {
private static final Logger log = LoggerFactory.getLogger(VersionUtil.class);
public static String getRelease() {
return getInternal().getProperty("release", "");
}
public static String getVersion() {
return getInternal().getProperty("version", "");
}
private static Properties getInternal() {
Properties p = new Properties();
try (InputStream inputStream = Thread.currentThread().getContextClassLoader().getResourceAsStream("troxy_version.properties")) {
p.load(inputStream);
} catch (IOException e) {
log.info("Unable to read file with Troxy version and release", e);
}
return p;
}
}