Skip to content
Permalink
Browse files
Merge pull request #10 from ebenezergraham/permitted-feign-client-auth
Changing Notification Admin to OrgAdmin
  • Loading branch information
awasum committed Jun 6, 2019
2 parents 857f39c + 7c85f01 commit 6250a32c8da38b43e8373154092a6d60ea1ff1ff
Showing 70 changed files with 1,752 additions and 788 deletions.
@@ -2,13 +2,12 @@
.idea
build/
target/
build/out
service/out
component-test/out
api/out
service/build
component-test/build
api/build
logs
**/out
**/build
**/logs
**/target
local.properties

# Ignore Gradle GUI config
gradle-app.setting
@@ -22,4 +21,5 @@ gradle-app.setting

*.toDelete

*.class
*.class

@@ -31,5 +31,4 @@ env:

after_failure:
- ./gradlew rat
- cat api/build/reports/rat/rat-report.txt

- cat api/build/reports/rat/rat-report.txt
@@ -1,5 +1,5 @@
Apache Fineract CN Notification
Copyright [2017-2018] The Apache Software Foundation
Copyright [2017-2019] The Apache Software Foundation

This product includes software developed at
The Apache Software Foundation (http://www.apache.org/).
The Apache Software Foundation (http://www.apache.org/).
@@ -1,6 +1,7 @@

# Apache Fineract CN Notification [![Build Status](https://api.travis-ci.com/apache/fineract-cn-notifications.svg?branch=develop)](https://travis-ci.com/apache/fineract-cn-notifications)

This mircroservice contains all the functionalities for SMS and Email Notification
This mircroservice implements SMS and Email Notification functionalities

## Abstract
Apache Fineract CN is an application framework for digital financial services, a system to support nationwide and cross-national financial transactions and help to level and speed the creation of an inclusive, interconnected digital economy for every nation in the world.
@@ -52,7 +52,6 @@ publishing {
from components.java
groupId project.group
artifactId project.name
version project.findProperty('externalVersion') ?: project.version
}
version project.findProperty('externalVersion') ?: project.version }
}
}
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -21,4 +21,9 @@
@SuppressWarnings("unused")
public interface PermittableGroupIds {
String SELF_MANAGEMENT = "notification__v1__self";

static String forApplication(final String serviceName) {
return serviceName.replace("-", "__") + "__customer";
}
static String customerGroupEndPoint = "notification__v1__customer__v1";
}
@@ -18,11 +18,5 @@
*/
package org.apache.fineract.cn.notification.api.v1.client;

import org.apache.fineract.cn.api.util.NotFoundException;

