use of io.adminshell.aas.v3.model.impl.DefaultAssetAdministrationShellEnvironment in project FAAAST-Service by FraunhoferIOSB.
the class AASEnvironmentFactory method guessDeserializerAndTryToParse.
private AssetAdministrationShellEnvironment guessDeserializerAndTryToParse(String envFilePath, String env) {
Deserializer approxDeserializer = null;
String fileEnding = envFilePath.split("\\.")[1];
if (!envFilePath.equalsIgnoreCase(Application.DEFAULT_AASENV_PATH)) {
LOGGER.debug("Looking for Deserializer for file ending '" + fileEnding + "'");
approxDeserializer = deserializer.getOrDefault(deserializer.keySet().stream().filter(x -> x.equalsIgnoreCase(fileEnding)).findFirst().orElseGet(null), null);
}
if (approxDeserializer != null) {
try {
LOGGER.debug("Try resolving with '" + approxDeserializer.getClass().getSimpleName() + "'");
AssetAdministrationShellEnvironment environment = approxDeserializer.read(env);
// but returns an empty AASEnvironment
if (!Objects.equals(environment, new DefaultAssetAdministrationShellEnvironment())) {
return environment;
}
} catch (Exception ignored) {
LOGGER.debug("Resolving with '" + approxDeserializer.getClass().getSimpleName() + "' was not successfull. Try other Deserializers.");
}
}
return null;
}
use of io.adminshell.aas.v3.model.impl.DefaultAssetAdministrationShellEnvironment in project FAAAST-Service by FraunhoferIOSB.
the class StarterTest method testGetAASEnvironmentDefault.
@Test
public void testGetAASEnvironmentDefault() {
AssetAdministrationShellEnvironment expected = new DefaultAssetAdministrationShellEnvironment();
AssetAdministrationShellEnvironment actual = environmentFactory.getEmptyAASEnvironment();
Assert.assertEquals(expected, actual);
}
Aggregations