You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
76 lines
2.0 KiB
76 lines
2.0 KiB
package com.community.pocket;
|
|
|
|
import com.community.pocket.entity.po.android.Garbage;
|
|
import com.community.pocket.entity.po.android.GarbageWastePrice;
|
|
import com.community.pocket.entity.vo.android.QueryUserForm;
|
|
import com.community.pocket.repository.android.GarbageDao;
|
|
import com.community.pocket.repository.android.GarbagePriceDao;
|
|
import com.community.pocket.repository.android.UserDao;
|
|
import com.community.pocket.repository.android.VisitorPeopleDao;
|
|
import com.google.gson.Gson;
|
|
import org.apache.commons.lang3.RandomStringUtils;
|
|
import org.junit.jupiter.api.Test;
|
|
import org.slf4j.Logger;
|
|
import org.slf4j.LoggerFactory;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.boot.test.context.SpringBootTest;
|
|
|
|
import java.io.FileNotFoundException;
|
|
import java.io.FileReader;
|
|
import java.util.List;
|
|
import java.util.Random;
|
|
|
|
@SpringBootTest
|
|
class DemoApplicationTests {
|
|
|
|
@Autowired
|
|
private UserDao userDao;
|
|
|
|
@Autowired
|
|
private VisitorPeopleDao visitorPeopleDao;
|
|
|
|
@Autowired
|
|
private GarbageDao garbageDao;
|
|
|
|
@Autowired
|
|
private GarbagePriceDao garbagePriceDao;
|
|
|
|
private static final Logger LOG = LoggerFactory.getLogger(DemoApplicationTests.class);
|
|
|
|
@Test
|
|
void contextLoads() {
|
|
}
|
|
|
|
@Test
|
|
void queryUser() {
|
|
QueryUserForm queryUserForm = new QueryUserForm();
|
|
queryUserForm.setName("p");
|
|
userDao.queryUser(queryUserForm);
|
|
}
|
|
|
|
@Test
|
|
void showTime() {
|
|
List<String> s = visitorPeopleDao.getVisitorList();
|
|
LOG.info(String.join(",", s));
|
|
}
|
|
|
|
@Test
|
|
void loadData() throws FileNotFoundException {
|
|
Gson gson = new Gson();
|
|
MyGarbage g = gson.fromJson(new FileReader("src/main/resources/garbage.json"), MyGarbage.class);
|
|
for (Garbage garbage : g.getList()) {
|
|
garbageDao.save(garbage);
|
|
}
|
|
}
|
|
|
|
@Test
|
|
void loadPriceData() {
|
|
for (int i = 0; i < 100; i++) {
|
|
GarbageWastePrice price = new GarbageWastePrice();
|
|
price.setName(RandomStringUtils.randomAlphabetic(6));
|
|
price.setPrice(new Random().nextInt(100) * 1F);
|
|
garbagePriceDao.save(price);
|
|
}
|
|
}
|
|
|
|
}
|
|
|