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/08/12 14:28:34 UTC

[GitHub] ebenezergraham closed pull request #18: Adding the notification service to the demo server

ebenezergraham closed pull request #18: Adding the notification service to the demo server
URL: https://github.com/apache/fineract-cn-demo-server/pull/18
 
 
   

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..688288c 100644
--- a/build.gradle
+++ b/build.gradle
@@ -50,6 +50,7 @@ ext.versions = [
         fineractcndeposit       : '0.1.0-BUILD-SNAPSHOT',
         fineractcnteller        : '0.1.0-BUILD-SNAPSHOT',
         fineractcnreporting     : '0.1.0-BUILD-SNAPSHOT',
+        fineractcnnotification  : '0.1.0-BUILD-SNAPSHOT',
         kuelapcheques           : '0.1.0-BUILD-SNAPSHOT',
         fineractcnpayroll       : '0.1.0-BUILD-SNAPSHOT',
         fineractcngroup         : '0.1.0-BUILD-SNAPSHOT',
@@ -110,6 +111,7 @@ dependencies {
             [group: 'org.apache.fineract.cn.cheques', name: 'api', version: versions.kuelapcheques],
             [group: 'org.apache.fineract.cn.payroll', name: 'api', version: versions.fineractcnpayroll],
             [group: 'org.apache.fineract.cn.group', name: 'api', version: versions.fineractcngroup],
+            [group: 'org.apache.fineract.cn.notification', name: 'api', version: versions.fineractcnnotification],
 
             [group: 'org.apache.fineract.cn.anubis', name: 'api', version: versions.frameworkanubis],
             [group: 'org.apache.fineract.cn.anubis', name: 'test', version: versions.frameworkanubis],
diff --git a/out/production/classes/org/apache/fineract/cn/dev/ApplicationBuilder.class b/out/production/classes/org/apache/fineract/cn/dev/ApplicationBuilder.class
new file mode 100644
index 0000000..d94e4e3
Binary files /dev/null and b/out/production/classes/org/apache/fineract/cn/dev/ApplicationBuilder.class differ
diff --git a/out/production/classes/org/apache/fineract/cn/dev/DemoServer.class b/out/production/classes/org/apache/fineract/cn/dev/DemoServer.class
new file mode 100644
index 0000000..95ee19f
Binary files /dev/null and b/out/production/classes/org/apache/fineract/cn/dev/DemoServer.class differ
diff --git a/out/production/classes/org/apache/fineract/cn/dev/ServiceRunner$1.class b/out/production/classes/org/apache/fineract/cn/dev/ServiceRunner$1.class
new file mode 100644
index 0000000..adb6aaf
Binary files /dev/null and b/out/production/classes/org/apache/fineract/cn/dev/ServiceRunner$1.class differ
diff --git a/out/production/classes/org/apache/fineract/cn/dev/ServiceRunner$2.class b/out/production/classes/org/apache/fineract/cn/dev/ServiceRunner$2.class
new file mode 100644
index 0000000..059ebd4
Binary files /dev/null and b/out/production/classes/org/apache/fineract/cn/dev/ServiceRunner$2.class differ
diff --git a/out/production/classes/org/apache/fineract/cn/dev/ServiceRunner$3.class b/out/production/classes/org/apache/fineract/cn/dev/ServiceRunner$3.class
new file mode 100644
index 0000000..78d8631
Binary files /dev/null and b/out/production/classes/org/apache/fineract/cn/dev/ServiceRunner$3.class differ
diff --git a/out/production/classes/org/apache/fineract/cn/dev/ServiceRunner$TestConfiguration.class b/out/production/classes/org/apache/fineract/cn/dev/ServiceRunner$TestConfiguration.class
new file mode 100644
index 0000000..f93406d
Binary files /dev/null and b/out/production/classes/org/apache/fineract/cn/dev/ServiceRunner$TestConfiguration.class differ
diff --git a/out/production/classes/org/apache/fineract/cn/dev/ServiceRunner.class b/out/production/classes/org/apache/fineract/cn/dev/ServiceRunner.class
new file mode 100644
index 0000000..9cb125f
Binary files /dev/null and b/out/production/classes/org/apache/fineract/cn/dev/ServiceRunner.class differ
diff --git a/out/production/classes/org/apache/fineract/cn/dev/TenantBuilder.class b/out/production/classes/org/apache/fineract/cn/dev/TenantBuilder.class
new file mode 100644
index 0000000..78bdc73
Binary files /dev/null and b/out/production/classes/org/apache/fineract/cn/dev/TenantBuilder.class differ
diff --git a/out/production/classes/org/apache/fineract/cn/dev/listener/AccountingListener.class b/out/production/classes/org/apache/fineract/cn/dev/listener/AccountingListener.class
new file mode 100644
index 0000000..ad65932
Binary files /dev/null and b/out/production/classes/org/apache/fineract/cn/dev/listener/AccountingListener.class differ
diff --git a/out/production/classes/org/apache/fineract/cn/dev/listener/ChequesListener.class b/out/production/classes/org/apache/fineract/cn/dev/listener/ChequesListener.class
new file mode 100644
index 0000000..afa498d
Binary files /dev/null and b/out/production/classes/org/apache/fineract/cn/dev/listener/ChequesListener.class differ
diff --git a/out/production/classes/org/apache/fineract/cn/dev/listener/CustomerListener.class b/out/production/classes/org/apache/fineract/cn/dev/listener/CustomerListener.class
new file mode 100644
index 0000000..0e01396
Binary files /dev/null and b/out/production/classes/org/apache/fineract/cn/dev/listener/CustomerListener.class differ
diff --git a/out/production/classes/org/apache/fineract/cn/dev/listener/DepositAccountManagementListener.class b/out/production/classes/org/apache/fineract/cn/dev/listener/DepositAccountManagementListener.class
new file mode 100644
index 0000000..1c5d3da
Binary files /dev/null and b/out/production/classes/org/apache/fineract/cn/dev/listener/DepositAccountManagementListener.class differ
diff --git a/out/production/classes/org/apache/fineract/cn/dev/listener/GroupListener.class b/out/production/classes/org/apache/fineract/cn/dev/listener/GroupListener.class
new file mode 100644
index 0000000..1e1e96b
Binary files /dev/null and b/out/production/classes/org/apache/fineract/cn/dev/listener/GroupListener.class differ
diff --git a/out/production/classes/org/apache/fineract/cn/dev/listener/IdentityListener.class b/out/production/classes/org/apache/fineract/cn/dev/listener/IdentityListener.class
new file mode 100644
index 0000000..cec4adb
Binary files /dev/null and b/out/production/classes/org/apache/fineract/cn/dev/listener/IdentityListener.class differ
diff --git a/out/production/classes/org/apache/fineract/cn/dev/listener/NotificationListener.class b/out/production/classes/org/apache/fineract/cn/dev/listener/NotificationListener.class
new file mode 100644
index 0000000..e0603fa
Binary files /dev/null and b/out/production/classes/org/apache/fineract/cn/dev/listener/NotificationListener.class differ
diff --git a/out/production/classes/org/apache/fineract/cn/dev/listener/OrganizationListener.class b/out/production/classes/org/apache/fineract/cn/dev/listener/OrganizationListener.class
new file mode 100644
index 0000000..ce87269
Binary files /dev/null and b/out/production/classes/org/apache/fineract/cn/dev/listener/OrganizationListener.class differ
diff --git a/out/production/classes/org/apache/fineract/cn/dev/listener/PayrollListener.class b/out/production/classes/org/apache/fineract/cn/dev/listener/PayrollListener.class
new file mode 100644
index 0000000..8ecd175
Binary files /dev/null and b/out/production/classes/org/apache/fineract/cn/dev/listener/PayrollListener.class differ
diff --git a/out/production/classes/org/apache/fineract/cn/dev/listener/PortfolioListener.class b/out/production/classes/org/apache/fineract/cn/dev/listener/PortfolioListener.class
new file mode 100644
index 0000000..b7fa892
Binary files /dev/null and b/out/production/classes/org/apache/fineract/cn/dev/listener/PortfolioListener.class differ
diff --git a/out/production/classes/org/apache/fineract/cn/dev/listener/ReportingListener.class b/out/production/classes/org/apache/fineract/cn/dev/listener/ReportingListener.class
new file mode 100644
index 0000000..aff9907
Binary files /dev/null and b/out/production/classes/org/apache/fineract/cn/dev/listener/ReportingListener.class differ
diff --git a/out/production/classes/org/apache/fineract/cn/dev/listener/RhythmListener.class b/out/production/classes/org/apache/fineract/cn/dev/listener/RhythmListener.class
new file mode 100644
index 0000000..71ae5db
Binary files /dev/null and b/out/production/classes/org/apache/fineract/cn/dev/listener/RhythmListener.class differ
diff --git a/out/production/classes/org/apache/fineract/cn/dev/listener/TellerListener.class b/out/production/classes/org/apache/fineract/cn/dev/listener/TellerListener.class
new file mode 100644
index 0000000..1db054f
Binary files /dev/null and b/out/production/classes/org/apache/fineract/cn/dev/listener/TellerListener.class differ
diff --git a/out/production/resources/logback.xml b/out/production/resources/logback.xml
new file mode 100644
index 0000000..e7d2cef
--- /dev/null
+++ b/out/production/resources/logback.xml
@@ -0,0 +1,58 @@
+<!--
+
+    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.
+
+-->
+<configuration>
+    <appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
+        <file>logs/service-runner.log</file>
+        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
+            <fileNamePattern>logs/archive/service-runner.%d{yyyy-MM-dd}.log</fileNamePattern>
+            <maxHistory>7</maxHistory>
+            <totalSizeCap>2GB</totalSizeCap>
+        </rollingPolicy>
+        <encoder>
+            <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
+        </encoder>
+    </appender>
+    <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
+        <encoder>
+            <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
+        </encoder>
+    </appender>
+
+    <logger name="com" level="ERROR">
+        <appender-ref ref="STDOUT" />
+    </logger>
+
+    <logger name="org" level="ERROR">
+        <appender-ref ref="STDOUT" />
+    </logger>
+
+    <logger name="io" level="ERROR">
+        <appender-ref ref="STDOUT" />
+    </logger>
+
+    <logger name="net" level="ERROR">
+        <appender-ref ref="STDOUT" />
+    </logger>
+
+    <root level="INFO">
+        <appender-ref ref="FILE"/>
+    </root>
+</configuration>
\ No newline at end of file
diff --git a/scripts/Unix/initial-setup.sh b/scripts/Unix/initial-setup.sh
index e55870a..06efa14 100755
--- a/scripts/Unix/initial-setup.sh
+++ b/scripts/Unix/initial-setup.sh
@@ -58,7 +58,7 @@ cd ..
 # exit tools directory
 cd ..
 
-get_modules fineract-cn-anubis fineract-cn-identity fineract-cn-permitted-feign-client fineract-cn-provisioner fineract-cn-rhythm fineract-cn-template fineract-cn-office fineract-cn-customer fineract-cn-group fineract-cn-accounting fineract-cn-portfolio fineract-cn-deposit-account-management fineract-cn-cheques fineract-cn-payroll fineract-cn-teller fineract-cn-reporting
+get_modules fineract-cn-anubis fineract-cn-identity fineract-cn-permitted-feign-client fineract-cn-provisioner fineract-cn-rhythm fineract-cn-template fineract-cn-office fineract-cn-customer fineract-cn-group fineract-cn-accounting fineract-cn-portfolio fineract-cn-deposit-account-management fineract-cn-cheques fineract-cn-payroll fineract-cn-teller fineract-cn-reporting fineract-cn-notifications
 
 mkdir integration-tests
 cd integration-tests
diff --git a/scripts/Unix/pull-all.sh b/scripts/Unix/pull-all.sh
index 8559490..514daf5 100644
--- a/scripts/Unix/pull-all.sh
+++ b/scripts/Unix/pull-all.sh
@@ -46,7 +46,7 @@ get_modules fineract-cn-crypto
 
 get_modules fineract-cn-anubis fineract-cn-identity fineract-cn-permitted-feign-client fineract-cn-provisioner fineract-cn-rhythm \
 fineract-cn-template fineract-cn-office fineract-cn-customer fineract-cn-group fineract-cn-accounting \
-fineract-cn-portfolio fineract-cn-deposit-account-management fineract-cn-cheques fineract-cn-payroll fineract-cn-teller fineract-cn-reporting
+fineract-cn-portfolio fineract-cn-deposit-account-management fineract-cn-cheques fineract-cn-payroll fineract-cn-teller fineract-cn-reporting fineract-cn-notifications
 
 (
 cd integration-tests
diff --git a/scripts/windows/initial-setup.bat b/scripts/windows/initial-setup.bat
index 8bea82b..eddc999 100644
--- a/scripts/windows/initial-setup.bat
+++ b/scripts/windows/initial-setup.bat
@@ -258,6 +258,15 @@ CALL gradlew publishToMavenLocal
 TIMEOUT /T 5
 cd ..
 
+REM initialize notifications
+git clone https://github.com/%githubAccount%/fineract-cn-notifications.git
+cd notifications
+git remote add upstream https://github.com/ebenezergraham/fineract-cn-notifications.git
+git checkout develop
+CALL gradlew publishToMavenLocal
+TIMEOUT /T 5
+cd ..
+
 mkdir integration-tests
 cd integration-tests
 
diff --git a/scripts/windows/pull-all.bat b/scripts/windows/pull-all.bat
index dc3799b..2a5b703 100644
--- a/scripts/windows/pull-all.bat
+++ b/scripts/windows/pull-all.bat
@@ -243,6 +243,15 @@ git push origin develop
 TIMEOUT /T 5
 cd ..
 
+REM pull notifications
+cd notifications
+git checkout develop
+git pull upstream develop
+CALL gradlew publishToMavenLocal
+git push origin develop
+TIMEOUT /T 5
+cd ..
+
 cd integration-tests
 
 REM pull service-starter
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..b478ac3 100644
--- a/src/main/java/org/apache/fineract/cn/dev/ServiceRunner.java
+++ b/src/main/java/org/apache/fineract/cn/dev/ServiceRunner.java
@@ -53,6 +53,7 @@
 import org.apache.fineract.cn.rhythm.api.v1.client.RhythmManager;
 import org.apache.fineract.cn.rhythm.api.v1.events.BeatEvent;
 import org.apache.fineract.cn.teller.api.v1.client.TellerManager;
+import org.apache.fineract.cn.notification.api.v1.client.NotificationManager;
 import org.apache.fineract.cn.api.config.EnableApiFactory;
 import org.apache.fineract.cn.api.context.AutoGuest;
 import org.apache.fineract.cn.api.context.AutoSeshat;
@@ -111,6 +112,7 @@
   private static Microservice<ChequeManager> chequeManager;
   private static Microservice<PayrollManager> payrollManager;
   private static Microservice<GroupManager> groupManager;
+  private static Microservice<NotificationManager> notificationManager;
 
 
   private static DB embeddedMariaDb;
@@ -239,10 +241,14 @@ 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.notificationManager = new Microservice<>(NotificationManager.class, "notification", "0.1.0-BUILD-SNAPSHOT", ServiceRunner.INTEGRATION_TEST_ENVIRONMENT);
+    startService(generalProperties, ServiceRunner.notificationManager);
   }
 
   @After
   public void tearDown() throws Exception {
+    ServiceRunner.notificationManager.kill();
     ServiceRunner.groupManager.kill();
     ServiceRunner.payrollManager.kill();
     ServiceRunner.chequeManager.kill();
@@ -286,6 +292,7 @@ public void startDevServer() throws InterruptedException, IOException, ArtifactR
     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("Notification Service: " + ServiceRunner.notificationManager.getProcessEnvironment().serverURI());
 
     boolean run = true;
 
@@ -349,7 +356,9 @@ private void provisionAppsViaSeshat() throws InterruptedException, IOException {
         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.notificationManager.name(), ServiceRunner.notificationManager.uri())
+
     );
 
 
@@ -658,4 +667,4 @@ private void setAdditionalProperties(final ExtraProperties properties) {
       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/org/apache/fineract/cn/dev/listener/NotificationListener.java b/src/main/java/org/apache/fineract/cn/dev/listener/NotificationListener.java
new file mode 100644
index 0000000..9c017f6
--- /dev/null
+++ b/src/main/java/org/apache/fineract/cn/dev/listener/NotificationListener.java
@@ -0,0 +1,49 @@
+/*
+ * 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.notification.api.v1.events.NotificationEventConstants;
+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 NotificationListener {
+
+  private final EventRecorder eventRecorder;
+
+  @Autowired
+  public NotificationListener(final EventRecorder eventRecorder) {
+    this.eventRecorder = eventRecorder;
+  }
+
+  @JmsListener(
+      subscription = NotificationEventConstants.DESTINATION,
+      destination = NotificationEventConstants.DESTINATION,
+      selector = NotificationEventConstants.SELECTOR_INITIALIZE
+  )
+  public void onInitialized(@Header(TenantHeaderFilter.TENANT_HEADER) final String tenant,
+                            final String payload) {
+    this.eventRecorder.event(tenant, NotificationEventConstants.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