FINERACT-942 Remove bad logging pattern(Use of system.out) and added checkstyle
This commit is contained in:
committed by
Michael Vorburger ⛑️
parent
9ce72fe67b
commit
20e8a02294
@@ -30,7 +30,8 @@ import io.restassured.specification.RequestSpecification;
|
||||
import io.restassured.specification.ResponseSpecification;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.http.conn.HttpHostConnectException;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
||||
/**
|
||||
@@ -42,7 +43,7 @@ import org.apache.http.conn.HttpHostConnectException;
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public class Utils {
|
||||
|
||||
private final static Logger LOG = LoggerFactory.getLogger(Utils.class);
|
||||
public static final String TENANT_IDENTIFIER = "tenantIdentifier=default";
|
||||
|
||||
private static final String LOGIN_URL = "/fineract-provider/api/v1/authentication?username=mifos&password=password&" + TENANT_IDENTIFIER;
|
||||
@@ -56,7 +57,7 @@ public class Utils {
|
||||
|
||||
public static String loginIntoServerAndGetBase64EncodedAuthenticationKey() {
|
||||
try {
|
||||
System.out.println("-----------------------------------LOGIN-----------------------------------------");
|
||||
LOG.info("-----------------------------------LOGIN-----------------------------------------");
|
||||
final String json = RestAssured.post(LOGIN_URL).asString();
|
||||
assertThat("Failed to login into fineract platform", StringUtils.isBlank(json), is(false));
|
||||
return JsonPath.with(json).get("base64EncodedAuthenticationKey");
|
||||
|
||||
+11
-7
@@ -43,12 +43,14 @@ import org.mockito.InjectMocks;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.Mockito;
|
||||
import org.mockito.junit.MockitoJUnitRunner;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.w3c.dom.NodeList;
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
@RunWith(MockitoJUnitRunner.class)
|
||||
public class XBRLBuilderTest {
|
||||
|
||||
private final static Logger LOG = LoggerFactory.getLogger(XBRLBuilderTest.class);
|
||||
@Mock
|
||||
private NamespaceReadPlatformServiceImpl readNamespaceService;
|
||||
|
||||
@@ -58,8 +60,8 @@ public class XBRLBuilderTest {
|
||||
@Before
|
||||
public void setUp() {
|
||||
this.readNamespaceService = Mockito.mock(NamespaceReadPlatformServiceImpl.class);
|
||||
lenient().when(this.readNamespaceService.retrieveNamespaceByPrefix(ArgumentMatchers.anyString())).thenReturn(
|
||||
new NamespaceData(1l, "mockedprefix", "mockedurl"));
|
||||
lenient().when(this.readNamespaceService.retrieveNamespaceByPrefix(ArgumentMatchers.anyString()))
|
||||
.thenReturn(new NamespaceData(1l, "mockedprefix", "mockedurl"));
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -68,10 +70,12 @@ public class XBRLBuilderTest {
|
||||
final MixTaxonomyData data1 = Mockito.mock(MixTaxonomyData.class);
|
||||
when(data1.getName()).thenReturn("Assets");
|
||||
map.put(data1, new BigDecimal(10000));
|
||||
final String result = this.xbrlBuilder.build(map, Date.valueOf("2005-11-11"), Date.valueOf("2013-07-17"), "USD");
|
||||
System.out.println(result);
|
||||
NodeList nodes = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(
|
||||
new ByteArrayInputStream(result.getBytes(StandardCharsets.UTF_8))).getElementsByTagName("Assets");
|
||||
final String result = this.xbrlBuilder.build(map, Date.valueOf("2005-11-11"), Date.valueOf("2013-07-17"),
|
||||
"USD");
|
||||
LOG.info("{}", result);
|
||||
NodeList nodes = DocumentBuilderFactory.newInstance().newDocumentBuilder()
|
||||
.parse(new ByteArrayInputStream(result.getBytes(StandardCharsets.UTF_8)))
|
||||
.getElementsByTagName("Assets");
|
||||
assertNotNull(nodes);
|
||||
assertNotNull(nodes.item(0));
|
||||
assertEquals("Assets", nodes.item(0).getNodeName());
|
||||
|
||||
@@ -22,13 +22,15 @@ import javax.jms.JMSException;
|
||||
import javax.jms.Message;
|
||||
import javax.jms.Session;
|
||||
import javax.jms.TextMessage;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.jms.listener.SessionAwareMessageListener;
|
||||
|
||||
public class Listener implements SessionAwareMessageListener {
|
||||
|
||||
private final static Logger LOG = LoggerFactory.getLogger(Listener.class);
|
||||
@Override
|
||||
public void onMessage(Message message, Session session) throws JMSException {
|
||||
TextMessage msg = (TextMessage) message;
|
||||
System.out.println("Received: " + msg.getText());
|
||||
LOG.info("Received: {}" ,msg.getText());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,6 +25,8 @@ import javax.jms.Session;
|
||||
import org.apache.fineract.notification.data.NotificationData;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.jms.core.JmsTemplate;
|
||||
import org.springframework.jms.core.MessageCreator;
|
||||
@@ -36,7 +38,7 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
})
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
public class SenderTest {
|
||||
|
||||
private final static Logger LOG = LoggerFactory.getLogger(SenderTest.class);
|
||||
@Autowired
|
||||
private JmsTemplate jmsTemplate;
|
||||
|
||||
@@ -68,7 +70,7 @@ public class SenderTest {
|
||||
jmsTemplate.send(mockQueue, new MessageCreator() {
|
||||
@Override
|
||||
public Message createMessage(Session session) throws JMSException {
|
||||
System.out.println("Message send successfully");
|
||||
LOG.info("Message send successfully");
|
||||
return session.createObjectMessage(notificationData);
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user