@Test void noUpdateIfCreateTransaction() throws Exception { AccountInfo.Builder accountInfo = accountInfo(); write(accountInfo.build()); Entities entity = entity(accountId.getAccountNum()); Entities node = entity(2); Entities payer = entity(3); long transactionTypeId = jdbcTemplate .queryForObject("select id from t_transaction_types where name = ?", new Object[] { "CRYPTOCREATEACCOUNT"}, Integer.class); jdbcTemplate.update("insert into t_transactions (consensus_ns, entity_id, node_account_id, payer_account_id, " + "fk_trans_type_id, valid_start_ns) " + "values(?,?,?,?,?,?,?)", 1L, entity.getId(), node.getId(), payer.getId(), payer.getEntityNum(), transactionTypeId, 1L); migration.migrate(new FlywayContext()); Assertions.assertThat(entityRepository.findAll()) .extracting(Entities::getEntityNum) .containsExactlyInAnyOrder(entity.getEntityNum(), node.getEntityNum(), payer.getEntityNum()); Assertions.assertThat(entityRepository.findById(entity.getId())) .get() .extracting(Entities::getKey) .withFailMessage("Expecting entity <%d> to not be updated", entity.getEntityNum()) .isNull(); }
@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);  }