use of com.symphony.api.id.IdentityConfigurationException in project spring-bot by finos.
the class TestIdentityProvider method getSymphonyPropertiesFile.
public static File getSymphonyPropertiesFile(String name) {
// ok, hunt for a default
File currentDir = new File("").getAbsoluteFile();
while (currentDir != null) {
File x;
if ((x = new File(currentDir, name + ".json")).exists()) {
return x;
}
currentDir = currentDir.getParentFile();
}
// no default found. Throw exception.
throw new IdentityConfigurationException("Was expecting to find a " + name + ".json file in the current directory or a parent, or " + name + " system property", null);
}
use of com.symphony.api.id.IdentityConfigurationException in project spring-bot by finos.
the class TestIdentityProvider method getIdentity.
public static SymphonyIdentity getIdentity(String name) {
try {
ObjectMapper om = new ObjectMapper();
String property = System.getProperties().getProperty(name);
if (property != null) {
return om.readValue(property, SymphonyIdentity.class);
} else {
File f = getSymphonyPropertiesFile(name);
return om.readValue(new FileInputStream(f), SymphonyIdentity.class);
}
} catch (Exception e) {
throw new IdentityConfigurationException("Couldn't load test identity " + name, e);
}
}
use of com.symphony.api.id.IdentityConfigurationException in project spring-bot by finos.
the class BasicAppIdentityProvider method getIdentity.
public SymphonyIdentity getIdentity() throws Exception {
SymphonyIdentity out = null;
IdentityProperties identity = p.getIdentity();
String appId = getAppId(p);
if (identity != null) {
out = performIdentityLoad(identity, appId);
}
if (out == null) {
out = performIdentityLoad(getClasspathResourceLocation(appId), appId);
}
if (out == null) {
out = performIdentityLoad(getFileResourceLocation(appId), appId);
}
if (out == null) {
throw new IdentityConfigurationException("Couldn't load app identity", null);
}
return out;
}
use of com.symphony.api.id.IdentityConfigurationException in project spring-bot by finos.
the class SymphonyApiConfig method botIdentity.
@Bean(name = SINGLE_BOT_IDENTITY_BEAN)
@ConditionalOnMissingBean
@ConditionalOnExpression("'${" + SINGLE_BOT_IDENTITY_PROPERTY + ".email:}${" + SINGLE_BOT_IDENTITY_PROPERTY + ".location:}' != ''")
public SymphonyIdentity botIdentity() throws IOException {
LOG.warn("Loading identity from " + SINGLE_BOT_IDENTITY_PROPERTY);
SymphonyIdentity id = IdentityProperties.instantiateIdentityFromDetails(resourceLoader, identityDetails(), mapper);
if (id == null) {
throw new IdentityConfigurationException("Couldn't create bot identity from properties", null);
}
return id;
}
use of com.symphony.api.id.IdentityConfigurationException in project spring-bot by finos.
the class StreamHelp method getProperties.
public static <T> T getProperties(String name, Class<T> c) {
try {
ObjectMapper om = new ObjectMapper();
om.configure(JsonParser.Feature.ALLOW_UNQUOTED_FIELD_NAMES, true);
String property = System.getProperties().getProperty(name);
property = property.replace('\u00A0', ' ');
return om.readValue(property, c);
} catch (Exception e) {
throw new IdentityConfigurationException("Couldn't load test identity " + name, e);
}
}
Aggregations