public final class ConfigurationNotFoundException extends NotFoundException {

public ConfigurationNotFoundException(String reason) {
super(reason);
}
public final class ConfigurationNotFoundException extends RuntimeException {
}
@@ -18,10 +18,13 @@
*/
package org.apache.fineract.cn.notification.api.v1.client;

import org.apache.fineract.cn.api.annotation.ThrowsException;
import org.apache.fineract.cn.api.annotation.ThrowsExceptions;
import org.apache.fineract.cn.api.util.CustomFeignClientsConfiguration;
import org.apache.fineract.cn.notification.api.v1.domain.EmailConfiguration;
import org.apache.fineract.cn.notification.api.v1.domain.SMSConfiguration;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
@@ -32,48 +35,80 @@
public interface NotificationManager {

@RequestMapping(
value = "/notification/sms/active",
value = "/configuration/sms/active",
method = RequestMethod.GET,
produces = MediaType.ALL_VALUE,
consumes = MediaType.APPLICATION_JSON_VALUE)
SMSConfiguration findAllActiveSMSConfigurationEntities();

@RequestMapping(
value = "/notification/email/active",
value = "/configuration/email/active",
method = RequestMethod.GET,
produces = MediaType.ALL_VALUE,
consumes = MediaType.APPLICATION_JSON_VALUE)
EmailConfiguration findAllActiveEmailConfigurationEntities();

@RequestMapping(
value = "/notification/sms/create",
value = "/configuration/sms/create",
method = RequestMethod.POST,
produces = MediaType.APPLICATION_JSON_VALUE,
consumes = MediaType.APPLICATION_JSON_VALUE
)
void createSMSConfiguration(final SMSConfiguration smsConfiguration);
@ThrowsExceptions({
@ThrowsException(status = HttpStatus.NOT_FOUND, exception = ConfigurationNotFoundException.class)
})
String createSMSConfiguration(final SMSConfiguration smsConfiguration);

@RequestMapping(
value = "/notification/email/create",
value = "/configuration/email/create",
method = RequestMethod.POST,
produces = MediaType.APPLICATION_JSON_VALUE,
consumes = MediaType.APPLICATION_JSON_VALUE
)
void createEmailConfiguration(final EmailConfiguration emailConfiguration);
String createEmailConfiguration(final EmailConfiguration emailConfiguration);

@RequestMapping(
value = "/notification/sms/{identifier}",
value = "/configuration/sms/{identifier}",
method = RequestMethod.GET,
produces = MediaType.APPLICATION_JSON_VALUE,
consumes = MediaType.APPLICATION_JSON_VALUE
)
SMSConfiguration findSMSConfigurationByIdentifier(@PathVariable("identifier") final String identifier);

@RequestMapping(
value = "/notification/email/{identifier}",
value = "/configuration/email/{identifier}",
method = RequestMethod.GET,
produces = MediaType.APPLICATION_JSON_VALUE,
consumes = MediaType.APPLICATION_JSON_VALUE
)
EmailConfiguration findEmailConfigurationByIdentifier(@PathVariable("identifier") final String identifier);

@RequestMapping(value = "/configuration/sms/update",
method = RequestMethod.PUT,
consumes = MediaType.APPLICATION_JSON_VALUE,
produces = MediaType.APPLICATION_JSON_VALUE
)
void updateSMSConfiguration(final SMSConfiguration smsConfiguration);

@RequestMapping(value = "/configuration/email/update",
method = RequestMethod.PUT,
consumes = MediaType.APPLICATION_JSON_VALUE,
produces = MediaType.APPLICATION_JSON_VALUE
)
void updateEmailConfiguration(final EmailConfiguration emailConfiguration);

@RequestMapping(value = "/configuration/sms/delete/{identifier}",
method = RequestMethod.DELETE,
consumes = MediaType.APPLICATION_JSON_VALUE,
produces = MediaType.APPLICATION_JSON_VALUE
)
void deleteSMSConfiguration(@PathVariable("identifier") final String identifier);

@RequestMapping(value = "/configuration/email/delete/{identifier}",
method = RequestMethod.DELETE,
consumes = MediaType.APPLICATION_JSON_VALUE,
produces = MediaType.APPLICATION_JSON_VALUE
)
void deleteEmailConfiguration(@PathVariable("identifier") final String identifier);

}
@@ -26,7 +26,7 @@
@SuppressWarnings({"WeakerAccess", "unused"})
public class EmailConfiguration {
@ValidIdentifier
@Length(max = 11)
@Length(max = 45)
private String identifier;
@Length(max = 45)
private String host;
@@ -42,7 +42,7 @@ public class EmailConfiguration {
private String smtp_auth;
@Length(max = 45)
private String start_tls;
@Length(max = 45)
@Length(max = 10)
private String state;

public EmailConfiguration() {
@@ -34,7 +34,7 @@ public class SMSConfiguration {
private String account_sid;
@Length(max = 45)
private String sender_number;
@Length(max = 45)
@Length(max = 20)
private String state;

public SMSConfiguration() {
@@ -27,8 +27,15 @@ public interface NotificationEventConstants {

String POST_SMS_CONFIGURATION = "post-sms-configuration";
String POST_EMAIL_CONFIGURATION = "post-email-configuration";
String POST_SMS_NOTIFICATION = "post-sms-notification";
String POST_EMAIL_NOTIFICATION = "post-email-notification";
String POST_SOURCE_APPLICATION = "post-source-application";
String UPDATE_SMS_CONFIGURATION = "update-sms-configuration";
String UPDATE_EMAIL_CONFIGURATION = "update-email-configuration";
String DELETE_SMS_CONFIGURATION = "delete-sms-configuration";
String DELETE_EMAIL_CONFIGURATION = "delete-email-configuration";
String DELETE_SOURCE_APPLICATION = "delete-source-application";

String SEND_EMAIL_NOTIFICATION = "post-send-email-notification";
String SEND_SMS_NOTIFICATION = "post-send-sms-notification";

String POST_ENABLE_CUSTOMER_CREATED_EVENT = "post-enable-customer-created-event";
String POST_ENABLE_CUSTOMER_UPDATED_EVENT = "post-enable-customer-updated-event";
@@ -40,6 +47,13 @@ public interface NotificationEventConstants {
String SELECTOR_INITIALIZE = SELECTOR_NAME + " = '" + INITIALIZE + "'";
String SELECTOR_POST_SMS_CONFIGURATION = SELECTOR_NAME + " = '" + POST_SMS_CONFIGURATION + "'";
String SELECTOR_POST_EMAIL_CONFIGURATION = SELECTOR_NAME + " = '" + POST_EMAIL_CONFIGURATION + "'";
String SELECTOR_POST_SMS_NOTIFICATION = SELECTOR_NAME + " = '" + POST_SMS_NOTIFICATION + "'";
String SELECTOR_POST_EMAIL_NOTIFICATION = SELECTOR_NAME + " = '" + POST_EMAIL_NOTIFICATION + "'";
String SELECTOR_UPDATE_SMS_CONFIGURATION = SELECTOR_NAME + " = '" + UPDATE_SMS_CONFIGURATION + "'";
String SELECTOR_UPDATE_EMAIL_CONFIGURATION = SELECTOR_NAME + " = '" + UPDATE_EMAIL_CONFIGURATION + "'";
String SELECTOR_DELETE_SMS_CONFIGURATION = SELECTOR_NAME + " = '" + DELETE_SMS_CONFIGURATION + "'";
String SELECTOR_DELETE_EMAIL_CONFIGURATION = SELECTOR_NAME + " = '" + DELETE_EMAIL_CONFIGURATION + "'";
String SELECTOR_POST_SOURCE_APPLICATION = SELECTOR_NAME + " = '" + POST_SOURCE_APPLICATION + "'";
String SELECTOR_DELETE_SOURCE_APPLICATION = SELECTOR_NAME + " = '" + DELETE_SOURCE_APPLICATION + "'";

String SELECTOR_SEND_EMAIL_NOTIFICATION = SELECTOR_NAME + " = '" + SEND_EMAIL_NOTIFICATION + "'";
String SELECTOR_SEND_SMS_NOTIFICATION = SELECTOR_NAME + " = '" + SEND_SMS_NOTIFICATION + "'";
}
@@ -18,6 +18,7 @@
buildscript {
ext {
springBootVersion = '1.4.1.RELEASE'
asciidoctorVersion = '1.5.3'
}

repositories {
@@ -26,7 +27,7 @@ buildscript {

dependencies {
classpath ("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
classpath("org.asciidoctor:asciidoctor-gradle-plugin:1.5.3")
classpath("org.asciidoctor:asciidoctor-gradle-plugin:${asciidoctorVersion}")
}
}

@@ -48,9 +49,16 @@ dependencies {
[group: 'org.apache.fineract.cn', name: 'lang', version: versions.frameworklang],
[group: 'org.springframework.boot', name: 'spring-boot-starter-test'],
[group: 'org.springframework.restdocs', name: 'spring-restdocs-mockmvc'],
[group: 'junit', name: 'junit', version: '4.12']
[group: 'junit', name: 'junit', version: versions.junit]
)
}
asciidoctor {
sourceDir 'build/doc/asciidoc/'
outputDir 'build/doc/html5'
options backend: "html", doctype: "book"
attributes "source-highlighter": "highlightjs",
'snippets': file('build/doc/generated-snippets/')
}

asciidoctor {
sourceDir 'build/doc/asciidoc/'
@@ -67,3 +75,7 @@ publishing {
}
}
}

task generateDocs {
dependsOn asciidoctor
}
@@ -21,14 +21,11 @@
import org.apache.fineract.cn.anubis.test.v1.TenantApplicationSecurityEnvironmentTestRule;
import org.apache.fineract.cn.api.context.AutoUserContext;
import org.apache.fineract.cn.notification.api.v1.events.NotificationEventConstants;
import org.apache.fineract.cn.notification.service.NotificationConfiguration;
import org.apache.fineract.cn.notification.service.internal.config.NotificationConfiguration;
import org.apache.fineract.cn.test.fixture.TenantDataStoreContextTestRule;
import org.apache.fineract.cn.test.listener.EnableEventRecording;
import org.apache.fineract.cn.test.listener.EventRecorder;
import org.junit.After;
import org.junit.Before;
import org.junit.ClassRule;
import org.junit.Rule;
import org.junit.*;
import org.junit.runner.RunWith;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -52,15 +49,16 @@ public class AbstractNotificationTest extends SuiteTestEnvironment {

@ClassRule
public final static TenantDataStoreContextTestRule tenantDataStoreContext = TenantDataStoreContextTestRule.forRandomTenantName(cassandraInitializer, mariaDBInitializer);
private static final String LOGGER_NAME = "test-logger";
private static final String TEST_USER = "homer";
public static final String LOGGER_NAME = "test-logger";
public static final String TEST_USER = "homer";

@SuppressWarnings("WeakerAccess")
@Autowired
@Qualifier(LOGGER_NAME)
Logger logger;
private AutoUserContext userContext;
public AutoUserContext userContext;
@Autowired
private EventRecorder eventRecorder;
public EventRecorder eventRecorder;
@Rule
public final TenantApplicationSecurityEnvironmentTestRule tenantApplicationSecurityEnvironment
= new TenantApplicationSecurityEnvironmentTestRule(testEnvironment, this::waitForInitialize);
@@ -96,7 +94,7 @@ public boolean waitForInitialize() {
@RibbonClient(name = APP_NAME)
@ComponentScan({"org.apache.fineract.cn.notification.listener",
"org.apache.fineract.cn.notification.service.internal.service",
"org.apache.fineract.cn.notification.service.internal.service.helperservice"
"org.apache.fineract.cn.notification.service.internal.service.externalServiceClients"
})
@Import({NotificationConfiguration.class})
public static class TestConfiguration {

0 comments on commit 6250a32

Please sign in to comment.