You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@fineract.apache.org by ik...@apache.org on 2019/09/02 22:39:31 UTC
[fineract-cn-template] 11/38: Changed initialize payload to the
version number as agreed.
This is an automated email from the ASF dual-hosted git repository.
ikamga pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/fineract-cn-template.git
commit 486ae6b52dc351172e7a2c6be4b511914ebb3cb1
Author: Myrle Krantz <my...@apache.org>
AuthorDate: Mon Jul 10 12:16:22 2017 +0200
Changed initialize payload to the version number as agreed.
---
.../src/main/java/io/mifos/template/SuiteTestEnvironment.java | 4 +++-
component-test/src/main/java/io/mifos/template/TestSample.java | 2 +-
.../service/internal/command/handler/MigrationAggregate.java | 8 ++++++--
3 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/component-test/src/main/java/io/mifos/template/SuiteTestEnvironment.java b/component-test/src/main/java/io/mifos/template/SuiteTestEnvironment.java
index dd5bfd0..923cf79 100644
--- a/component-test/src/main/java/io/mifos/template/SuiteTestEnvironment.java
+++ b/component-test/src/main/java/io/mifos/template/SuiteTestEnvironment.java
@@ -30,7 +30,9 @@ import org.junit.rules.TestRule;
* initializing and de-initializing external resources.
*/
public class SuiteTestEnvironment {
- static final String APP_NAME = "template-v1";
+ static final String APP_VERSION = "1";
+ static final String APP_NAME = "template-v" + APP_VERSION;
+
static final TestEnvironment testEnvironment = new TestEnvironment(APP_NAME);
static final CassandraInitializer cassandraInitializer = new CassandraInitializer();
static final MariaDBInitializer mariaDBInitializer = new MariaDBInitializer();
diff --git a/component-test/src/main/java/io/mifos/template/TestSample.java b/component-test/src/main/java/io/mifos/template/TestSample.java
index 924512b..92ae690 100644
--- a/component-test/src/main/java/io/mifos/template/TestSample.java
+++ b/component-test/src/main/java/io/mifos/template/TestSample.java
@@ -103,7 +103,7 @@ public class TestSample extends SuiteTestEnvironment {
public boolean waitForInitialize() {
try {
- return this.eventRecorder.wait(EventConstants.INITIALIZE, EventConstants.INITIALIZE);
+ return this.eventRecorder.wait(EventConstants.INITIALIZE, APP_VERSION);
} catch (final InterruptedException e) {
throw new IllegalStateException(e);
}
diff --git a/service/src/main/java/io/mifos/template/service/internal/command/handler/MigrationAggregate.java b/service/src/main/java/io/mifos/template/service/internal/command/handler/MigrationAggregate.java
index 920465a..12ae643 100644
--- a/service/src/main/java/io/mifos/template/service/internal/command/handler/MigrationAggregate.java
+++ b/service/src/main/java/io/mifos/template/service/internal/command/handler/MigrationAggregate.java
@@ -19,6 +19,7 @@ import io.mifos.core.command.annotation.Aggregate;
import io.mifos.core.command.annotation.CommandHandler;
import io.mifos.core.command.annotation.CommandLogLevel;
import io.mifos.core.command.annotation.EventEmitter;
+import io.mifos.core.lang.ApplicationName;
import io.mifos.core.mariadb.domain.FlywayFactoryBean;
import io.mifos.template.api.v1.events.EventConstants;
import io.mifos.template.service.ServiceConstants;
@@ -39,15 +40,18 @@ public class MigrationAggregate {
private final Logger logger;
private final DataSource dataSource;
private final FlywayFactoryBean flywayFactoryBean;
+ private final ApplicationName applicationName;
@Autowired
public MigrationAggregate(@Qualifier(ServiceConstants.LOGGER_NAME) final Logger logger,
final DataSource dataSource,
- final FlywayFactoryBean flywayFactoryBean) {
+ final FlywayFactoryBean flywayFactoryBean,
+ final ApplicationName applicationName) {
super();
this.logger = logger;
this.dataSource = dataSource;
this.flywayFactoryBean = flywayFactoryBean;
+ this.applicationName = applicationName;
}
@CommandHandler(logStart = CommandLogLevel.INFO, logFinish = CommandLogLevel.INFO)
@@ -56,6 +60,6 @@ public class MigrationAggregate {
public String initialize(final InitializeServiceCommand initializeServiceCommand) {
this.logger.debug("Start service migration.");
this.flywayFactoryBean.create(this.dataSource).migrate();
- return EventConstants.INITIALIZE;
+ return this.applicationName.getVersionString();
}
}