blob: 0b2c616cebe1a6e2d9d185c4adb80c8e115c8a07 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
package org.traccar;
import io.netty.buffer.ByteBuf;
import org.traccar.database.MediaManager;
import java.util.HashMap;
import java.util.Map;
public class BaseTest {
public static class MockMediaManager extends MediaManager {
Map<String, ByteBuf> files = new HashMap<>();
MockMediaManager() {
super("");
}
@Override
public String writeFile(String uniqueId, ByteBuf buf, String extension) {
String fileName = uniqueId + "/mock." + extension;
files.put(fileName, buf);
return fileName;
}
public ByteBuf readFile(String fileName) {
return files.get(fileName);
}
}
static {
Context.init(new TestIdentityManager(), new MockMediaManager());
}
}
|