FINERACT-1758: Improve custom module example
This commit is contained in:
committed by
Aleksandar Vidakovic
parent
388612b1ae
commit
ba765f9b7a
@@ -16,8 +16,10 @@
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
description = 'ACME Corp.: Fineract Foo Service'
|
||||
description = 'ACME Corp.: Fineract COB Loan'
|
||||
|
||||
group = 'com.acmecorp.fineract.foo.service'
|
||||
group = 'com.acme.fineract.cob'
|
||||
|
||||
archivesBaseName = 'acme-fineract-cob-loan'
|
||||
|
||||
apply from: 'dependencies.gradle'
|
||||
@@ -16,4 +16,7 @@
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
description = 'ACME Corp.: Fineract Foo'
|
||||
|
||||
dependencies {
|
||||
implementation(project(':fineract-provider'))
|
||||
}
|
||||
+56
@@ -0,0 +1,56 @@
|
||||
/**
|
||||
* 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 com.acme.fineract.loan.cob;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.fineract.cob.loan.LoanCOBBusinessStep;
|
||||
import org.apache.fineract.portfolio.loanaccount.domain.Loan;
|
||||
import org.apache.fineract.portfolio.loanaccount.domain.LoanAccountDomainService;
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
@RequiredArgsConstructor
|
||||
public class AcmeNoopBusinessStep implements LoanCOBBusinessStep, InitializingBean {
|
||||
|
||||
// NOTE: just to demonstrate that dependency injection is working
|
||||
private final LoanAccountDomainService loanAccountDomainService;
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
log.warn("Acme COB Loan: '{}'", getClass().getCanonicalName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Loan execute(Loan input) {
|
||||
return input;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getEnumStyledName() {
|
||||
return "ACME_LOAN_NOOP";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHumanReadableName() {
|
||||
return "ACME Loan Noop";
|
||||
}
|
||||
}
|
||||
+4
-11
@@ -16,17 +16,10 @@
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package com.acmecorp.fineract.foo.service;
|
||||
description = 'ACME Corp.: Fineract COB Starter'
|
||||
|
||||
import org.apache.fineract.dummy.core.data.DummyMessage;
|
||||
import org.apache.fineract.dummy.core.service.DummyService;
|
||||
import org.springframework.stereotype.Service;
|
||||
group = 'com.acme.fineract.cob'
|
||||
|
||||
@Service
|
||||
public class FooDummyServiceImpl implements DummyService {
|
||||
archivesBaseName = 'acme-fineract-cob-starter'
|
||||
|
||||
@Override
|
||||
public DummyMessage getMessage() {
|
||||
return new DummyMessage("Hello: FOO!");
|
||||
}
|
||||
}
|
||||
apply from: 'dependencies.gradle'
|
||||
@@ -0,0 +1,26 @@
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
|
||||
dependencies {
|
||||
implementation(project(':custom:acme:loan:cob'))
|
||||
implementation('org.springframework.boot:spring-boot-starter')
|
||||
testImplementation(project(':fineract-provider'))
|
||||
testImplementation('org.springframework.boot:spring-boot-starter-jdbc')
|
||||
testImplementation('org.springframework.boot:spring-boot-starter-data-jpa')
|
||||
}
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
/**
|
||||
* 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 com.acme.fineract.loan.starter;
|
||||
|
||||
import org.springframework.boot.autoconfigure.AutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
|
||||
@AutoConfiguration
|
||||
@ComponentScan("com.acme.fineract.loan.cob")
|
||||
@ConditionalOnProperty("acme.loan.enabled")
|
||||
public class AcmeLoanAutoConfiguration {}
|
||||
@@ -0,0 +1,2 @@
|
||||
org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
|
||||
com.acme.fineract.loan.starter.AcmeLoanAutoConfiguration
|
||||
+69
@@ -0,0 +1,69 @@
|
||||
/**
|
||||
* 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 com.acme.fineract.loan.starter;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
import io.cucumber.java8.En;
|
||||
import java.util.TreeMap;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.fineract.cob.COBBusinessStep;
|
||||
import org.apache.fineract.cob.COBBusinessStepService;
|
||||
import org.apache.fineract.portfolio.loanaccount.domain.Loan;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigurations;
|
||||
import org.springframework.boot.test.context.runner.ApplicationContextRunner;
|
||||
|
||||
@Slf4j
|
||||
public class AcmeBusinessStepDefinitions implements En {
|
||||
|
||||
private ApplicationContextRunner contextRunner;
|
||||
|
||||
private COBBusinessStepService businessStepService;
|
||||
|
||||
private COBBusinessStep<Loan> businessStep;
|
||||
|
||||
private TreeMap<Long, String> result;
|
||||
|
||||
public AcmeBusinessStepDefinitions() {
|
||||
Given("/^An auto configuration (.*) and a service configuration (.*)$/",
|
||||
(String autoConfigurationClassName, String configurationClassName) -> {
|
||||
contextRunner = new ApplicationContextRunner()
|
||||
.withConfiguration(AutoConfigurations.of(Class.forName(autoConfigurationClassName)))
|
||||
.withPropertyValues("acme.loan.enabled", "true")
|
||||
.withUserConfiguration(Class.forName(configurationClassName.trim()));
|
||||
});
|
||||
|
||||
When("/^The user retrieves the step service with step class (.*) and name (.*)$/", (String stepClass, String stepName) -> {
|
||||
contextRunner.run((ctx) -> {
|
||||
this.businessStepService = ctx.getBean(COBBusinessStepService.class);
|
||||
|
||||
this.businessStep = ctx.getBean((Class<COBBusinessStep<Loan>>) Class.forName(stepClass));
|
||||
|
||||
// TODO: not yet working, because no storage configured/mocked
|
||||
this.result = businessStepService.getCOBBusinessStepMap(this.businessStep.getClass(), stepName);
|
||||
});
|
||||
});
|
||||
|
||||
Then("/^The step service should have a result$/", () -> {
|
||||
assertThat(this.businessStep).isNotNull();
|
||||
assertThat(this.result).isNotNull();
|
||||
// log.warn(">>>>>>>>>>>>>>>>>> RESULT: {}", this.result);
|
||||
});
|
||||
}
|
||||
}
|
||||
+51
@@ -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 com.acme.fineract.loan.starter;
|
||||
|
||||
import static org.mockito.Mockito.mock;
|
||||
|
||||
import org.apache.fineract.cob.COBBusinessStepService;
|
||||
import org.apache.fineract.cob.COBBusinessStepServiceImpl;
|
||||
import org.apache.fineract.cob.domain.BatchBusinessStepRepository;
|
||||
import org.apache.fineract.infrastructure.core.config.FineractProperties;
|
||||
import org.apache.fineract.portfolio.loanaccount.domain.LoanAccountDomainService;
|
||||
import org.springframework.beans.factory.ListableBeanFactory;
|
||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
|
||||
@EnableConfigurationProperties({ FineractProperties.class })
|
||||
public class TestDefaultConfiguration {
|
||||
|
||||
@Bean
|
||||
public BatchBusinessStepRepository batchBusinessStepRepository() {
|
||||
return mock(BatchBusinessStepRepository.class);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public COBBusinessStepService cobBusinessStepService(BatchBusinessStepRepository batchBusinessStepRepository,
|
||||
ApplicationContext context, ListableBeanFactory beanFactory) {
|
||||
return new COBBusinessStepServiceImpl(batchBusinessStepRepository, context, beanFactory);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public LoanAccountDomainService loanAccountDomainService() {
|
||||
return mock(LoanAccountDomainService.class);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
/**
|
||||
* 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 com.acme.fineract.loan.starter;
|
||||
|
||||
import io.cucumber.spring.CucumberContextConfiguration;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
import org.springframework.test.context.TestPropertySource;
|
||||
import org.springframework.test.context.junit.jupiter.SpringExtension;
|
||||
import org.springframework.test.context.web.WebAppConfiguration;
|
||||
|
||||
@CucumberContextConfiguration
|
||||
@ExtendWith(SpringExtension.class)
|
||||
@TestPropertySource("classpath:application-test.properties")
|
||||
@WebAppConfiguration
|
||||
public class TestSuite {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
|
||||
# test properties
|
||||
@@ -0,0 +1,21 @@
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
|
||||
cucumber.publish.quiet=true
|
||||
cucumber.glue=com.acme.fineract
|
||||
@@ -0,0 +1,30 @@
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
|
||||
Feature: COB Feature
|
||||
|
||||
@modules
|
||||
Scenario Outline: Verify that the dependency injection of steps into the step service works
|
||||
Given An auto configuration <autoConfigurationClass> and a service configuration <configurationClass>
|
||||
When The user retrieves the step service with step class <stepClass> and name <stepName>
|
||||
Then The step service should have a result
|
||||
|
||||
Examples:
|
||||
| autoConfigurationClass | configurationClass | stepClass | stepName |
|
||||
| com.acme.fineract.loan.starter.AcmeLoanAutoConfiguration | com.acme.fineract.loan.starter.TestDefaultConfiguration | com.acme.fineract.loan.cob.AcmeNoopBusinessStep | ACME_LOAN_NOOP |
|
||||
@@ -0,0 +1,41 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!--
|
||||
|
||||
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 scan="false">
|
||||
<contextListener class="ch.qos.logback.classic.jul.LevelChangePropagator">
|
||||
<resetJUL>false</resetJUL>
|
||||
</contextListener>
|
||||
|
||||
<appender name="STDOUT" target="System.out" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<withJansi>true</withJansi>
|
||||
<encoder>
|
||||
<pattern>%green(%d{yyyy-MM-dd HH:mm:ss.SSS}) [%thread] %highlight(%-5level) %cyan(%logger{36}) - %msg%n</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<logger name="org.springframework.transaction" level="INFO" />
|
||||
<logger name="org.springframework.data.convert" level="ERROR" />
|
||||
<logger name="org.springframework.http.converter.json" level="ERROR" />
|
||||
|
||||
<root level="INFO">
|
||||
<appender-ref ref="STDOUT" />
|
||||
</root>
|
||||
</configuration>
|
||||
@@ -0,0 +1,25 @@
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
description = 'ACME Corp.: Fineract Note Service'
|
||||
|
||||
group = 'com.acme.fineract.portfolio.note'
|
||||
|
||||
archivesBaseName = 'acme-fineract-note-service'
|
||||
|
||||
apply from: 'dependencies.gradle'
|
||||
+2
-3
@@ -18,7 +18,6 @@
|
||||
*/
|
||||
|
||||
dependencies {
|
||||
implementation(project(':module:dummy:core'),
|
||||
'org.springframework:spring-context')
|
||||
testImplementation('io.cucumber:cucumber-spring')
|
||||
implementation(project(':fineract-provider'))
|
||||
compileOnly('org.springframework.boot:spring-boot-autoconfigure')
|
||||
}
|
||||
+48
@@ -0,0 +1,48 @@
|
||||
/**
|
||||
* 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 com.acme.fineract.portfolio.note.service;
|
||||
|
||||
import java.util.Collection;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.fineract.portfolio.note.data.NoteData;
|
||||
import org.apache.fineract.portfolio.note.service.NoteReadPlatformService;
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
@ConditionalOnProperty("acme.note.enabled")
|
||||
public class AcmeNoteReadPlatformService implements NoteReadPlatformService, InitializingBean {
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
log.warn("Note Read Service: '{}'", getClass().getCanonicalName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public NoteData retrieveNote(Long noteId, Long resourceId, Integer noteTypeId) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<NoteData> retrieveNotesByResource(Long resourceId, Integer noteTypeId) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
+59
@@ -0,0 +1,59 @@
|
||||
/**
|
||||
* 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 com.acme.fineract.portfolio.note.service;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.fineract.infrastructure.core.api.JsonCommand;
|
||||
import org.apache.fineract.infrastructure.core.data.CommandProcessingResult;
|
||||
import org.apache.fineract.portfolio.client.domain.Client;
|
||||
import org.apache.fineract.portfolio.note.service.NoteWritePlatformService;
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
@ConditionalOnProperty("acme.note.enabled")
|
||||
public class AcmeNoteWritePlatformService implements NoteWritePlatformService, InitializingBean {
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
log.warn("Note Write Service: '{}'", getClass().getCanonicalName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommandProcessingResult createNote(JsonCommand command) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommandProcessingResult updateNote(JsonCommand command) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommandProcessingResult deleteNote(JsonCommand command) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createAndPersistClientNote(Client client, JsonCommand command) {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
description = 'ACME Corp.: Fineract Note Starter'
|
||||
|
||||
group = 'com.acme.fineract.portfolio.note'
|
||||
|
||||
archivesBaseName = 'acme-fineract-note-starter'
|
||||
|
||||
apply from: 'dependencies.gradle'
|
||||
@@ -0,0 +1,26 @@
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
|
||||
dependencies {
|
||||
implementation(project(':custom:acme:note:service'))
|
||||
implementation('org.springframework.boot:spring-boot-starter')
|
||||
testImplementation(project(':fineract-provider'))
|
||||
testImplementation('org.springframework.boot:spring-boot-starter-jdbc')
|
||||
testImplementation('org.springframework.boot:spring-boot-starter-data-jpa')
|
||||
}
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
/**
|
||||
* 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 com.acme.fineract.portfolio.note.starter;
|
||||
|
||||
import org.springframework.boot.autoconfigure.AutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
|
||||
@AutoConfiguration
|
||||
@ComponentScan("com.acme.fineract.portfolio.note")
|
||||
@ConditionalOnProperty("acme.note.enabled")
|
||||
public class AcmeNoteAutoConfiguration {}
|
||||
@@ -0,0 +1,2 @@
|
||||
org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
|
||||
com.acme.fineract.portfolio.note.starter.AcmeNoteAutoConfiguration
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
|
||||
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.
|
||||
|
||||
-->
|
||||
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.1.xsd">
|
||||
<include file="parts/0001_acme_note_initial.xml" relativeToChangelogFile="true"/>
|
||||
</databaseChangeLog>
|
||||
+36
@@ -0,0 +1,36 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
|
||||
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.
|
||||
|
||||
-->
|
||||
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.1.xsd">
|
||||
<changeSet author="acme" id="1">
|
||||
<createTable tableName="acme_note_dummy">
|
||||
<column autoIncrement="true" name="id" type="BIGINT">
|
||||
<constraints nullable="false" primaryKey="true"/>
|
||||
</column>
|
||||
<column name="name" type="VARCHAR(100)">
|
||||
<constraints unique="true"/>
|
||||
</column>
|
||||
<column name="description" type="VARCHAR(500)"/>
|
||||
</createTable>
|
||||
</changeSet>
|
||||
</databaseChangeLog>
|
||||
+59
@@ -0,0 +1,59 @@
|
||||
/**
|
||||
* 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 com.acme.fineract.portfolio.note.starter;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
import io.cucumber.java8.En;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigurations;
|
||||
import org.springframework.boot.test.context.runner.ApplicationContextRunner;
|
||||
|
||||
public class AcmeNoteServiceStepDefinitions implements En {
|
||||
|
||||
private Class interfaceClass;
|
||||
|
||||
private Class implementationClass;
|
||||
|
||||
private ApplicationContextRunner contextRunner;
|
||||
|
||||
public AcmeNoteServiceStepDefinitions() {
|
||||
Given("/^An auto configuration (.*) and a service configuration (.*)$/",
|
||||
(String autoConfigurationClassName, String configurationClassName) -> {
|
||||
contextRunner = new ApplicationContextRunner()
|
||||
.withConfiguration(AutoConfigurations.of(Class.forName(autoConfigurationClassName)))
|
||||
.withPropertyValues("acme.note.enabled", "true")
|
||||
.withUserConfiguration(Class.forName(configurationClassName.trim()));
|
||||
});
|
||||
|
||||
When("/^The user retrieves the service of interface class (.*)$/", (String interfaceClassName) -> {
|
||||
contextRunner.run((ctx) -> {
|
||||
this.interfaceClass = Class.forName(interfaceClassName.trim());
|
||||
|
||||
assertThat(this.interfaceClass.isInterface()).isTrue();
|
||||
assertThat(ctx).hasSingleBean(this.interfaceClass);
|
||||
|
||||
this.implementationClass = ctx.getBean(interfaceClass).getClass();
|
||||
});
|
||||
});
|
||||
|
||||
Then("/^The service class should match (.*)$/", (String serviceClassName) -> {
|
||||
assertThat(Class.forName(serviceClassName.trim())).isEqualTo(this.implementationClass);
|
||||
});
|
||||
}
|
||||
}
|
||||
+90
@@ -0,0 +1,90 @@
|
||||
/**
|
||||
* 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 com.acme.fineract.portfolio.note.starter;
|
||||
|
||||
import static org.mockito.Mockito.mock;
|
||||
|
||||
import org.apache.fineract.infrastructure.core.config.FineractProperties;
|
||||
import org.apache.fineract.infrastructure.core.serialization.FromJsonHelper;
|
||||
import org.apache.fineract.infrastructure.core.service.RoutingDataSource;
|
||||
import org.apache.fineract.infrastructure.core.service.RoutingDataSourceServiceFactory;
|
||||
import org.apache.fineract.portfolio.client.domain.ClientRepositoryWrapper;
|
||||
import org.apache.fineract.portfolio.group.domain.GroupRepository;
|
||||
import org.apache.fineract.portfolio.loanaccount.domain.LoanRepositoryWrapper;
|
||||
import org.apache.fineract.portfolio.loanaccount.domain.LoanTransactionRepository;
|
||||
import org.apache.fineract.portfolio.note.domain.NoteRepository;
|
||||
import org.apache.fineract.portfolio.note.serialization.NoteCommandFromApiJsonDeserializer;
|
||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
|
||||
@EnableConfigurationProperties({ FineractProperties.class })
|
||||
public class TestDefaultConfiguration {
|
||||
// NOTE: unfortunately an abastract base class that contains all these mock functions won't work
|
||||
|
||||
@Bean
|
||||
public FromJsonHelper fromJsonHelper() {
|
||||
return mock(FromJsonHelper.class);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public RoutingDataSourceServiceFactory routingDataSourceServiceFactory() {
|
||||
return mock(RoutingDataSourceServiceFactory.class);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public RoutingDataSource routingDataSource() {
|
||||
return mock(RoutingDataSource.class);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public JdbcTemplate jdbcTemplate() {
|
||||
return mock(JdbcTemplate.class);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public NoteRepository noteRepository() {
|
||||
return mock(NoteRepository.class);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public ClientRepositoryWrapper clientRepository() {
|
||||
return mock(ClientRepositoryWrapper.class);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public GroupRepository groupRepository() {
|
||||
return mock(GroupRepository.class);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public LoanRepositoryWrapper loanRepository() {
|
||||
return mock(LoanRepositoryWrapper.class);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public LoanTransactionRepository loanTransactionRepository() {
|
||||
return mock(LoanTransactionRepository.class);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public NoteCommandFromApiJsonDeserializer fromApiJsonDeserializer(FromJsonHelper fromJsonHelper) {
|
||||
return new NoteCommandFromApiJsonDeserializer(fromJsonHelper);
|
||||
}
|
||||
}
|
||||
+89
@@ -0,0 +1,89 @@
|
||||
/**
|
||||
* 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 com.acme.fineract.portfolio.note.starter;
|
||||
|
||||
import static org.mockito.Mockito.mock;
|
||||
|
||||
import org.apache.fineract.infrastructure.core.serialization.FromJsonHelper;
|
||||
import org.apache.fineract.infrastructure.core.service.RoutingDataSource;
|
||||
import org.apache.fineract.infrastructure.core.service.RoutingDataSourceServiceFactory;
|
||||
import org.apache.fineract.portfolio.client.domain.ClientRepositoryWrapper;
|
||||
import org.apache.fineract.portfolio.group.domain.GroupRepository;
|
||||
import org.apache.fineract.portfolio.loanaccount.domain.LoanRepositoryWrapper;
|
||||
import org.apache.fineract.portfolio.loanaccount.domain.LoanTransactionRepository;
|
||||
import org.apache.fineract.portfolio.note.domain.NoteRepository;
|
||||
import org.apache.fineract.portfolio.note.serialization.NoteCommandFromApiJsonDeserializer;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
|
||||
@ComponentScan("com.acme.fineract")
|
||||
public class TestOverrideConfiguration {
|
||||
// NOTE: unfortunately an abastract base class that contains all these mock functions won't work
|
||||
|
||||
@Bean
|
||||
public FromJsonHelper fromJsonHelper() {
|
||||
return mock(FromJsonHelper.class);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public RoutingDataSourceServiceFactory routingDataSourceServiceFactory() {
|
||||
return mock(RoutingDataSourceServiceFactory.class);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public RoutingDataSource routingDataSource() {
|
||||
return mock(RoutingDataSource.class);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public JdbcTemplate jdbcTemplate() {
|
||||
return mock(JdbcTemplate.class);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public NoteRepository noteRepository() {
|
||||
return mock(NoteRepository.class);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public ClientRepositoryWrapper clientRepository() {
|
||||
return mock(ClientRepositoryWrapper.class);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public GroupRepository groupRepository() {
|
||||
return mock(GroupRepository.class);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public LoanRepositoryWrapper loanRepository() {
|
||||
return mock(LoanRepositoryWrapper.class);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public LoanTransactionRepository loanTransactionRepository() {
|
||||
return mock(LoanTransactionRepository.class);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public NoteCommandFromApiJsonDeserializer fromApiJsonDeserializer(FromJsonHelper fromJsonHelper) {
|
||||
return new NoteCommandFromApiJsonDeserializer(fromJsonHelper);
|
||||
}
|
||||
}
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
/**
|
||||
* 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 com.acme.fineract.portfolio.note.starter;
|
||||
|
||||
import io.cucumber.spring.CucumberContextConfiguration;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
import org.springframework.test.context.TestPropertySource;
|
||||
import org.springframework.test.context.junit.jupiter.SpringExtension;
|
||||
import org.springframework.test.context.web.WebAppConfiguration;
|
||||
|
||||
@CucumberContextConfiguration
|
||||
@ExtendWith(SpringExtension.class)
|
||||
@TestPropertySource("classpath:application-test.properties")
|
||||
@WebAppConfiguration
|
||||
public class TestSuite {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
|
||||
# test properties
|
||||
@@ -0,0 +1,21 @@
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
|
||||
cucumber.publish.quiet=true
|
||||
cucumber.glue=com.acme.fineract
|
||||
@@ -0,0 +1,33 @@
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
|
||||
Feature: Note Feature
|
||||
|
||||
@modules
|
||||
Scenario Outline: Verify that the dummy service returns the correct message
|
||||
Given An auto configuration <autoConfigurationClass> and a service configuration <configurationClass>
|
||||
When The user retrieves the service of interface class <interfaceClass>
|
||||
Then The service class should match <serviceClass>
|
||||
|
||||
Examples:
|
||||
| autoConfigurationClass | configurationClass | interfaceClass | serviceClass |
|
||||
| org.apache.fineract.portfolio.note.starter.NoteAutoConfiguration | com.acme.fineract.portfolio.note.starter.TestDefaultConfiguration | org.apache.fineract.portfolio.note.service.NoteReadPlatformService | org.apache.fineract.portfolio.note.service.NoteReadPlatformServiceImpl |
|
||||
| org.apache.fineract.portfolio.note.starter.NoteAutoConfiguration | com.acme.fineract.portfolio.note.starter.TestDefaultConfiguration | org.apache.fineract.portfolio.note.service.NoteWritePlatformService | org.apache.fineract.portfolio.note.service.NoteWritePlatformServiceJpaRepositoryImpl |
|
||||
| org.apache.fineract.portfolio.note.starter.NoteAutoConfiguration | com.acme.fineract.portfolio.note.starter.TestOverrideConfiguration | org.apache.fineract.portfolio.note.service.NoteReadPlatformService | com.acme.fineract.portfolio.note.service.AcmeNoteReadPlatformService |
|
||||
| org.apache.fineract.portfolio.note.starter.NoteAutoConfiguration | com.acme.fineract.portfolio.note.starter.TestOverrideConfiguration | org.apache.fineract.portfolio.note.service.NoteWritePlatformService | com.acme.fineract.portfolio.note.service.AcmeNoteWritePlatformService |
|
||||
@@ -0,0 +1,41 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!--
|
||||
|
||||
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 scan="false">
|
||||
<contextListener class="ch.qos.logback.classic.jul.LevelChangePropagator">
|
||||
<resetJUL>false</resetJUL>
|
||||
</contextListener>
|
||||
|
||||
<appender name="STDOUT" target="System.out" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<withJansi>true</withJansi>
|
||||
<encoder>
|
||||
<pattern>%green(%d{yyyy-MM-dd HH:mm:ss.SSS}) [%thread] %highlight(%-5level) %cyan(%logger{36}) - %msg%n</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<logger name="org.springframework.transaction" level="INFO" />
|
||||
<logger name="org.springframework.data.convert" level="ERROR" />
|
||||
<logger name="org.springframework.http.converter.json" level="ERROR" />
|
||||
|
||||
<root level="INFO">
|
||||
<appender-ref ref="STDOUT" />
|
||||
</root>
|
||||
</configuration>
|
||||
@@ -0,0 +1,108 @@
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
description = 'Fineract Custom Docker Image'
|
||||
|
||||
apply plugin: 'java'
|
||||
apply plugin: 'com.google.cloud.tools.jib'
|
||||
apply from: "${rootDir}/buildSrc/src/main/groovy/org.apache.fineract.dependencies.gradle"
|
||||
|
||||
jib {
|
||||
from {
|
||||
image = 'azul/zulu-openjdk-alpine:17'
|
||||
}
|
||||
|
||||
to {
|
||||
image = 'fineract-custom'
|
||||
tags = [
|
||||
"${project.version}",
|
||||
'latest'
|
||||
]
|
||||
}
|
||||
|
||||
container {
|
||||
creationTime = 'USE_CURRENT_TIMESTAMP'
|
||||
mainClass = 'org.apache.fineract.ServerApplication'
|
||||
jvmFlags = [
|
||||
'-Xms1G',
|
||||
'-XshowSettings:vm',
|
||||
'-XX:+UseContainerSupport',
|
||||
'-XX:+UseStringDeduplication',
|
||||
'-XX:MinRAMPercentage=25',
|
||||
'-XX:MaxRAMPercentage=80',
|
||||
'--add-exports=java.naming/com.sun.jndi.ldap=ALL-UNNAMED',
|
||||
'--add-opens=java.base/java.lang=ALL-UNNAMED',
|
||||
'--add-opens=java.base/java.lang.invoke=ALL-UNNAMED',
|
||||
'--add-opens=java.base/java.io=ALL-UNNAMED',
|
||||
'--add-opens=java.base/java.security=ALL-UNNAMED',
|
||||
'--add-opens=java.base/java.util=ALL-UNNAMED',
|
||||
'--add-opens=java.management/javax.management=ALL-UNNAMED',
|
||||
'--add-opens=java.naming/javax.naming=ALL-UNNAMED'
|
||||
]
|
||||
args = [
|
||||
'-Duser.home=/tmp',
|
||||
'-Dfile.encoding=UTF-8',
|
||||
'-Duser.timezone=UTC',
|
||||
'-Djava.security.egd=file:/dev/./urandom'
|
||||
]
|
||||
ports = ['8080/tcp', '8443/tcp']
|
||||
labels = [maintainer: 'Aleksandar Vidakovic <aleks@apache.org>']
|
||||
user = 'nobody:nogroup'
|
||||
}
|
||||
|
||||
allowInsecureRegistries = true
|
||||
|
||||
dependencies {
|
||||
implementation project(':fineract-provider')
|
||||
// NOTE: dynamically load all custom modules
|
||||
file("${rootDir}/custom").eachDir { companyDir ->
|
||||
if('build' != companyDir.name && 'docker' != companyDir.name) {
|
||||
file("${rootDir}/custom/${companyDir.name}").eachDir { categoryDir ->
|
||||
if('build' != categoryDir.name) {
|
||||
file("${rootDir}/custom/${companyDir.name}/${categoryDir.name}").eachDir { moduleDir ->
|
||||
if('build' != moduleDir.name) {
|
||||
implementation project(":custom:${companyDir.name}:${categoryDir.name}:${moduleDir.name}")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// NOTE: other custom dependencies
|
||||
implementation 'org.mariadb.jdbc:mariadb-java-client:3.0.7'
|
||||
implementation 'mysql:mysql-connector-java:8.0.30'
|
||||
implementation 'org.postgresql:postgresql:42.5.0'
|
||||
annotationProcessor('org.springframework.boot:spring-boot-autoconfigure-processor')
|
||||
annotationProcessor('org.springframework.boot:spring-boot-configuration-processor')
|
||||
}
|
||||
|
||||
pluginExtensions {
|
||||
pluginExtension {
|
||||
implementation = 'com.google.cloud.tools.jib.gradle.extension.layerfilter.JibLayerFilterExtension'
|
||||
configuration {
|
||||
filters {
|
||||
filter {
|
||||
glob = '/app/resources/**'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// tasks.jibDockerBuild.dependsOn(':fineract-provider:bootJar')
|
||||
@@ -0,0 +1,88 @@
|
||||
# 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.
|
||||
#
|
||||
|
||||
# NB: Travis CI (dist: bionic) supports up to v3.7
|
||||
# (unless we'd install a more recent version in .travis.yml)
|
||||
version: '3.7'
|
||||
services:
|
||||
# Backend service
|
||||
fineractmysql:
|
||||
image: mariadb:10.9
|
||||
volumes:
|
||||
- ../../fineract-db/server_collation.cnf:/etc/mysql/conf.d/server_collation.cnf
|
||||
- ../../fineract-db/docker:/docker-entrypoint-initdb.d:Z,ro
|
||||
restart: always
|
||||
environment:
|
||||
MYSQL_ROOT_PASSWORD: skdcnwauicn2ucnaecasdsajdnizucawencascdca
|
||||
healthcheck:
|
||||
test: ["CMD", "mysqladmin" ,"ping", "-h", "localhost", "--password=skdcnwauicn2ucnaecasdsajdnizucawencascdca" ]
|
||||
timeout: 10s
|
||||
retries: 10
|
||||
ports:
|
||||
- "3306:3306"
|
||||
fineract-server:
|
||||
image: fineract-custom:latest
|
||||
volumes:
|
||||
- ../../fineract-provider/build/data:/data
|
||||
healthcheck:
|
||||
test: ["CMD", 'sh', '-c', 'echo -e "Checking for the availability of Fineract server deployment"; while ! nc -z "fineract-server" 8443; do sleep 1; printf "-"; done; echo -e " >> Fineract server has started";' ]
|
||||
timeout: 10s
|
||||
retries: 10
|
||||
ports:
|
||||
- 8443:8443
|
||||
depends_on:
|
||||
fineractmysql:
|
||||
condition: service_healthy
|
||||
environment:
|
||||
# NOTE: node aware scheduler
|
||||
- FINERACT_NODE_ID=1
|
||||
# NOTE: env vars prefixed "FINERACT_HIKARI_*" are used to configure the database connection pool
|
||||
- FINERACT_HIKARI_DRIVER_SOURCE_CLASS_NAME=org.mariadb.jdbc.Driver
|
||||
- FINERACT_HIKARI_JDBC_URL=jdbc:mariadb://fineractmysql:3306/fineract_tenants
|
||||
- FINERACT_HIKARI_USERNAME=root
|
||||
- FINERACT_HIKARI_PASSWORD=skdcnwauicn2ucnaecasdsajdnizucawencascdca
|
||||
# ... following variables are optional; "application.properties" contains reasonable defaults (same as here)
|
||||
- FINERACT_HIKARI_MINIMUM_IDLE=3
|
||||
- FINERACT_HIKARI_MAXIMUM_POOL_SIZE=10
|
||||
- FINERACT_HIKARI_IDLE_TIMEOUT=60000
|
||||
- FINERACT_HIKARI_CONNECTION_TIMEOUT=20000
|
||||
- FINERACT_HIKARI_TEST_QUERY=SELECT 1
|
||||
- FINERACT_HIKARI_AUTO_COMMIT=true
|
||||
- FINERACT_HIKARI_DS_PROPERTIES_CACHE_PREP_STMTS=true
|
||||
- FINERACT_HIKARI_DS_PROPERTIES_PREP_STMT_CACHE_SIZE=250
|
||||
- FINERACT_HIKARI_DS_PROPERTIES_PREP_STMT_CACHE_SQL_LIMIT=2048
|
||||
- FINERACT_HIKARI_DS_PROPERTIES_USE_SERVER_PREP_STMTS=true
|
||||
- FINERACT_HIKARI_DS_PROPERTIES_USE_LOCAL_SESSION_STATE=true
|
||||
- FINERACT_HIKARI_DS_PROPERTIES_REWRITE_BATCHED_STATEMENTS=true
|
||||
- FINERACT_HIKARI_DS_PROPERTIES_CACHE_RESULT_SET_METADATA=true
|
||||
- FINERACT_HIKARI_DS_PROPERTIES_CACHE_SERVER_CONFIGURATION=true
|
||||
- FINERACT_HIKARI_DS_PROPERTIES_ELIDE_SET_AUTO_COMMITS=true
|
||||
- FINERACT_HIKARI_DS_PROPERTIES_MAINTAIN_TIME_STATS=false
|
||||
- FINERACT_HIKARI_DS_PROPERTIES_LOG_SLOW_QUERIES=true
|
||||
- FINERACT_HIKARI_DS_PROPERTIES_DUMP_QUERIES_IN_EXCEPTION=true
|
||||
# NOTE: env vars prefixed "FINERACT_DEFAULT_TENANTDB_*" are used to create the default tenant database
|
||||
- FINERACT_DEFAULT_TENANTDB_HOSTNAME=fineractmysql
|
||||
- FINERACT_DEFAULT_TENANTDB_PORT=3306
|
||||
- FINERACT_DEFAULT_TENANTDB_UID=root
|
||||
- FINERACT_DEFAULT_TENANTDB_PWD=skdcnwauicn2ucnaecasdsajdnizucawencascdca
|
||||
- FINERACT_DEFAULT_TENANTDB_CONN_PARAMS=
|
||||
- FINERACT_DEFAULT_TENANTDB_TIMEZONE=Asia/Kolkata
|
||||
- FINERACT_DEFAULT_TENANTDB_IDENTIFIER=default
|
||||
- FINERACT_DEFAULT_TENANTDB_NAME=fineract_default
|
||||
- FINERACT_DEFAULT_TENANTDB_DESCRIPTION=Default Demo Tenant
|
||||
- JAVA_TOOL_OPTIONS="-Xmx1G"
|
||||
Reference in New Issue
Block a user