Changed initialize payload to the version number as agreed.
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 @@
* 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 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.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 @@
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 String initialize(final InitializeServiceCommand initializeServiceCommand) {
this.logger.debug("Start service migration.");
this.flywayFactoryBean.create(this.dataSource).migrate();
- return EventConstants.INITIALIZE;
+ return this.applicationName.getVersionString();
}
}