Commit 9a8a808c authored by descamps's avatar descamps
Browse files

Test File InputStream AUP outside Resource rng

parent dd95fd8c
......@@ -61,6 +61,7 @@ import org.json.JSONTokener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.InputStreamResource;
import org.springframework.core.io.Resource;
import org.springframework.core.io.ResourceLoader;
import org.springframework.core.io.support.ResourcePatternUtils;
......@@ -172,14 +173,20 @@ public class PastisService {
}
public ProfileResponse createProfile(String type) throws TechnicalException, NoSuchAlgorithmException {
Resource resource;
Resource resource = null;
ProfileResponse profileResponse = null;
if (type != null && !type.isEmpty()) {
ProfileType profileType = ProfileType.valueOf(type);
if (type.equals(ProfileType.PA.getType())) {
resource = new ClassPathResource(rngFile);
} else {
resource = new ClassPathResource(jsonFile);
try {
FileInputStream fileInputStream = new FileInputStream("/vitamui/data/pastis-external/AUP_default_PASTIS.json");
resource = new InputStreamResource(fileInputStream);
} catch (FileNotFoundException e) {
e.printStackTrace();
}
//resource = new ClassPathResource(jsonFile);
}
profileResponse = createProfileByType(resource, profileType);
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment