Search in sources :

Example 1 with MigrationTask

use of com.zimbra.cs.ephemeral.migrate.AttributeMigration.MigrationTask in project zm-mailbox by Zimbra.

the class MigrateAttributesTest method testCsrfTokenMigrationTask.

/*
     * Test MigrationTask for CSRF tokens
     */
@Test
public void testCsrfTokenMigrationTask() throws ServiceException {
    List<EphemeralInput> results = new LinkedList<EphemeralInput>();
    Map<String, AttributeConverter> converters = new HashMap<String, AttributeConverter>();
    converters.put(Provisioning.A_zimbraCsrfTokenData, new CsrfTokenConverter());
    MigrationTask task = new MigrationTask(acct, converters, new DummyMigrationCallback(results));
    task.migrateAttributes();
    assertEquals(2, results.size());
    verifyCsrfTokenEphemeralInput(results.get(0), "crumb1", "data1", 100000L);
    verifyCsrfTokenEphemeralInput(results.get(1), "crumb2", "data2", 100000L);
}
Also used : MigrationTask(com.zimbra.cs.ephemeral.migrate.AttributeMigration.MigrationTask) HashMap(java.util.HashMap) EphemeralInput(com.zimbra.cs.ephemeral.EphemeralInput) LinkedList(java.util.LinkedList) Test(org.junit.Test)

Example 2 with MigrationTask

use of com.zimbra.cs.ephemeral.migrate.AttributeMigration.MigrationTask in project zm-mailbox by Zimbra.

the class MigrateAttributesTest method testAuthTokenMigrationTask.

/*
     * Test MigrationTask for auth tokens
     */
@Test
public void testAuthTokenMigrationTask() throws ServiceException {
    List<EphemeralInput> results = new LinkedList<EphemeralInput>();
    Map<String, AttributeConverter> converters = new HashMap<String, AttributeConverter>();
    converters.put(Provisioning.A_zimbraAuthTokens, new AuthTokenConverter());
    MigrationTask task = new MigrationTask(acct, converters, new DummyMigrationCallback(results));
    task.migrateAttributes();
    assertEquals(2, results.size());
    verifyAuthTokenEphemeralInput(results.get(0), "1234", "server_1", 100000L);
    verifyAuthTokenEphemeralInput(results.get(1), "5678", "server_2", 100000L);
}
Also used : MigrationTask(com.zimbra.cs.ephemeral.migrate.AttributeMigration.MigrationTask) HashMap(java.util.HashMap) EphemeralInput(com.zimbra.cs.ephemeral.EphemeralInput) LinkedList(java.util.LinkedList) Test(org.junit.Test)

Example 3 with MigrationTask

use of com.zimbra.cs.ephemeral.migrate.AttributeMigration.MigrationTask in project zm-mailbox by Zimbra.

the class MigrateAttributesTest method testLastLogonTimestampMigrationTask.

/*
     * Test MigrationTask for last login timestamp
     */
@Test
public void testLastLogonTimestampMigrationTask() throws ServiceException {
    List<EphemeralInput> results = new LinkedList<EphemeralInput>();
    Map<String, AttributeConverter> converters = new HashMap<String, AttributeConverter>();
    converters.put(Provisioning.A_zimbraLastLogonTimestamp, new StringAttributeConverter());
    MigrationTask task = new MigrationTask(acct, converters, new DummyMigrationCallback(results));
    task.migrateAttributes();
    assertEquals(1, results.size());
    verifyLastLogonTimestampEphemeralInput(results.get(0), "currentdate");
}
Also used : MigrationTask(com.zimbra.cs.ephemeral.migrate.AttributeMigration.MigrationTask) HashMap(java.util.HashMap) EphemeralInput(com.zimbra.cs.ephemeral.EphemeralInput) LinkedList(java.util.LinkedList) Test(org.junit.Test)

Aggregations

EphemeralInput (com.zimbra.cs.ephemeral.EphemeralInput)3 MigrationTask (com.zimbra.cs.ephemeral.migrate.AttributeMigration.MigrationTask)3 HashMap (java.util.HashMap)3 LinkedList (java.util.LinkedList)3 Test (org.junit.Test)3