### Question:
Migrator { public void migrateNonPersistedModelFromRedis() throws UnknownHostException, IOException { RedisDao dao = RedisDaoFactory.getInstance(); Jedis jedis = new Jedis(host, port); jedis.connect(); jedis.select(database); long len = jedis.llen(MachineListKey); for (int i = 0; i < len; i++) { insertMachineFromCSVLine(dao, jedis.lindex(MachineListKey, i)); } jedis.del(MachineListKey); jedis.disconnect(); } Migrator(String host, int port, int database); void migratePersistedModel(); void migrateNonPersistedModelFromFile(final File file); void migrateNonPersistedModelFromRedis(); int getMachinesCount(); int getSubscriptionsCount(); static void main(String[] args); final static String MachineListKey; }### Answer:
@Test(enabled = false) public void test_NonPersistedMigration() throws UnknownHostException, IOException { Jedis jedis = new Jedis(TEST_HOST, TEST_PORT); jedis.select(TEST_DATABASE); jedis.connect(); jedis.lpush(Migrator.MachineListKey, "10.60.1.74,8889,root,temp0,XEN_3"); jedis.lpush(Migrator.MachineListKey, "10.60.1.71,443,root,temp1,VMX_04"); jedis.disconnect(); new Migrator(TEST_HOST, TEST_PORT, TEST_DATABASE).migrateNonPersistedModelFromRedis(); jedis.connect(); jedis.select(TEST_DATABASE); assertFalse(jedis.exists(Migrator.MachineListKey)); jedis.disconnect(); RedisTestDaoFactory.selectDatabase(TEST_HOST, TEST_PORT, TEST_DATABASE); assertEquals(dao.findAllPhysicalMachines().size(), 2); PhysicalMachine machine0 = dao.findPhysicalMachineByAddress("http: PhysicalMachine machine1 = dao.findPhysicalMachineByAddress("http: assertNotNull(machine0); assertNotNull(machine1); assertEquals(machine0.getAddress(), "http: assertEquals(machine0.getType(), "XEN_3"); assertEquals(machine0.getUsername(), "root"); assertEquals(machine0.getPassword(), "temp0"); assertEquals(machine1.getAddress(), "http: assertEquals(machine1.getType(), "VMX_04"); assertEquals(machine1.getUsername(), "root"); assertEquals(machine1.getPassword(), "temp1"); }