*/
public void insertImage(TemporaryImage temporaryImage, Image image, InsertToken insertToken) throws SoneException {
String filenameHint = image.getId() + "." + temporaryImage.getMimeType().substring(temporaryImage.getMimeType().lastIndexOf("/") + 1);
- InsertableClientSSK key = InsertableClientSSK.createRandom(node.random, "");
+ InsertableClientSSK key = InsertableClientSSK.createRandom(node.getRandom(), "");
FreenetURI targetUri = key.getInsertURI().setDocName(filenameHint);
InsertContext insertContext = client.getInsertContext(true);
RandomAccessBucket bucket = new ArrayBucket(temporaryImage.getImageData());
@Provides
fun getNodeClientCore(node: Node): NodeClientCore =
- node.clientCore
+ node.getClientCore()
@Provides
fun getHighLevelSimpleClientCreator(nodeClientCore: NodeClientCore): HighLevelSimpleClientCreator =
@Provides
fun getClientContext(nodeClientCore: NodeClientCore): ClientContext =
- nodeClientCore.clientContext
+ nodeClientCore.getClientContext()
@Provides
fun getUskManager(nodeClientCore: NodeClientCore): USKManager =
- nodeClientCore.uskManager
+ nodeClientCore.getUskManager()
}
private val freenetInterface: FreenetInterface
init {
- setField(node, "random", randomSource)
+ whenever(node.getRandom()).thenReturn(randomSource)
freenetInterface = FreenetInterface(eventBus, node, uskManager, clientContext, soneUriCreator) { _, _, _ -> highLevelSimpleClient }
insertToken = freenetInterface.InsertToken(image)
insertToken.setBucket(bucket)
whenever(getSessionManager("Sone")).thenReturn(sessionManager)
}
private val nodeClientCore = mock<NodeClientCore>().also {
- setField(it, "uskManager", uskManager)
- setField(it, "clientContext", clientContext)
+ whenever(it.getUskManager()).thenReturn(uskManager)
+ whenever(it.getClientContext()).thenReturn(clientContext)
}
private val node = pluginRespirator.node!!.also {
- setField(it, "clientCore", nodeClientCore)
+ whenever(it.getClientCore()).thenReturn(nodeClientCore)
}
private val highLevelSimpleClient = pluginRespirator.hlSimpleClient!!
private val toadletContainer: ToadletContainer = pluginRespirator.toadletContainer
private val uskManager = deepMock<USKManager>()
init {
- setField(node, "clientCore", clientCore)
+ whenever(node.getClientCore()).thenReturn(clientCore)
whenever(pluginRespirator.node).thenReturn(node)
- setField(clientCore, "uskManager", uskManager)
- setField(clientCore, "clientContext", mock<ClientContext>())
+ whenever(clientCore.getUskManager()).thenReturn(uskManager)
+ whenever(clientCore.getClientContext()).thenReturnMock()
}
@Test