Adding Group service to demo-server
diff --git a/build.gradle b/build.gradle
index d1db301..38d00e9 100644
--- a/build.gradle
+++ b/build.gradle
@@ -34,6 +34,7 @@
mifosreporting : '0.1.0-BUILD-SNAPSHOT',
kuelapcheques : '0.1.0-BUILD-SNAPSHOT',
mifospayroll : '0.1.0-BUILD-SNAPSHOT',
+ mifosgroup : '0.1.0-BUILD-SNAPSHOT',
frameworkapi : '0.1.0-BUILD-SNAPSHOT',
frameworklang : '0.1.0-BUILD-SNAPSHOT',
frameworktest : '0.1.0-BUILD-SNAPSHOT',
@@ -90,6 +91,7 @@
[group: 'org.apache.fineract.cn.reporting', name: 'api', version: versions.mifosreporting],
[group: 'org.apache.fineract.cn.cheques', name: 'api', version: versions.kuelapcheques],
[group: 'org.apache.fineract.cn.payroll', name: 'api', version: versions.mifospayroll],
+ [group: 'org.apache.fineract.cn.group', name: 'api', version: versions.mifosgroup],
[group: 'org.apache.fineract.cn.anubis', name: 'api', version: versions.frameworkanubis],
[group: 'org.apache.fineract.cn.anubis', name: 'test', version: versions.frameworkanubis],
@@ -122,4 +124,4 @@
yml = 'SCRIPT_STYLE'
yaml = 'SCRIPT_STYLE'
}
-}
+}
\ No newline at end of file
diff --git a/src/main/java/io/mifos/dev/ServiceRunner.java b/src/main/java/io/mifos/dev/ServiceRunner.java
index 59863dd..7d550ed 100644
--- a/src/main/java/io/mifos/dev/ServiceRunner.java
+++ b/src/main/java/io/mifos/dev/ServiceRunner.java
@@ -44,6 +44,7 @@
import io.mifos.customer.api.v1.CustomerEventConstants;
import io.mifos.customer.api.v1.client.CustomerManager;
import io.mifos.deposit.api.v1.client.DepositAccountManager;
+import io.mifos.group.api.v1.client.GroupManager;
import io.mifos.identity.api.v1.client.IdentityManager;
import io.mifos.identity.api.v1.domain.*;
import io.mifos.identity.api.v1.events.ApplicationPermissionEvent;
@@ -109,6 +110,7 @@
private static Microservice<ReportManager> reportManager;
private static Microservice<ChequeManager> chequeManager;
private static Microservice<PayrollManager> payrollManager;
+ private static Microservice<GroupManager> groupManager;
private static DB embeddedMariaDb;
@@ -234,10 +236,14 @@
ServiceRunner.payrollManager = new Microservice<>(PayrollManager.class, "payroll", "0.1.0-BUILD-SNAPSHOT", ServiceRunner.INTEGRATION_TEST_ENVIRONMENT);
startService(generalProperties, ServiceRunner.payrollManager);
+
+ ServiceRunner.groupManager = new Microservice<>(GroupManager.class, "group", "0.1.0-BUILD-SNAPSHOT", ServiceRunner.INTEGRATION_TEST_ENVIRONMENT);
+ startService(generalProperties, ServiceRunner.groupManager);
}
@After
public void tearDown() throws Exception {
+ ServiceRunner.groupManager.kill();
ServiceRunner.payrollManager.kill();
ServiceRunner.chequeManager.kill();
ServiceRunner.reportManager.kill();
@@ -279,6 +285,7 @@
System.out.println("Reporting Service: " + ServiceRunner.reportManager.getProcessEnvironment().serverURI());
System.out.println("Cheque Service: " + ServiceRunner.chequeManager.getProcessEnvironment().serverURI());
System.out.println("Payroll Service: " + ServiceRunner.payrollManager.getProcessEnvironment().serverURI());
+ System.out.println("Group Service: " + ServiceRunner.groupManager.getProcessEnvironment().serverURI());
boolean run = true;
@@ -331,26 +338,28 @@
ServiceRunner.provisionerService.api().authenticate(ServiceRunner.CLIENT_ID, ApiConstants.SYSTEM_SU, "oS/0IiAME/2unkN1momDrhAdNKOhGykYFH/mJN20");
final List<Application> applicationsToCreate = Arrays.asList(
- ApplicationBuilder.create(ServiceRunner.identityManager.name(), ServiceRunner.identityManager.uri()),
- ApplicationBuilder.create(ServiceRunner.rhythmManager.name(), ServiceRunner.rhythmManager.uri()),
- ApplicationBuilder.create(ServiceRunner.organizationManager.name(), ServiceRunner.organizationManager.uri()),
- 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.tellerManager.name(), ServiceRunner.tellerManager.uri()),
- ApplicationBuilder.create(ServiceRunner.reportManager.name(), ServiceRunner.reportManager.uri()),
- ApplicationBuilder.create(ServiceRunner.chequeManager.name(), ServiceRunner.chequeManager.uri()),
- ApplicationBuilder.create(ServiceRunner.payrollManager.name(), ServiceRunner.payrollManager.uri())
+ ApplicationBuilder.create(ServiceRunner.identityManager.name(), ServiceRunner.identityManager.uri()),
+ ApplicationBuilder.create(ServiceRunner.rhythmManager.name(), ServiceRunner.rhythmManager.uri()),
+ ApplicationBuilder.create(ServiceRunner.organizationManager.name(), ServiceRunner.organizationManager.uri()),
+ 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.tellerManager.name(), ServiceRunner.tellerManager.uri()),
+ ApplicationBuilder.create(ServiceRunner.reportManager.name(), ServiceRunner.reportManager.uri()),
+ ApplicationBuilder.create(ServiceRunner.chequeManager.name(), ServiceRunner.chequeManager.uri()),
+ ApplicationBuilder.create(ServiceRunner.payrollManager.name(), ServiceRunner.payrollManager.uri()),
+ ApplicationBuilder.create(ServiceRunner.groupManager.name(), ServiceRunner.groupManager.uri())
);
+
final List<Tenant> tenantsToCreate = Arrays.asList(
- TenantBuilder.create(ServiceRunner.provisionerService.getProcessEnvironment(), "playground", "A place to mess around and have fun", "playground")
- //TenantBuilder.create(ServiceRunner.provisionerService.getProcessEnvironment(), "demo-cccu", "Demo for CCCU", "demo_cccu"),
- //TenantBuilder.create(ServiceRunner.provisionerService.getProcessEnvironment(), "SKCUKNS1", "St Kitts Cooperative Credit Union", "SKCUKNS1"),
- //TenantBuilder.create(ServiceRunner.provisionerService.getProcessEnvironment(), "PCCUKNS1", "Police Cooperative Credit Union", "PCCUKNS1"),
- //TenantBuilder.create(ServiceRunner.provisionerService.getProcessEnvironment(), "FCCUKNS1", "FND Cooperative Credit Union", "FCCUKNS1"),
- //TenantBuilder.create(ServiceRunner.provisionerService.getProcessEnvironment(), "NCCUKNN1", "Nevis Cooperative Credit Union", "NCCUKNN1")
+ TenantBuilder.create(ServiceRunner.provisionerService.getProcessEnvironment(), "playground", "A place to mess around and have fun", "playground")
+ //TenantBuilder.create(ServiceRunner.provisionerService.getProcessEnvironment(), "demo-cccu", "Demo for CCCU", "demo_cccu"),
+ //TenantBuilder.create(ServiceRunner.provisionerService.getProcessEnvironment(), "SKCUKNS1", "St Kitts Cooperative Credit Union", "SKCUKNS1"),
+ //TenantBuilder.create(ServiceRunner.provisionerService.getProcessEnvironment(), "PCCUKNS1", "Police Cooperative Credit Union", "PCCUKNS1"),
+ //TenantBuilder.create(ServiceRunner.provisionerService.getProcessEnvironment(), "FCCUKNS1", "FND Cooperative Credit Union", "FCCUKNS1"),
+ //TenantBuilder.create(ServiceRunner.provisionerService.getProcessEnvironment(), "NCCUKNN1", "Nevis Cooperative Credit Union", "NCCUKNN1")
);
try (final AutoSeshat ignored = new AutoSeshat(authenticationResponse.getToken())) {
@@ -444,6 +453,8 @@
provisionApp(tenant, ServiceRunner.payrollManager, io.mifos.payroll.api.v1.EventConstants.INITIALIZE);
+ provisionApp(tenant, ServiceRunner.groupManager, io.mifos.group.api.v1.EventConstants.INITIALIZE);
+
final UserWithPassword orgAdminUserPassword = createOrgAdminRoleAndUser(tenantAdminPassword.getAdminPassword());
createChartOfAccounts(orgAdminUserPassword);
@@ -647,4 +658,4 @@
properties.setProperty(MariaDBConstants.MARIADB_PASSWORD_PROP, this.environment.getProperty(ServiceRunner.CUSTOM_PROP_PREFIX + MariaDBConstants.MARIADB_PASSWORD_PROP));
}
}
-}
+}
\ No newline at end of file
diff --git a/src/main/java/io/mifos/dev/listener/GroupListener.java b/src/main/java/io/mifos/dev/listener/GroupListener.java
new file mode 100644
index 0000000..3f56ef2
--- /dev/null
+++ b/src/main/java/io/mifos/dev/listener/GroupListener.java
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.group.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;
+
+/**
+ * @author Myrle Krantz
+ */
+@SuppressWarnings("unused")
+@Component
+public class GroupListener {
+ private final EventRecorder eventRecorder;
+
+ @Autowired
+ public GroupListener(final EventRecorder eventRecorder) {
+ this.eventRecorder = eventRecorder;
+ }
+
+ @JmsListener(
+ destination = EventConstants.DESTINATION,
+ selector = EventConstants.SELECTOR_INITIALIZE,
+ subscription = EventConstants.DESTINATION
+ )
+ public void onInitialization(@Header(TenantHeaderFilter.TENANT_HEADER) final String tenant,
+ final String payload) {
+ this.eventRecorder.event(tenant, EventConstants.INITIALIZE, payload, String.class);
+ }
+}