You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@fineract.apache.org by GitBox <gi...@apache.org> on 2018/10/08 08:46:54 UTC
[GitHub] cabrelkemfang closed pull request #22: Develop2
cabrelkemfang closed pull request #22: Develop2
URL: https://github.com/apache/fineract-cn-demo-server/pull/22
This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:
As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):
diff --git a/build.gradle b/build.gradle
index 2bb5f04..7286341 100644
--- a/build.gradle
+++ b/build.gradle
@@ -44,6 +44,7 @@ ext.versions = [
fineractcnprovisioner : '0.1.0-BUILD-SNAPSHOT',
fineractcnrhythm : '0.1.0-BUILD-SNAPSHOT',
fineractcnoffice : '0.1.0-BUILD-SNAPSHOT',
+ fineractcndatamigration : '0.1.0-BUILD-SNAPSHOT',
fineractcncustomer : '0.1.0-BUILD-SNAPSHOT',
fineractcnaccounting : '0.1.0-BUILD-SNAPSHOT',
fineractcnportfolio : '0.1.0-BUILD-SNAPSHOT',
@@ -101,6 +102,10 @@ dependencies {
[group: 'org.apache.fineract.cn.rhythm', name: 'spi', version: versions.fineractcnrhythm],
[group: 'org.apache.fineract.cn.customer', name: 'api', version: versions.fineractcncustomer],
+
+ [group: 'org.apache.fineract.cn.datamigration', name: 'api', version: versions.fineractcndatamigration
+ ],
+
[group: 'org.apache.fineract.cn.accounting', name: 'api', version: versions.fineractcnaccounting],
[group: 'org.apache.fineract.cn.accounting', name: 'importer', version: versions.fineractcnaccounting],
[group: 'org.apache.fineract.cn.portfolio', name: 'api', version: versions.fineractcnportfolio],
diff --git a/src/main/java/org/apache/fineract/cn/dev/ServiceRunner.java b/src/main/java/org/apache/fineract/cn/dev/ServiceRunner.java
index 8995a2b..8ae6418 100644
--- a/src/main/java/org/apache/fineract/cn/dev/ServiceRunner.java
+++ b/src/main/java/org/apache/fineract/cn/dev/ServiceRunner.java
@@ -26,6 +26,8 @@
import org.apache.fineract.cn.anubis.api.v1.domain.AllowedOperation;
import org.apache.fineract.cn.cheque.api.v1.client.ChequeManager;
import org.apache.fineract.cn.cassandra.util.CassandraConnectorConstants;
+import org.apache.fineract.cn.datamigration.api.v1.PermittableGroupIds;
+import org.apache.fineract.cn.datamigration.api.v1.events.DatamigrationEventConstants;
import org.apache.fineract.cn.mariadb.util.MariaDBConstants;
import org.apache.fineract.cn.test.env.ExtraProperties;
import org.apache.fineract.cn.test.listener.EnableEventRecording;
@@ -36,6 +38,9 @@
import org.apache.fineract.cn.test.servicestarter.Microservice;
import org.apache.fineract.cn.customer.api.v1.CustomerEventConstants;
import org.apache.fineract.cn.customer.api.v1.client.CustomerManager;
+
+import org.apache.fineract.cn.datamigration.api.v1.client.DatamigrationManager;
+
import org.apache.fineract.cn.deposit.api.v1.client.DepositAccountManager;
import org.apache.fineract.cn.group.api.v1.client.GroupManager;
import org.apache.fineract.cn.identity.api.v1.client.IdentityManager;
@@ -107,10 +112,14 @@
private static Microservice<PortfolioManager> portfolioManager;
private static Microservice<DepositAccountManager> depositAccountManager;
private static Microservice<TellerManager> tellerManager;
+ /*
private static Microservice<ReportManager> reportManager;
private static Microservice<ChequeManager> chequeManager;
private static Microservice<PayrollManager> payrollManager;
private static Microservice<GroupManager> groupManager;
+ private static Microservice<DatamigrationManager> datamigrationManager;
+ */
+
private static DB embeddedMariaDb;
@@ -213,7 +222,8 @@ public void before() throws Exception
ServiceRunner.customerManager = new Microservice<>(CustomerManager.class, "customer", "0.1.0-BUILD-SNAPSHOT", ServiceRunner.INTEGRATION_TEST_ENVIRONMENT);
startService(generalProperties, customerManager);
- ServiceRunner.ledgerManager = new Microservice<>(LedgerManager.class, "accounting", "0.1.0-BUILD-SNAPSHOT", ServiceRunner.INTEGRATION_TEST_ENVIRONMENT);
+ ServiceRunner.ledgerManager = new Microservice<>(LedgerManager.class, "accounting", "0.1.0-BUILD-SNAPSHOT",
+ ServiceRunner.INTEGRATION_TEST_ENVIRONMENT);
startService(generalProperties, ledgerManager);
ServiceRunner.portfolioManager = new Microservice<>(PortfolioManager.class, "portfolio", "0.1.0-BUILD-SNAPSHOT", ServiceRunner.INTEGRATION_TEST_ENVIRONMENT)
@@ -227,8 +237,9 @@ public void before() throws Exception
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);
+/*
+ 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);
@@ -239,14 +250,17 @@ public void before() throws Exception
ServiceRunner.groupManager = new Microservice<>(GroupManager.class, "group", "0.1.0-BUILD-SNAPSHOT", ServiceRunner.INTEGRATION_TEST_ENVIRONMENT);
startService(generalProperties, ServiceRunner.groupManager);
+
+ ServiceRunner.datamigrationManager = new Microservice<>(DatamigrationManager.class, "datamigration", "0.1.0-BUILD-SNAPSHOT", ServiceRunner.INTEGRATION_TEST_ENVIRONMENT);
+ startService(generalProperties, datamigrationManager);*/
}
@After
public void tearDown() throws Exception {
- ServiceRunner.groupManager.kill();
+ /*ServiceRunner.groupManager.kill();
ServiceRunner.payrollManager.kill();
ServiceRunner.chequeManager.kill();
- ServiceRunner.reportManager.kill();
+ ServiceRunner.reportManager.kill();*/
ServiceRunner.tellerManager.kill();
ServiceRunner.depositAccountManager.kill();
ServiceRunner.rhythmManager.kill();
@@ -255,6 +269,7 @@ public void tearDown() throws Exception {
ServiceRunner.customerManager.kill();
ServiceRunner.organizationManager.kill();
ServiceRunner.identityManager.kill();
+ // ServiceRunner.datamigrationManager.kill();
if (!isPersistent) {
ServiceRunner.embeddedMariaDb.stop();
@@ -272,9 +287,9 @@ public void startDevServer() throws InterruptedException, IOException, ArtifactR
}
}
finally {
- ServiceRunner.provisionerService.kill();
+ // ServiceRunner.provisionerService.kill();
}
-
+ System.out.println("Provisioner Service: " + ServiceRunner.provisionerService.getProcessEnvironment().serverURI());
System.out.println("Identity Service: " + ServiceRunner.identityManager.getProcessEnvironment().serverURI());
System.out.println("Office Service: " + ServiceRunner.organizationManager.getProcessEnvironment().serverURI());
System.out.println("Customer Service: " + ServiceRunner.customerManager.getProcessEnvironment().serverURI());
@@ -282,10 +297,12 @@ public void startDevServer() throws InterruptedException, IOException, ArtifactR
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());
+ /* 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());
+ System.out.println("Data Migration Service: " + ServiceRunner.datamigrationManager.getProcessEnvironment()
+ .serverURI());*/
boolean run = true;
@@ -306,7 +323,7 @@ private void startService(ExtraProperties properties, Microservice microservice)
logger.info("Service '{}' started and {} with Eureka.", microservice.name(), registered ? "registered" : "not registered");
microservice.setApiFactory(this.apiFactory);
- TimeUnit.SECONDS.sleep(20); //Give it some extra time before the next service...
+ TimeUnit.SECONDS.sleep(5); //Give it some extra time before the next service...
}
private void migrateServices() {
@@ -323,7 +340,7 @@ private void migrateServices() {
} else {
ServiceRunner.provisionerService.api().assignApplications(tenant.getIdentifier(), Collections.singletonList(assignedApplication));
try {
- Thread.sleep(5000L);
+ Thread.sleep(500L);
} catch (InterruptedException e) {
//do nothing
}
@@ -345,11 +362,12 @@ private void provisionAppsViaSeshat() throws InterruptedException, IOException {
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.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())
+ ApplicationBuilder.create(ServiceRunner.groupManager.name(), ServiceRunner.groupManager.uri()),
+ ApplicationBuilder.create(ServiceRunner.datamigrationManager.name(), ServiceRunner.datamigrationManager.uri())*/
);
@@ -447,7 +465,8 @@ private String provisionAppsViaSeshatForTenant(final Tenant tenant) throws Inter
provisionApp(tenant, ServiceRunner.tellerManager, org.apache.fineract.cn.teller.api.v1.EventConstants.INITIALIZE);
- provisionApp(tenant, ServiceRunner.reportManager, org.apache.fineract.cn.reporting.api.v1.EventConstants.INITIALIZE);
+ /* provisionApp(tenant, ServiceRunner.reportManager, org.apache.fineract.cn.reporting.api.v1.EventConstants
+ .INITIALIZE);
provisionApp(tenant, ServiceRunner.chequeManager, org.apache.fineract.cn.cheque.api.v1.EventConstants.INITIALIZE);
@@ -455,6 +474,8 @@ private String provisionAppsViaSeshatForTenant(final Tenant tenant) throws Inter
provisionApp(tenant, ServiceRunner.groupManager, org.apache.fineract.cn.group.api.v1.EventConstants.INITIALIZE);
+ provisionApp(tenant, ServiceRunner.datamigrationManager, DatamigrationEventConstants.INITIALIZE);*/
+
final UserWithPassword orgAdminUserPassword = createOrgAdminRoleAndUser(tenantAdminPassword.getAdminPassword());
createChartOfAccounts(orgAdminUserPassword);
@@ -595,21 +616,22 @@ private Role defineOrgAdministratorRole() {
ledgerManagementPermission.setAllowedOperations(AllowedOperation.ALL);
ledgerManagementPermission.setPermittableEndpointGroupIdentifier(org.apache.fineract.cn.accounting.api.v1.PermittableGroupIds.THOTH_LEDGER);
- final Permission accountManagementPermission = new Permission();
+ final Permission accountManagementPermission = new Permission();
accountManagementPermission.setAllowedOperations(AllowedOperation.ALL);
accountManagementPermission.setPermittableEndpointGroupIdentifier(org.apache.fineract.cn.accounting.api.v1.PermittableGroupIds.THOTH_ACCOUNT);
+
final Role role = new Role();
role.setIdentifier("orgadmin");
role.setPermissions(
Arrays.asList(
- employeeAllPermission,
- officeAllPermission,
- userAllPermission,
- roleAllPermission,
- selfManagementPermission,
- ledgerManagementPermission,
- accountManagementPermission
+ employeeAllPermission,
+ officeAllPermission,
+ userAllPermission,
+ roleAllPermission,
+ selfManagementPermission,
+ ledgerManagementPermission,
+ accountManagementPermission
)
);
diff --git a/src/main/java/org/apache/fineract/cn/dev/listener/DataMigrationListener.java b/src/main/java/org/apache/fineract/cn/dev/listener/DataMigrationListener.java
new file mode 100644
index 0000000..109051e
--- /dev/null
+++ b/src/main/java/org/apache/fineract/cn/dev/listener/DataMigrationListener.java
@@ -0,0 +1,50 @@
+
+/*
+ * 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 org.apache.fineract.cn.dev.listener;
+
+import org.apache.fineract.cn.datamigration.api.v1.events.DatamigrationEventConstants;
+import org.apache.fineract.cn.lang.config.TenantHeaderFilter;
+import org.apache.fineract.cn.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 DataMigrationListener {
+
+ private final EventRecorder eventRecorder;
+
+ @Autowired
+ public DataMigrationListener(final EventRecorder eventRecorder) {
+ this.eventRecorder = eventRecorder;
+ }
+
+ @JmsListener(
+ subscription = DatamigrationEventConstants.DESTINATION,
+ destination = DatamigrationEventConstants.DESTINATION,
+ selector = DatamigrationEventConstants.SELECTOR_INITIALIZE
+ )
+ public void onInitialized(@Header(TenantHeaderFilter.TENANT_HEADER) final String tenant,
+ final String payload) {
+ this.eventRecorder.event(tenant, DatamigrationEventConstants.INITIALIZE, payload, String.class);
+ }
+}
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services