Search in sources :

Example 1 with UtilitiesDatabase

use of com.amaze.filemanager.database.UtilitiesDatabase in project AmazeFileManager by TeamAmaze.

the class ShadowCryptUtilTest method testWithUtilsHandler.

@Test
public void testWithUtilsHandler() {
    UtilitiesDatabase utilitiesDatabase = UtilitiesDatabase.initialize(ApplicationProvider.getApplicationContext());
    UtilsHandler utilsHandler = new UtilsHandler(ApplicationProvider.getApplicationContext(), utilitiesDatabase);
    String fingerprint = "00:11:22:33:44:55:66:77:88:99:aa:bb:cc:dd:ee:ff";
    String url = "ssh://test:test@127.0.0.1:22";
    utilsHandler.saveToDatabase(new OperationData(UtilsHandler.Operation.SFTP, SshClientUtils.encryptSshPathAsNecessary(url), "Test", fingerprint, null, null));
    await().atMost(10, TimeUnit.SECONDS).until(() -> {
        assertEquals(fingerprint, utilsHandler.getSshHostKey(SshClientUtils.encryptSshPathAsNecessary(url)));
        utilitiesDatabase.close();
        return true;
    });
}
Also used : OperationData(com.amaze.filemanager.database.models.OperationData) UtilitiesDatabase(com.amaze.filemanager.database.UtilitiesDatabase) UtilsHandler(com.amaze.filemanager.database.UtilsHandler) Test(org.junit.Test)

Aggregations

UtilitiesDatabase (com.amaze.filemanager.database.UtilitiesDatabase)1 UtilsHandler (com.amaze.filemanager.database.UtilsHandler)1 OperationData (com.amaze.filemanager.database.models.OperationData)1 Test (org.junit.Test)1