java
开发过程中技术测试用例,包括Java类的书写规范,java工具类,Spring的配置,
mybatis 的配置应用, shiro 的配置应用, Maven 项目的搭建等
可参考: com.ljq.demo.bean.JavaBeanDemo
可参考: com.ljq.demo.util.JavaUtilDemo
可参考: com.ljq.demo.mode.SingletonModeDemo
已知所有节点Key
./src/main/java/com/ljq/demo/util/LogisticsUtils.java
./src/test/java/com/ljq/demo/util/LogisticsUtilsTest.java
已知 Json 结构,但未知子节点 Key
./src/main/java/com/ljq/demo/bean/FormAreaInfo.java
./src/main/java/com/ljq/demo/constant/FormConst.java
./src/main/java/com/ljq/demo/util/JsonUtil.java
./src/test/java/com/ljq/demo/util/JsonUtilTest.java
参数校验-1-validation注解--2018-12-16
com.ljq.demo.util.SqlCheckUtil
src/main/resources/IntegralGoodsDao.xml
./src/main/java/com/ljq/demo/object/StaticMethodDemo.java
./src/test/java/com/ljq/demo/object/StaticMethodDemoTest.java
./src/main/java/com/ljq/demo/object/BuilderUserDemo.java
./src/test/java/com/ljq/demo/object/BuilderUserDemoTest.java
./src/main/java/com/ljq/demo/object/BuilderPizzaDemo.java
./src/main/java/com/ljq/demo/object/BuilderSweetPizzaDemo.java
./src/test/java/com/ljq/demo/object/BuilderSweetPizzaDemoTest.java
./src/test/java/com/ljq/demo/bean/JavaBeanDemoTest.java
./src/main/java/com/ljq/demo/base/BaseDao.java
./src/main/java/com/ljq/demo/concurrentWorkPiao.java
./src/main/java/com/ljq/demo/concurrent/PiaoDemo.java
./src/test/java/com/ljq/demo/concurrent/WorkPiaoTest.java
./src/main/java/com/ljq/demo/concurrent/Worker.java
./src/main/java/com/ljq/demo/concurrent/CountDownLatchDemo.java
./src/main/java/com/ljq/demo/concurrent/WorkCalculate.java
./src/main/java/com/ljq/demo/concurrent/CalculateDemo.java
./src/main/java/com/ljq/demo/util/DataSourceUtil.java
./src/test/java/com/ljq/demo/util/DataSourceUtilTest.java
./src/main/java/com/ljq/demo/util/JwtUtil.java
./src/test/java/com/ljq/demo/util/JwtUtilTest.java
./src/test/java/com/ljq/demo/util/IteratorTest.java
./src/main/java/com/ljq/demo/util/SpringBeanUtil.java
注意事项: 需要 Spring 扫描到对应的包才能装载
多种数据库自动识别与操作
./src/main/java/com/ljq/demo/bean/Column.java
./src/main/java/com/ljq/demo/bean/Table.java
./src/main/java/com/ljq/demo/constant/DbTypeConst.java
./src/main/java/com/ljq/demo/enums/ColumnType.java
./src/main/java/com/ljq/demo/util/db/AbstractDbOperator.java
./src/main/java/com/ljq/demo/util/db/MySqlOperator.java
./src/main/java/com/ljq/demo/util/db/OracleOperator.java
./src/main/java/com/ljq/demo/util/db/SqlServerOperator.java
./src/main/java/com/ljq/demo/util/db/DbOperatorFactory.java
./src/main/java/com/ljq/demo/util/ReflectDemo.java
非集合类常量
./src/main/java/com/ljq/demo/constant/DemoConst.java
集合类常量
./src/main/java/com/ljq/demo/constant/DemoEnum.java
./src/test/java/com/ljq/demo/constant/DemoEnumTest.java
MongoDB 部分特性:
- MongoDB 中的集合对应关系型数据库中的表
- MongoDB 在向集合中添加数据时如果集合不存在,则直接创建集合
- MongoDB 插入数据时会自动生成唯一ID(
_id
)
MongoDB 基本操作示例:
./src/main/java/com/ljq/demo/util/MongoDbUtil.java
./src/test/java/com/ljq/demo/util/MongoDbUtilTest.java
MongoDB 驱动 Maven 依赖:
<!-- mongodb -->
<dependency>
<groupId>org.mongodb</groupId>
<artifactId>mongo-java-driver</artifactId>
<version>${mongodb-driver.version}</version>
</dependency>
其中 ${mongodb-driver.version}
的版本为 3.12.7
测试所用 MongoDB 的版本为: 4.4
./src/main/java/com/ljq/demo/util/StringArrayUtil.java
./src/test/java/com/ljq/demo/util/StringArrayUtilTest.java
./src/main/java/com/ljq/demo/util/CalculateUtil.java
./src/test/java/com/ljq/demo/util/CalculateUtilTest.java
合同的收款计划、付款计划生成
./src/main/java/com/ljq/demo/bean/PaymentPlanBean.java
./src/main/java/com/ljq/demo/constant/PaymentPlanConst.java
./src/main/java/com/ljq/demo/util/CalculateUtil.java
./src/main/java/com/ljq/demo/util/FinanceDateUtil.java
./src/main/java/com/ljq/demo/util/FinanceUtil.java
./src/test/java/com/ljq/demo/util/FinanceUtilTest.java
// 线程任务,工作负载
./src/main/java/com/ljq/demo/concurrent/DrinkTask.java
// 简易线程池工具类
./src/main/java/com/ljq/demo/util/ThreadPoolUtil.java
// 线程池使用示例(包括第三方工具)
./src/main/java/com/ljq/demo/concurrent/DrinkThreadPoolDemo.java
// 计算两点经纬度之间的距离
./src/main/java/com/ljq/demo/util/LocationUtil#getDistance
// 通过 ip 获取所属城市信息(ip 转城市)
./src/main/java/com/ljq/demo/util/LocationUtil#getRegionFromIp
// 测试用例
./src/test/java/com/ljq/demo/util/LocationUtilTest.java
Maven 依赖
<!-- google 地图距离计算 -->
<dependency>
<groupId>org.gavaghan</groupId>
<artifactId>geodesy</artifactId>
<version>${geodesy.version}</version>
</dependency>
<!-- ip to region -->
<dependency>
<groupId>org.lionsoul</groupId>
<artifactId>ip2region</artifactId>
<version>${ip2region.version}</version>
</dependency>
// 生成随机 ip
./src/main/java/com/ljq/demo/util/IpUtil#generateRandomIp