Skip to content
Permalink
Browse files
Changed initialize payload to the version number as agreed.
  • Loading branch information
myrle-krantz committed Jul 10, 2017
1 parent 6b00c28 commit 486ae6b52dc351172e7a2c6be4b511914ebb3cb1
Showing 3 changed files with 10 additions and 4 deletions.
@@ -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();
@@ -103,7 +103,7 @@ public void cleanTest() {

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);
}
@@ -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 @@ 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 MigrationAggregate(@Qualifier(ServiceConstants.LOGGER_NAME) final Logger
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();
}
}

0 comments on commit 486ae6b

Please sign in to comment.