Skip to content
This repository has been archived by the owner on Jan 11, 2024. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
added missing services
fixed retrieving of csv resources
  • Loading branch information
mgeiss committed Aug 15, 2017
1 parent 59a4abf commit f536d56
Show file tree
Hide file tree
Showing 5 changed files with 168 additions and 3 deletions.
4 changes: 4 additions & 0 deletions build.gradle
Expand Up @@ -30,6 +30,8 @@ ext.versions = [
mifosaccounting : '0.1.0-BUILD-SNAPSHOT',
mifosportfolio : '0.1.0-BUILD-SNAPSHOT',
mifosdeposit : '0.1.0-BUILD-SNAPSHOT',
mifosteller : '0.1.0-BUILD-SNAPSHOT',
mifosreporting : '0.1.0-BUILD-SNAPSHOT',
frameworkapi : '0.1.0-BUILD-SNAPSHOT',
frameworklang : '0.1.0-BUILD-SNAPSHOT',
frameworktest : '0.1.0-BUILD-SNAPSHOT',
Expand Down Expand Up @@ -82,6 +84,8 @@ dependencies {
[group: 'io.mifos.accounting', name: 'importer', version: versions.mifosaccounting],
[group: 'io.mifos.portfolio', name: 'api', version: versions.mifosportfolio],
[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.anubis', name: 'api', version: versions.frameworkanubis],
[group: 'io.mifos.anubis', name: 'test', version: versions.frameworkanubis],
Expand Down
29 changes: 26 additions & 3 deletions src/main/java/io/mifos/dev/ServiceRunner.java
Expand Up @@ -49,8 +49,10 @@
import io.mifos.portfolio.api.v1.client.PortfolioManager;
import io.mifos.provisioner.api.v1.client.Provisioner;
import io.mifos.provisioner.api.v1.domain.*;
import io.mifos.reporting.api.v1.client.ReportManager;
import io.mifos.rhythm.api.v1.client.RhythmManager;
import io.mifos.rhythm.api.v1.events.BeatEvent;
import io.mifos.teller.api.v1.client.TellerManager;
import org.cassandraunit.utils.EmbeddedCassandraServerHelper;
import org.eclipse.aether.resolution.ArtifactResolutionException;
import org.junit.*;
Expand Down Expand Up @@ -97,6 +99,9 @@ public class ServiceRunner {
private static Microservice<LedgerManager> ledgerManager;
private static Microservice<PortfolioManager> portfolioManager;
private static Microservice<DepositAccountManager> depositAccountManager;
private static Microservice<TellerManager> tellerManager;
private static Microservice<ReportManager> reportManager;


private static DB embeddedMariaDb;

Expand Down Expand Up @@ -208,10 +213,18 @@ public void before() throws Exception

ServiceRunner.depositAccountManager = new Microservice<>(DepositAccountManager.class, "deposit-account-management", "0.1.0-BUILD-SNAPSHOT", ServiceRunner.INTEGRATION_TEST_ENVIRONMENT);
startService(generalProperties, depositAccountManager);

ServiceRunner.tellerManager = new Microservice<>(TellerManager.class, "teller", "0.1.0-BUILD-SNAPSHOT", ServiceRunner.INTEGRATION_TEST_ENVIRONMENT);
startService(generalProperties, ServiceRunner.tellerManager);

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

@After
public void tearDown() throws Exception {
ServiceRunner.reportManager.kill();
ServiceRunner.tellerManager.kill();
ServiceRunner.depositAccountManager.kill();
ServiceRunner.rhythmManager.kill();
ServiceRunner.portfolioManager.kill();
Expand Down Expand Up @@ -245,6 +258,8 @@ public void startDevServer() throws InterruptedException, IOException, ArtifactR
System.out.println("Accounting Service: " + ServiceRunner.ledgerManager.getProcessEnvironment().serverURI());
System.out.println("Portfolio Service: " + ServiceRunner.portfolioManager.getProcessEnvironment().serverURI());
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());

boolean run = true;

Expand Down Expand Up @@ -303,7 +318,9 @@ private void provisionAppsViaSeshat() throws InterruptedException, IOException {
ApplicationBuilder.create(ServiceRunner.customerManager.name(), ServiceRunner.customerManager.uri()),
ApplicationBuilder.create(ServiceRunner.ledgerManager.name(), ServiceRunner.ledgerManager.uri()),
ApplicationBuilder.create(ServiceRunner.portfolioManager.name(), ServiceRunner.portfolioManager.uri()),
ApplicationBuilder.create(ServiceRunner.depositAccountManager.name(), ServiceRunner.depositAccountManager.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())
);

final List<Tenant> tenantsToCreate = Arrays.asList(
Expand Down Expand Up @@ -362,6 +379,8 @@ private String provisionAppsViaSeshatForTenant(final Tenant tenant) throws Inter
Assert.assertTrue(this.eventRecorder.wait(EventConstants.OPERATION_PUT_APPLICATION_PERMISSION_USER_ENABLED, new ApplicationPermissionUserEvent(rhythmManager.name(), io.mifos.identity.api.v1.PermittableGroupIds.APPLICATION_SELF_MANAGEMENT, schedulerUser.getIdentifier())));
}

provisionApp(tenant, ServiceRunner.organizationManager, io.mifos.office.api.v1.EventConstants.INITIALIZE);

provisionApp(tenant, ledgerManager, io.mifos.accounting.api.v1.EventConstants.INITIALIZE);

provisionApp(tenant, portfolioManager, io.mifos.portfolio.api.v1.events.EventConstants.INITIALIZE);
Expand Down Expand Up @@ -394,6 +413,10 @@ private String provisionAppsViaSeshatForTenant(final Tenant tenant) throws Inter

provisionApp(tenant, depositAccountManager, io.mifos.deposit.api.v1.EventConstants.INITIALIZE);

provisionApp(tenant, ServiceRunner.tellerManager, io.mifos.teller.api.v1.EventConstants.INITIALIZE);

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

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

createChartOfAccounts(orgAdminUserPassword);
Expand All @@ -410,12 +433,12 @@ private void createChartOfAccounts(final UserWithPassword userWithPassword) thro

try (final AutoUserContext ignored = new AutoUserContext(userWithPassword.getIdentifier(), authentication.getAccessToken())) {
final LedgerImporter ledgerImporter = new LedgerImporter(ledgerManager.api(), logger);
final URL ledgersUrl = ClassLoader.getSystemResource("standardChartOfAccounts/ledgers.csv");
final URL ledgersUrl = ServiceRunner.class.getResource("/standardChartOfAccounts/ledgers.csv");
ledgerImporter.importCSV(ledgersUrl);
Assert.assertTrue(this.eventRecorder.wait(POST_LEDGER, LOAN_INCOME_LEDGER));

final AccountImporter accountImporter = new AccountImporter(ledgerManager.api(), logger);
final URL accountsUrl = ClassLoader.getSystemResource("standardChartOfAccounts/accounts.csv");
final URL accountsUrl = ServiceRunner.class.getResource("/standardChartOfAccounts/accounts.csv");
accountImporter.importCSV(accountsUrl);
Assert.assertTrue(this.eventRecorder.wait(POST_ACCOUNT, "9330"));

Expand Down
@@ -0,0 +1,46 @@
/*
* Copyright 2017 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.core.lang.config.TenantHeaderFilter;
import io.mifos.core.test.listener.EventRecorder;
import io.mifos.deposit.api.v1.EventConstants;
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 DepositAccountManagementListener {

private final EventRecorder eventRecorder;

@Autowired
public DepositAccountManagementListener(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);
}
}
46 changes: 46 additions & 0 deletions src/main/java/io/mifos/dev/listener/ReportingListener.java
@@ -0,0 +1,46 @@
/*
* Copyright 2017 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.core.lang.config.TenantHeaderFilter;
import io.mifos.core.test.listener.EventRecorder;
import io.mifos.reporting.api.v1.EventConstants;
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 ReportingListener {

private final EventRecorder eventRecorder;

@Autowired
public ReportingListener(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);
}
}
46 changes: 46 additions & 0 deletions src/main/java/io/mifos/dev/listener/TellerListener.java
@@ -0,0 +1,46 @@
/*
* Copyright 2017 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.core.lang.config.TenantHeaderFilter;
import io.mifos.core.test.listener.EventRecorder;
import io.mifos.teller.api.v1.EventConstants;
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 TellerListener {

private final EventRecorder eventRecorder;

@Autowired
public TellerListener(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 f536d56

Please sign in to comment.