@Test void updateIfNoCreateTransaction() throws Exception { Entities entity = entity(accountId.getAccountNum()); AccountInfo.Builder accountInfo = accountInfo(); write(accountInfo.build()); migration.migrate(new FlywayContext()); Assertions.assertThat(entityRepository.findById(entity.getId())) .get() .returns(accountInfo.getAutoRenewPeriod().getSeconds(), from(Entities::getAutoRenewPeriod)) .returns(Utility.protobufKeyToHexIfEd25519OrNull(accountInfo.getKey() .toByteArray()), from(Entities::getEd25519PublicKeyHex)) .returns(Utility.timeStampInNanos(accountInfo.getExpirationTime()), from(Entities::getExpiryTimeNs)) .returns(accountInfo.getKey().toByteArray(), from(Entities::getKey)); }
@Override public void migrate(Context context) throws Exception { File accountInfoFile = getAccountInfoPath().toFile(); if (!accountInfoFile.exists() || !accountInfoFile.canRead()) { log.warn("Skipping entity import due to missing file {}", accountInfoFile.getAbsoluteFile()); return; } log.info("Importing account file {}", accountInfoFile.getAbsoluteFile()); Stopwatch stopwatch = Stopwatch.createStarted(); long count = 0L; try (BufferedReader reader = new BufferedReader(new FileReader(accountInfoFile))) { String line; while ((line = reader.readLine()) != null) { try { if (StringUtils.isNotBlank(line)) { updateAccount(line); } ++count; } catch (Exception e) { log.error("Unable to load AccountInfo: {}", line, e); } } } log.info("Successfully loaded {} accounts in {}", count, stopwatch); }
V1_11_6__Missing_Entities extends BaseJavaMigration { @Override public void migrate(Context context) throws Exception { File accountInfoFile = getAccountInfoPath().toFile(); if (!accountInfoFile.exists() || !accountInfoFile.canRead()) { log.warn("Skipping entity import due to missing file {}", accountInfoFile.getAbsoluteFile()); return; } log.info("Importing account file {}", accountInfoFile.getAbsoluteFile()); Stopwatch stopwatch = Stopwatch.createStarted(); long count = 0L; try (BufferedReader reader = new BufferedReader(new FileReader(accountInfoFile))) { String line; while ((line = reader.readLine()) != null) { try { if (StringUtils.isNotBlank(line)) { updateAccount(line); } ++count; } catch (Exception e) { log.error("Unable to load AccountInfo: {}", line, e); } } } log.info("Successfully loaded {} accounts in {}", count, stopwatch); } }
V1_11_6__Missing_Entities extends BaseJavaMigration { @Override public void migrate(Context context) throws Exception { File accountInfoFile = getAccountInfoPath().toFile(); if (!accountInfoFile.exists() || !accountInfoFile.canRead()) { log.warn("Skipping entity import due to missing file {}", accountInfoFile.getAbsoluteFile()); return; } log.info("Importing account file {}", accountInfoFile.getAbsoluteFile()); Stopwatch stopwatch = Stopwatch.createStarted(); long count = 0L; try (BufferedReader reader = new BufferedReader(new FileReader(accountInfoFile))) { String line; while ((line = reader.readLine()) != null) { try { if (StringUtils.isNotBlank(line)) { updateAccount(line); } ++count; } catch (Exception e) { log.error("Unable to load AccountInfo: {}", line, e); } } } log.info("Successfully loaded {} accounts in {}", count, stopwatch); } V1_11_6__Missing_Entities(MirrorProperties mirrorProperties, @Lazy EntityRepository entityRepository,
                                     @Lazy JdbcOperations jdbcOperations); }
V1_11_6__Missing_Entities extends BaseJavaMigration { @Override public void migrate(Context context) throws Exception { File accountInfoFile = getAccountInfoPath().toFile(); if (!accountInfoFile.exists() || !accountInfoFile.canRead()) { log.warn("Skipping entity import due to missing file {}", accountInfoFile.getAbsoluteFile()); return; } log.info("Importing account file {}", accountInfoFile.getAbsoluteFile()); Stopwatch stopwatch = Stopwatch.createStarted(); long count = 0L; try (BufferedReader reader = new BufferedReader(new FileReader(accountInfoFile))) { String line; while ((line = reader.readLine()) != null) { try { if (StringUtils.isNotBlank(line)) { updateAccount(line); } ++count; } catch (Exception e) { log.error("Unable to load AccountInfo: {}", line, e); } } } log.info("Successfully loaded {} accounts in {}", count, stopwatch); } V1_11_6__Missing_Entities(MirrorProperties mirrorProperties, @Lazy EntityRepository entityRepository,
                                     @Lazy JdbcOperations jdbcOperations); @Override void migrate(Context context); }
V1_11_6__Missing_Entities extends BaseJavaMigration { @Override public void migrate(Context context) throws Exception { File accountInfoFile = getAccountInfoPath().toFile(); if (!accountInfoFile.exists() || !accountInfoFile.canRead()) { log.warn("Skipping entity import due to missing file {}", accountInfoFile.getAbsoluteFile()); return; } log.info("Importing account file {}", accountInfoFile.getAbsoluteFile()); Stopwatch stopwatch = Stopwatch.createStarted(); long count = 0L; try (BufferedReader reader = new BufferedReader(new FileReader(accountInfoFile))) { String line; while ((line = reader.readLine()) != null) { try { if (StringUtils.isNotBlank(line)) { updateAccount(line); } ++count; } catch (Exception e) { log.error("Unable to load AccountInfo: {}", line, e); } } } log.info("Successfully loaded {} accounts in {}", count, stopwatch); } V1_11_6__Missing_Entities(MirrorProperties mirrorProperties, @Lazy EntityRepository entityRepository,
                                     @Lazy JdbcOperations jdbcOperations); @Override void migrate(Context context);  }