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