diff --git a/sumk-base/src/main/java/org/yx/conf/Const.java b/sumk-base/src/main/java/org/yx/conf/Const.java index fc4eec9..ae739d5 100644 --- a/sumk-base/src/main/java/org/yx/conf/Const.java +++ b/sumk-base/src/main/java/org/yx/conf/Const.java @@ -20,7 +20,7 @@ public final class Const { public static final String DEFAULT_DB_NAME = "sumk"; - public static final int SUMK_VERSION = 0x312; + public static final int SUMK_VERSION = 0x400; public static String sumkVersion() { return new StringBuilder(10).append((Const.SUMK_VERSION >> 8) & 0x0F).append('.') diff --git a/sumk-test/src/test/java/org/test/web/client/AesClientTest.java b/sumk-test/src/test/java/org/test/client/HttpAesClientTest.java similarity index 97% rename from sumk-test/src/test/java/org/test/web/client/AesClientTest.java rename to sumk-test/src/test/java/org/test/client/HttpAesClientTest.java index 4c79fe3..2915a68 100644 --- a/sumk-test/src/test/java/org/test/web/client/AesClientTest.java +++ b/sumk-test/src/test/java/org/test/client/HttpAesClientTest.java @@ -1,4 +1,4 @@ -package org.test.web.client; +package org.test.client; import java.net.URLEncoder; import java.util.Arrays; @@ -17,6 +17,7 @@ import org.apache.http.util.EntityUtils; import org.junit.Assert; import org.junit.Test; +import org.test.web.client.Encrypt; import org.yx.common.util.S; import org.yx.log.Log; @@ -25,7 +26,7 @@ * 加解密部分需要些技术功底才好看明白。 * 好消息是:现在web应用一般都使用https了,就可以不用加解密方式了,就可以不看加解密部分 */ -public class AesClientTest { +public class HttpAesClientTest { private String getUrl(String act) { String url = "http://localhost:8080/rest/" + act; @@ -122,7 +123,7 @@ public void aes_sign() throws Exception { String sign = Encrypt.sign(S.json().toJson(map).getBytes(charset)); System.out.println("sign:" + sign); - HttpPost post = new HttpPost(getUrl(act) + "?_sign=" + sign); + HttpPost post = new HttpPost(getUrl(act) + "?__sign=" + sign); post.setEntity(se); resp = client.execute(post); String line = resp.getStatusLine().toString(); diff --git a/sumk-test/src/test/java/org/test/web/client/PlainClientTest.java b/sumk-test/src/test/java/org/test/client/HttpPlainClientTest.java similarity index 96% rename from sumk-test/src/test/java/org/test/web/client/PlainClientTest.java rename to sumk-test/src/test/java/org/test/client/HttpPlainClientTest.java index 3996230..8301757 100644 --- a/sumk-test/src/test/java/org/test/web/client/PlainClientTest.java +++ b/sumk-test/src/test/java/org/test/client/HttpPlainClientTest.java @@ -1,4 +1,4 @@ -package org.test.web.client; +package org.test.client; import java.io.File; import java.io.IOException; @@ -24,6 +24,7 @@ import org.apache.http.util.EntityUtils; import org.junit.Assert; import org.junit.Test; +import org.test.web.client.Encrypt; import org.yx.common.util.S; import org.yx.demo.member.DemoUser; import org.yx.log.Log; @@ -31,7 +32,7 @@ /* * 通过这个类,可以了解web的通讯。 */ -public class PlainClientTest { +public class HttpPlainClientTest { private String getUrl(String act) { return "http://localhost:8080/rest/" + act; @@ -81,7 +82,7 @@ public void login_sign() throws Exception { json.put("name", "小明"); String req = S.json().toJson(json); String sign = Encrypt.sign(req.getBytes(charset)); - HttpPost post = new HttpPost(getUrl(act) + "?_sign=" + sign); + HttpPost post = new HttpPost(getUrl(act) + "?__sign=" + sign); StringEntity se = new StringEntity(req,charset); post.setEntity(se); HttpResponse resp = client.execute(post); @@ -133,7 +134,7 @@ public void upload() throws IOException { MultipartEntity reqEntity = new MultipartEntity(); reqEntity.addPart("Api", StringBody.create("common", "text/plain", Charset.forName(charset))); reqEntity.addPart("param", StringBody.create(req, "text/plain", Charset.forName(charset))); - reqEntity.addPart("img", new FileBody(new File("logo_bluce.jpg"))); + reqEntity.addPart("img", new FileBody(new File("test.sql"))); post.setEntity(reqEntity); HttpResponse resp = client.execute(post); diff --git a/sumk-test/src/test/java/org/test/HttpPressTest.java b/sumk-test/src/test/java/org/test/client/HttpPressTest.java similarity index 99% rename from sumk-test/src/test/java/org/test/HttpPressTest.java rename to sumk-test/src/test/java/org/test/client/HttpPressTest.java index 3a4a42b..dd228b2 100644 --- a/sumk-test/src/test/java/org/test/HttpPressTest.java +++ b/sumk-test/src/test/java/org/test/client/HttpPressTest.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.test; +package org.test.client; import java.io.IOException; import java.util.Arrays; diff --git a/sumk-test/src/test/java/org/test/RpcPressTest.java b/sumk-test/src/test/java/org/test/client/RpcPressTest.java similarity index 99% rename from sumk-test/src/test/java/org/test/RpcPressTest.java rename to sumk-test/src/test/java/org/test/client/RpcPressTest.java index 17b1f7b..a1ccabf 100644 --- a/sumk-test/src/test/java/org/test/RpcPressTest.java +++ b/sumk-test/src/test/java/org/test/client/RpcPressTest.java @@ -1,4 +1,4 @@ -package org.test; +package org.test.client; import java.util.Arrays; import java.util.Random; diff --git a/sumk-test/src/test/java/org/test/soa/client/RpcTest.java b/sumk-test/src/test/java/org/test/client/RpcTest.java similarity index 99% rename from sumk-test/src/test/java/org/test/soa/client/RpcTest.java rename to sumk-test/src/test/java/org/test/client/RpcTest.java index 2fbce19..4d2fbc1 100644 --- a/sumk-test/src/test/java/org/test/soa/client/RpcTest.java +++ b/sumk-test/src/test/java/org/test/client/RpcTest.java @@ -1,4 +1,4 @@ -package org.test.soa.client; +package org.test.client; import java.io.IOException; import java.util.ArrayList; diff --git a/sumk-test/src/test/java/org/test/web/client/Encrypt.java b/sumk-test/src/test/java/org/test/web/client/Encrypt.java index 79f8e5b..ae4a7a1 100644 --- a/sumk-test/src/test/java/org/test/web/client/Encrypt.java +++ b/sumk-test/src/test/java/org/test/web/client/Encrypt.java @@ -46,7 +46,7 @@ public static String sign(byte[] data) throws Exception { } public static byte[] encryptByte(byte[] data) throws Exception { - MessageDigest md = MessageDigest.getInstance("md5"); + MessageDigest md = MessageDigest.getInstance("SHA-256"); md.update(data); return md.digest(); } diff --git a/sumk-test/src/test/java/org/test/web/demo/PlainServer.java b/sumk-test/src/test/java/org/test/web/demo/PlainServer.java index 4bcacca..e3cab15 100644 --- a/sumk-test/src/test/java/org/test/web/demo/PlainServer.java +++ b/sumk-test/src/test/java/org/test/web/demo/PlainServer.java @@ -48,9 +48,9 @@ public String upload(String name, @Param(required = true) Integer age) throws Fi List files=WebUtil.getMultiParts(); Assert.assertEquals(2, files.size()); MultipartItem f=WebUtil.getPart("img"); - Assert.assertEquals("logo_bluce.jpg", f.getSubmittedFileName()); + Assert.assertEquals("test.sql", f.getSubmittedFileName()); byte[] data=IOUtil.readAllBytes(f.getInputStream(),false); - byte[] exp=Files.readAllBytes(new File("logo_bluce.jpg").toPath()); + byte[] exp=Files.readAllBytes(new File("test.sql").toPath()); Assert.assertArrayEquals(exp, data); return "姓名:"+name+",年龄:"+age; } diff --git a/test.sql b/sumk-test/test.sql similarity index 97% rename from test.sql rename to sumk-test/test.sql index 023014c..3d86b96 100644 --- a/test.sql +++ b/sumk-test/test.sql @@ -1,85 +1,85 @@ -create database sumk; -use sumk; -SET FOREIGN_KEY_CHECKS=0; - -DROP TABLE IF EXISTS `demo_user`; -CREATE TABLE `demo_user` ( - `id` bigint(20) NOT NULL, - `name` varchar(255) DEFAULT NULL, - `age` int(11) DEFAULT NULL, - `last_update` timestamp NULL DEFAULT NULL, - `enable` tinyint(4) DEFAULT '1' COMMENT '1表示有效记录,0表示记录已被删除', - PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - - -DROP TABLE IF EXISTS `generate`; -CREATE TABLE `generate` ( - `id` bigint(20) NOT NULL AUTO_INCREMENT, - `name` varchar(255) DEFAULT NULL, - PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - - -DROP TABLE IF EXISTS `multikey`; -CREATE TABLE `multikey` ( - `id1` varchar(255) NOT NULL COMMENT '联合主键1', - `id2` varchar(255) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL COMMENT '联合主键2', - `name` varchar(255) DEFAULT NULL, - `age` int(11) DEFAULT NULL, - PRIMARY KEY (`id1`,`id2`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - - -DROP TABLE IF EXISTS `odd`; -CREATE TABLE `odd` ( - `id` bigint(20) NOT NULL AUTO_INCREMENT, - `data` mediumblob, - `update_time` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP, - PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=2208669043496333243 DEFAULT CHARSET=utf8; - - -DROP TABLE IF EXISTS `school_fuzhou`; -CREATE TABLE `school_fuzhou` ( - `id` bigint(20) NOT NULL, - `name` varchar(255) DEFAULT NULL, - `lastUpdate` timestamp NULL DEFAULT NULL, - PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - - -DROP TABLE IF EXISTS `test_table`; -CREATE TABLE `test_table` ( - `id` bigint(20) NOT NULL COMMENT 'Long 类型,第1列', - `userid` varchar(255) NOT NULL COMMENT 'String 类型,联合索引1,第2列', - `enable` bit(1) NOT NULL COMMENT 'boolean 类型,联合索引2,第3列', - `height` smallint(6) DEFAULT NULL COMMENT 'Short 类型,第4列', - `age` tinyint(4) DEFAULT NULL COMMENT 'byte 类型,第5列', - `f` decimal(12,3) DEFAULT NULL COMMENT 'float 类型,第6列', - `d` decimal(20,5) DEFAULT NULL COMMENT 'double 类型,第7列', - `valid` bit(1) DEFAULT b'1' COMMENT '1表示有效记录,0表示记录已被删除', - PRIMARY KEY (`id`), - KEY `testtable_index1` (`userid`,`enable`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='用来测试表格自动生成'; - - -DROP TABLE IF EXISTS `timedemo`; -CREATE TABLE `timedemo` ( - `id` bigint(20) NOT NULL, - `name` varchar(255) DEFAULT NULL, - `lastUpdate` timestamp NULL DEFAULT NULL, - PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - - -DROP TABLE IF EXISTS `user_detail`; -CREATE TABLE `user_detail` ( - `id` bigint(20) NOT NULL, - `user_id` bigint(20) NOT NULL, - `addr` varchar(255) DEFAULT NULL, - `height` int(11) DEFAULT NULL, - `valid` char(1) DEFAULT '1' COMMENT '1表示有效记录,0表示记录已被删除', - PRIMARY KEY (`id`), - KEY `user_detail_index1` (`user_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; +create database sumk; +use sumk; +SET FOREIGN_KEY_CHECKS=0; + +DROP TABLE IF EXISTS `demo_user`; +CREATE TABLE `demo_user` ( + `id` bigint(20) NOT NULL, + `name` varchar(255) DEFAULT NULL, + `age` int(11) DEFAULT NULL, + `last_update` timestamp NULL DEFAULT NULL, + `enable` tinyint(4) DEFAULT '1' COMMENT '1表示有效记录,0表示记录已被删除', + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + + +DROP TABLE IF EXISTS `generate`; +CREATE TABLE `generate` ( + `id` bigint(20) NOT NULL AUTO_INCREMENT, + `name` varchar(255) DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + + +DROP TABLE IF EXISTS `multikey`; +CREATE TABLE `multikey` ( + `id1` varchar(255) NOT NULL COMMENT '联合主键1', + `id2` varchar(255) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL COMMENT '联合主键2', + `name` varchar(255) DEFAULT NULL, + `age` int(11) DEFAULT NULL, + PRIMARY KEY (`id1`,`id2`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + + +DROP TABLE IF EXISTS `odd`; +CREATE TABLE `odd` ( + `id` bigint(20) NOT NULL AUTO_INCREMENT, + `data` mediumblob, + `update_time` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP, + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=2208669043496333243 DEFAULT CHARSET=utf8; + + +DROP TABLE IF EXISTS `school_fuzhou`; +CREATE TABLE `school_fuzhou` ( + `id` bigint(20) NOT NULL, + `name` varchar(255) DEFAULT NULL, + `lastUpdate` timestamp NULL DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + + +DROP TABLE IF EXISTS `test_table`; +CREATE TABLE `test_table` ( + `id` bigint(20) NOT NULL COMMENT 'Long 类型,第1列', + `userid` varchar(255) NOT NULL COMMENT 'String 类型,联合索引1,第2列', + `enable` bit(1) NOT NULL COMMENT 'boolean 类型,联合索引2,第3列', + `height` smallint(6) DEFAULT NULL COMMENT 'Short 类型,第4列', + `age` tinyint(4) DEFAULT NULL COMMENT 'byte 类型,第5列', + `f` decimal(12,3) DEFAULT NULL COMMENT 'float 类型,第6列', + `d` decimal(20,5) DEFAULT NULL COMMENT 'double 类型,第7列', + `valid` bit(1) DEFAULT b'1' COMMENT '1表示有效记录,0表示记录已被删除', + PRIMARY KEY (`id`), + KEY `testtable_index1` (`userid`,`enable`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='用来测试表格自动生成'; + + +DROP TABLE IF EXISTS `timedemo`; +CREATE TABLE `timedemo` ( + `id` bigint(20) NOT NULL, + `name` varchar(255) DEFAULT NULL, + `lastUpdate` timestamp NULL DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + + +DROP TABLE IF EXISTS `user_detail`; +CREATE TABLE `user_detail` ( + `id` bigint(20) NOT NULL, + `user_id` bigint(20) NOT NULL, + `addr` varchar(255) DEFAULT NULL, + `height` int(11) DEFAULT NULL, + `valid` char(1) DEFAULT '1' COMMENT '1表示有效记录,0表示记录已被删除', + PRIMARY KEY (`id`), + KEY `user_detail_index1` (`user_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8;