Commit 4fec87a7 authored by sober's avatar sober Committed by linlinjava
Browse files

remove useless reference and modify log print type about core (#218)

parent b5d61aae
package org.linlinjava.litemall.core; package org.linlinjava.litemall.core;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.linlinjava.litemall.core.storage.AliyunStorage; import org.linlinjava.litemall.core.storage.AliyunStorage;
...@@ -17,6 +19,8 @@ import java.io.IOException; ...@@ -17,6 +19,8 @@ import java.io.IOException;
@RunWith(SpringJUnit4ClassRunner.class) @RunWith(SpringJUnit4ClassRunner.class)
@SpringBootTest @SpringBootTest
public class AliyunStorageTest { public class AliyunStorageTest {
private final Log logger = LogFactory.getLog(AliyunStorageTest.class);
@Autowired @Autowired
private AliyunStorage aliyunStorage; private AliyunStorage aliyunStorage;
...@@ -27,11 +31,9 @@ public class AliyunStorageTest { ...@@ -27,11 +31,9 @@ public class AliyunStorageTest {
aliyunStorage.store(new FileInputStream(test), testFile.length(), "image/png", "litemall.png"); aliyunStorage.store(new FileInputStream(test), testFile.length(), "image/png", "litemall.png");
Resource resource = aliyunStorage.loadAsResource("litemall.png"); Resource resource = aliyunStorage.loadAsResource("litemall.png");
String url = aliyunStorage.generateUrl("litemall.png"); String url = aliyunStorage.generateUrl("litemall.png");
System.out.println("test file " + test); logger.info("test file " + test);
System.out.println("store file " + resource.getURI()); logger.info("store file " + resource.getURI());
System.out.println("generate url " + url); logger.info("generate url " + url);
// tencentOsService.delete("litemall.png");
} }
} }
\ No newline at end of file
package org.linlinjava.litemall.core; package org.linlinjava.litemall.core;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.scheduling.annotation.Async; import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@Service @Service
public class AsyncTask { public class AsyncTask {
private final Log logger = LogFactory.getLog(AsyncTask.class);
@Async @Async
public void asyncMethod() { public void asyncMethod() {
System.out.println("Execute method asynchronously. " logger.info("Execute method asynchronously. "
+ Thread.currentThread().getName()); + Thread.currentThread().getName());
} }
public void nonasyncMethod() { public void nonasyncMethod() {
System.out.println("Execute method nonasynchronously. " logger.info("Execute method nonasynchronously. "
+ Thread.currentThread().getName()); + Thread.currentThread().getName());
} }
} }
package org.linlinjava.litemall.core; package org.linlinjava.litemall.core;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -12,12 +14,13 @@ import org.springframework.test.context.web.WebAppConfiguration; ...@@ -12,12 +14,13 @@ import org.springframework.test.context.web.WebAppConfiguration;
@RunWith(SpringJUnit4ClassRunner.class) @RunWith(SpringJUnit4ClassRunner.class)
@SpringBootTest @SpringBootTest
public class CoreConfigTest { public class CoreConfigTest {
private final Log logger = LogFactory.getLog(CoreConfigTest.class);
@Autowired @Autowired
Environment environment; Environment environment;
@Test @Test
public void test() { public void test() {
// 测试获取application-core.yml配置信息 // 测试获取application-core.yml配置信息
System.out.println(environment.getProperty("litemall.express.appId")); logger.info(environment.getProperty("litemall.express.appId"));
} }
} }
package org.linlinjava.litemall.core; package org.linlinjava.litemall.core;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.linlinjava.litemall.core.express.ExpressService; import org.linlinjava.litemall.core.express.ExpressService;
...@@ -13,6 +15,8 @@ import org.springframework.test.context.web.WebAppConfiguration; ...@@ -13,6 +15,8 @@ import org.springframework.test.context.web.WebAppConfiguration;
@RunWith(SpringJUnit4ClassRunner.class) @RunWith(SpringJUnit4ClassRunner.class)
@SpringBootTest(classes = Application.class) @SpringBootTest(classes = Application.class)
public class ExpressTest { public class ExpressTest {
private final Log logger = LogFactory.getLog(ExpressTest.class);
@Autowired @Autowired
private ExpressService expressService; private ExpressService expressService;
...@@ -22,8 +26,8 @@ public class ExpressTest { ...@@ -22,8 +26,8 @@ public class ExpressTest {
try { try {
ei = expressService.getExpressInfo("YTO", "800669400640887922"); ei = expressService.getExpressInfo("YTO", "800669400640887922");
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); logger.error(e.getMessage(), e);
} }
System.out.print(ei); logger.info(ei);
} }
} }
package org.linlinjava.litemall.core; package org.linlinjava.litemall.core;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.linlinjava.litemall.core.storage.LocalStorage; import org.linlinjava.litemall.core.storage.LocalStorage;
...@@ -17,6 +19,8 @@ import java.io.IOException; ...@@ -17,6 +19,8 @@ import java.io.IOException;
@RunWith(SpringJUnit4ClassRunner.class) @RunWith(SpringJUnit4ClassRunner.class)
@SpringBootTest @SpringBootTest
public class LocalStorageTest { public class LocalStorageTest {
private final Log logger = LogFactory.getLog(LocalStorageTest.class);
@Autowired @Autowired
private LocalStorage localStorage; private LocalStorage localStorage;
...@@ -27,12 +31,9 @@ public class LocalStorageTest { ...@@ -27,12 +31,9 @@ public class LocalStorageTest {
localStorage.store(new FileInputStream(test), testFile.length(), "image/png", "litemall.png"); localStorage.store(new FileInputStream(test), testFile.length(), "image/png", "litemall.png");
Resource resource = localStorage.loadAsResource("litemall.png"); Resource resource = localStorage.loadAsResource("litemall.png");
String url = localStorage.generateUrl("litemall.png"); String url = localStorage.generateUrl("litemall.png");
System.out.println("test file " + test); logger.info("test file " + test);
System.out.println("store file " + resource.getURI()); logger.info("store file " + resource.getURI());
System.out.println("generate url " + url); logger.info("generate url " + url);
// localStorage.delete("litemall.png");
} }
} }
\ No newline at end of file
package org.linlinjava.litemall.core; package org.linlinjava.litemall.core;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.linlinjava.litemall.core.storage.QiniuStorage; import org.linlinjava.litemall.core.storage.QiniuStorage;
...@@ -17,6 +19,8 @@ import java.io.IOException; ...@@ -17,6 +19,8 @@ import java.io.IOException;
@RunWith(SpringJUnit4ClassRunner.class) @RunWith(SpringJUnit4ClassRunner.class)
@SpringBootTest @SpringBootTest
public class QiniuStorageTest { public class QiniuStorageTest {
private final Log logger = LogFactory.getLog(QiniuStorageTest.class);
@Autowired @Autowired
private QiniuStorage qiniuStorage; private QiniuStorage qiniuStorage;
...@@ -27,10 +31,9 @@ public class QiniuStorageTest { ...@@ -27,10 +31,9 @@ public class QiniuStorageTest {
qiniuStorage.store(new FileInputStream(test), testFile.length(), "image/png", "litemall.png"); qiniuStorage.store(new FileInputStream(test), testFile.length(), "image/png", "litemall.png");
Resource resource = qiniuStorage.loadAsResource("litemall.png"); Resource resource = qiniuStorage.loadAsResource("litemall.png");
String url = qiniuStorage.generateUrl("litemall.png"); String url = qiniuStorage.generateUrl("litemall.png");
System.out.println("test file " + test); logger.info("test file " + test);
System.out.println("store file " + resource.getURI()); logger.info("store file " + resource.getURI());
System.out.println("generate url " + url); logger.info("generate url " + url);
// qiniuStorage.delete("litemall.png");
} }
} }
\ No newline at end of file
package org.linlinjava.litemall.core; package org.linlinjava.litemall.core;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.linlinjava.litemall.core.storage.TencentStorage; import org.linlinjava.litemall.core.storage.TencentStorage;
...@@ -17,6 +19,8 @@ import java.io.IOException; ...@@ -17,6 +19,8 @@ import java.io.IOException;
@RunWith(SpringJUnit4ClassRunner.class) @RunWith(SpringJUnit4ClassRunner.class)
@SpringBootTest @SpringBootTest
public class TencentStorageTest { public class TencentStorageTest {
private Log logger = LogFactory.getLog(TencentStorageTest.class);
@Autowired @Autowired
private TencentStorage tencentStorage; private TencentStorage tencentStorage;
...@@ -27,11 +31,9 @@ public class TencentStorageTest { ...@@ -27,11 +31,9 @@ public class TencentStorageTest {
tencentStorage.store(new FileInputStream(test), testFile.length(), "image/png", "litemall.png"); tencentStorage.store(new FileInputStream(test), testFile.length(), "image/png", "litemall.png");
Resource resource = tencentStorage.loadAsResource("litemall.png"); Resource resource = tencentStorage.loadAsResource("litemall.png");
String url = tencentStorage.generateUrl("litemall.png"); String url = tencentStorage.generateUrl("litemall.png");
System.out.println("test file " + test); logger.info("test file " + test);
System.out.println("store file " + resource.getURI()); logger.info("store file " + resource.getURI());
System.out.println("generate url " + url); logger.info("generate url " + url);
// tencentStorage.delete("litemall.png");
} }
} }
\ No newline at end of file
...@@ -4,9 +4,7 @@ import org.junit.Assert; ...@@ -4,9 +4,7 @@ import org.junit.Assert;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.junit.rules.ExpectedException; import org.junit.rules.ExpectedException;
import org.junit.rules.Timeout;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.linlinjava.litemall.core.util.bcrypt.BCrypt;
import org.powermock.api.mockito.PowerMockito; import org.powermock.api.mockito.PowerMockito;
import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner; import org.powermock.modules.junit4.PowerMockRunner;
...@@ -16,7 +14,8 @@ import java.security.SecureRandom; ...@@ -16,7 +14,8 @@ import java.security.SecureRandom;
@RunWith(PowerMockRunner.class) @RunWith(PowerMockRunner.class)
public class BCryptTest { public class BCryptTest {
@Rule public final ExpectedException thrown = ExpectedException.none(); @Rule
public final ExpectedException thrown = ExpectedException.none();
@Test @Test
public void testHashpwSaltIsNull() throws IllegalArgumentException { public void testHashpwSaltIsNull() throws IllegalArgumentException {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment