use of pl.edu.icm.unity.engine.api.files.FileStorageService in project unity by unity-idm.
the class MetadataSourceHandlerTest method init.
@Before
public void init() throws EngineException, IOException, URISyntaxException {
executorsService = mock(ExecutorsService.class);
ScheduledExecutorService pool = Executors.newScheduledThreadPool(1);
when(executorsService.getService()).thenReturn(pool);
src = new RemoteMetadataSrc("http://url", null);
fileStorageService = mock(FileStorageService.class);
uriAccessService = mock(URIAccessService.class);
when(fileStorageService.readFileFromWorkspace(any())).thenThrow(EngineException.class);
when(uriAccessService.readURI(eq(new URI("http://url")))).thenAnswer((a) -> new FileData("xx", Files.readAllBytes(Paths.get("src/test/resources/unity-as-sp-meta.xml")), new Date()));
when(uriAccessService.readURI(eq(new URI("http://url")), any())).thenAnswer((a) -> new FileData("xx", Files.readAllBytes(Paths.get("src/test/resources/unity-as-sp-meta.xml")), new Date()));
when(fileStorageService.storeFileInWorkspace(any(), any())).thenAnswer((a) -> new FileData("xx", Files.readAllBytes(Paths.get("src/test/resources/unity-as-sp-meta.xml")), new Date()));
}
Aggregations