Skip to content
Permalink
Browse files
Merge pull request #5 from markvanveen/develop
Add cheque service
  • Loading branch information
markvanveen committed Aug 28, 2017
2 parents 5e1ba75 + 2384b0a commit 3920c30222ce5e4e891760a48714d2c301d90210
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 2 deletions.
@@ -32,6 +32,7 @@ ext.versions = [
mifosdeposit : '0.1.0-BUILD-SNAPSHOT',
mifosteller : '0.1.0-BUILD-SNAPSHOT',
mifosreporting : '0.1.0-BUILD-SNAPSHOT',
kuelapcheques : '0.1.0-BUILD-SNAPSHOT',
frameworkapi : '0.1.0-BUILD-SNAPSHOT',
frameworklang : '0.1.0-BUILD-SNAPSHOT',
frameworktest : '0.1.0-BUILD-SNAPSHOT',
@@ -86,6 +87,7 @@ dependencies {
[group: 'io.mifos.deposit-account-management', name: 'api', version: versions.mifosdeposit],
[group: 'io.mifos.teller', name: 'api', version: versions.mifosteller],
[group: 'io.mifos.reporting', name: 'api', version: versions.mifosreporting],
[group: 'io.mifos.cheques', name: 'api', version: versions.kuelapcheques],

[group: 'io.mifos.anubis', name: 'api', version: versions.frameworkanubis],
[group: 'io.mifos.anubis', name: 'test', version: versions.frameworkanubis],
@@ -21,6 +21,7 @@
import io.mifos.accounting.importer.AccountImporter;
import io.mifos.accounting.importer.LedgerImporter;
import io.mifos.anubis.api.v1.domain.AllowedOperation;
import io.mifos.cheque.api.v1.client.ChequeManager;
import io.mifos.core.api.config.EnableApiFactory;
import io.mifos.core.api.context.AutoGuest;
import io.mifos.core.api.context.AutoSeshat;
@@ -102,6 +103,7 @@ public class ServiceRunner {
private static Microservice<DepositAccountManager> depositAccountManager;
private static Microservice<TellerManager> tellerManager;
private static Microservice<ReportManager> reportManager;
private static Microservice<ChequeManager> chequeManager;


private static DB embeddedMariaDb;
@@ -209,7 +211,8 @@ public void before() throws Exception

ServiceRunner.portfolioManager = new Microservice<>(PortfolioManager.class, "portfolio", "0.1.0-BUILD-SNAPSHOT", ServiceRunner.INTEGRATION_TEST_ENVIRONMENT)
.addProperties(new ExtraProperties() {{
setProperty("portfolio.bookLateFeesAndInterestAsUser", SCHEDULER_USER_NAME);}});
setProperty("portfolio.bookLateFeesAndInterestAsUser", SCHEDULER_USER_NAME);
}});
startService(generalProperties, portfolioManager);

ServiceRunner.depositAccountManager = new Microservice<>(DepositAccountManager.class, "deposit-account-management", "0.1.0-BUILD-SNAPSHOT", ServiceRunner.INTEGRATION_TEST_ENVIRONMENT);
@@ -220,10 +223,14 @@ public void before() throws Exception

ServiceRunner.reportManager = new Microservice<>(ReportManager.class, "reporting", "0.1.0-BUILD-SNAPSHOT", ServiceRunner.INTEGRATION_TEST_ENVIRONMENT);
startService(generalProperties, ServiceRunner.reportManager);

ServiceRunner.chequeManager = new Microservice<>(ChequeManager.class, "cheques", "0.1.0-BUILD-SNAPSHOT", ServiceRunner.INTEGRATION_TEST_ENVIRONMENT);
startService(generalProperties, ServiceRunner.chequeManager);
}

@After
public void tearDown() throws Exception {
ServiceRunner.chequeManager.kill();
ServiceRunner.reportManager.kill();
ServiceRunner.tellerManager.kill();
ServiceRunner.depositAccountManager.kill();
@@ -261,6 +268,7 @@ public void startDevServer() throws InterruptedException, IOException, ArtifactR
System.out.println("Deposit Service: " + ServiceRunner.depositAccountManager.getProcessEnvironment().serverURI());
System.out.println("Teller Service: " + ServiceRunner.tellerManager.getProcessEnvironment().serverURI());
System.out.println("Reporting Service: " + ServiceRunner.reportManager.getProcessEnvironment().serverURI());
System.out.println("Cheque Service: " + ServiceRunner.chequeManager.getProcessEnvironment().serverURI());

boolean run = true;

@@ -321,7 +329,8 @@ private void provisionAppsViaSeshat() throws InterruptedException, IOException {
ApplicationBuilder.create(ServiceRunner.portfolioManager.name(), ServiceRunner.portfolioManager.uri()),
ApplicationBuilder.create(ServiceRunner.depositAccountManager.name(), ServiceRunner.depositAccountManager.uri()),
ApplicationBuilder.create(ServiceRunner.tellerManager.name(), ServiceRunner.tellerManager.uri()),
ApplicationBuilder.create(ServiceRunner.reportManager.name(), ServiceRunner.reportManager.uri())
ApplicationBuilder.create(ServiceRunner.reportManager.name(), ServiceRunner.reportManager.uri()),
ApplicationBuilder.create(ServiceRunner.chequeManager.name(), ServiceRunner.chequeManager.uri())
);

final List<Tenant> tenantsToCreate = Arrays.asList(
@@ -420,6 +429,8 @@ private String provisionAppsViaSeshatForTenant(final Tenant tenant) throws Inter

provisionApp(tenant, ServiceRunner.reportManager, io.mifos.reporting.api.v1.EventConstants.INITIALIZE);

provisionApp(tenant, ServiceRunner.chequeManager, io.mifos.cheque.api.v1.EventConstants.INITIALIZE);

final UserWithPassword orgAdminUserPassword = createOrgAdminRoleAndUser(tenantAdminPassword.getAdminPassword());

createChartOfAccounts(orgAdminUserPassword);
@@ -0,0 +1,47 @@
/*
* Copyright 2016 The Mifos Initiative.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.mifos.dev.listener;

import io.mifos.cheque.api.v1.EventConstants;
import io.mifos.core.lang.config.TenantHeaderFilter;
import io.mifos.core.test.listener.EventRecorder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jms.annotation.JmsListener;
import org.springframework.messaging.handler.annotation.Header;
import org.springframework.stereotype.Component;

@SuppressWarnings("unused")
@Component
public class ChequesListener {

private final EventRecorder eventRecorder;

@Autowired
public ChequesListener(final EventRecorder eventRecorder) {
this.eventRecorder = eventRecorder;
}

@JmsListener(
subscription = EventConstants.DESTINATION,
destination = EventConstants.DESTINATION,
selector = EventConstants.SELECTOR_INITIALIZE
)
public void onInitialized(@Header(TenantHeaderFilter.TENANT_HEADER) final String tenant,
final String payload) {
this.eventRecorder.event(tenant, EventConstants.INITIALIZE, payload, String.class);
}
}

0 comments on commit 3920c30

Please sign in to comment.