Search in sources :

Example 1 with JournalEncryptionWrapper

use of net.viperfish.journal.framework.provider.JournalEncryptionWrapper in project vsDiaryWriter by shilongdai.

the class OperationTest method testChangeConfig.

@Test
public void testChangeConfig() throws FailToSyncEntryException {
    cleanUp();
    Map<String, String> testConfig = new HashMap<>();
    addEntries(10);
    testConfig.put("viperfish.secure.encrytion.algorithm", "DES");
    testConfig.put(ConfigMapping.DB_COMPONENT, "H2Database");
    new ChangeConfigurationOperation(testConfig).execute();
    Assert.assertEquals("DES", Configuration.getString("viperfish.secure.encrytion.algorithm"));
    Assert.assertEquals("H2Database", Configuration.getString(ConfigMapping.DB_COMPONENT));
    initComponents();
    Assert.assertEquals(((JournalEncryptionWrapper) db).getDb().getClass(), ((JournalEncryptionWrapper) EntryDatabases.INSTANCE.getEntryDatabase("H2Database")).getDb().getClass());
    for (Journal i : db.getAll()) {
        Assert.assertEquals("test", i.getContent());
    }
    setupConfig();
    initComponents();
    cleanUp();
}
Also used : HashMap(java.util.HashMap) JournalEncryptionWrapper(net.viperfish.journal.framework.provider.JournalEncryptionWrapper) Journal(net.viperfish.journal.framework.Journal) Test(org.junit.Test)

Aggregations

HashMap (java.util.HashMap)1 Journal (net.viperfish.journal.framework.Journal)1 JournalEncryptionWrapper (net.viperfish.journal.framework.provider.JournalEncryptionWrapper)1 Test (org.junit.Test)1