Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
梦中观雨
cat
提交
76ac0de2
C
cat
项目概览
梦中观雨
/
cat
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
C
cat
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
76ac0de2
编写于
5月 21, 2013
作者:
F
Frankie Wu
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #59 from ainilife/master
Refactor the code due to the change of abtest model
上级
9ebf6bf3
693ef477
变更
23
隐藏空白更改
内联
并排
Showing
23 changed file
with
521 addition
and
375 deletion
+521
-375
cat-core/src/main/java/com/dianping/cat/abtest/spi/ABTestEntity.java
...c/main/java/com/dianping/cat/abtest/spi/ABTestEntity.java
+30
-32
cat-core/src/main/java/com/dianping/cat/abtest/spi/internal/DefaultABTestEntityManager.java
...g/cat/abtest/spi/internal/DefaultABTestEntityManager.java
+11
-9
cat-core/src/main/resources/META-INF/dal/model/abtest-codegen.xml
.../src/main/resources/META-INF/dal/model/abtest-codegen.xml
+15
-9
cat-core/src/main/resources/META-INF/dal/model/abtest-model.xml
...re/src/main/resources/META-INF/dal/model/abtest-model.xml
+4
-3
cat-core/src/test/java/com/dianping/cat/abtest/spi/internal/AbtestModelTest.java
...com/dianping/cat/abtest/spi/internal/AbtestModelTest.java
+2
-2
cat-core/src/test/resources/com/dianping/cat/abtest/spi/internal/abtest.xml
...resources/com/dianping/cat/abtest/spi/internal/abtest.xml
+18
-40
cat-home/src/main/java/com/dianping/cat/build/CatDatabaseConfigurator.java
.../java/com/dianping/cat/build/CatDatabaseConfigurator.java
+0
-3
cat-home/src/main/java/com/dianping/cat/build/ComponentsConfigurator.java
...n/java/com/dianping/cat/build/ComponentsConfigurator.java
+0
-2
cat-home/src/main/java/com/dianping/cat/system/page/abtest/ABTestReport.java
...ava/com/dianping/cat/system/page/abtest/ABTestReport.java
+13
-4
cat-home/src/main/java/com/dianping/cat/system/page/abtest/AbtestStatus.java
...ava/com/dianping/cat/system/page/abtest/AbtestStatus.java
+5
-5
cat-home/src/main/java/com/dianping/cat/system/page/abtest/Handler.java
...ain/java/com/dianping/cat/system/page/abtest/Handler.java
+149
-93
cat-home/src/main/java/com/dianping/cat/system/page/abtest/Model.java
.../main/java/com/dianping/cat/system/page/abtest/Model.java
+74
-3
cat-home/src/main/java/com/dianping/cat/system/page/abtest/Payload.java
...ain/java/com/dianping/cat/system/page/abtest/Payload.java
+11
-0
cat-home/src/main/resources/META-INF/dal/jdbc/abtest-codegen.xml
...e/src/main/resources/META-INF/dal/jdbc/abtest-codegen.xml
+48
-6
cat-home/src/main/resources/META-INF/dal/jdbc/abtest-dal.xml
cat-home/src/main/resources/META-INF/dal/jdbc/abtest-dal.xml
+46
-15
cat-home/src/main/resources/META-INF/plexus/components.xml
cat-home/src/main/resources/META-INF/plexus/components.xml
+24
-88
cat-home/src/main/resources/META-INF/wizard/jdbc/wizard.xml
cat-home/src/main/resources/META-INF/wizard/jdbc/wizard.xml
+2
-1
cat-home/src/main/webapp/js/abtestAllTest.js
cat-home/src/main/webapp/js/abtestAllTest.js
+3
-15
cat-home/src/main/webapp/jsp/system/abtestAllTest.jsp
cat-home/src/main/webapp/jsp/system/abtestAllTest.jsp
+1
-1
cat-home/src/main/webapp/jsp/system/abtestCreate.jsp
cat-home/src/main/webapp/jsp/system/abtestCreate.jsp
+17
-10
cat-home/src/main/webapp/jsp/system/abtestDetail.jsp
cat-home/src/main/webapp/jsp/system/abtestDetail.jsp
+9
-8
cat-home/src/main/webapp/jsp/system/abtestReport.jsp
cat-home/src/main/webapp/jsp/system/abtestReport.jsp
+1
-3
script/Cat.sql
script/Cat.sql
+38
-23
未找到文件。
cat-core/src/main/java/com/dianping/cat/abtest/spi/ABTestEntity.java
浏览文件 @
76ac0de2
...
...
@@ -2,60 +2,64 @@ package com.dianping.cat.abtest.spi;
import
java.util.Date
;
import
com.dianping.cat.abtest.model.entity.
Entity
;
import
com.dianping.cat.abtest.model.entity.
GroupStrategy
;
import
com.dianping.cat.abtest.model.entity.
Case
;
import
com.dianping.cat.abtest.model.entity.
Run
;
public
class
ABTestEntity
{
private
Entity
m_entity
;
private
Case
m_case
;
private
ABTestGroupStrategy
m_groupStrategy
;
private
Run
m_run
;
private
ABTestGroupStrategy
m_groupStrategy
;
public
ABTestEntity
()
{
m_entity
=
new
Entity
();
m_entity
.
setDisabled
(
true
);
m_case
=
new
Case
();
m_run
=
new
Run
();
m_run
.
setDisabled
(
true
);
}
public
ABTestEntity
(
Entity
entity
)
{
m_entity
=
entity
;
public
ABTestEntity
(
Case
_case
,
Run
run
)
{
m_case
=
_case
;
m_run
=
run
;
}
public
String
getGroupStrategyName
()
{
return
m_
entity
.
getGroupStrategy
()
!=
null
?
m_entity
.
getGroupStrategy
().
getName
()
:
null
;
return
m_
case
.
getGroupStrategy
()
!=
null
?
m_case
.
getGroupStrategy
()
:
null
;
}
public
String
getGroupStrategyConfiguration
()
{
return
m_
entity
.
getGroupStrategy
()
!=
null
?
m_entity
.
getGroupStrategy
().
get
Configuration
()
:
null
;
return
m_
run
.
getGroupStrategyConfiguration
()
!=
null
?
m_run
.
getGroupStrategy
Configuration
()
:
null
;
}
public
int
getId
()
{
return
m_
entity
.
getId
();
return
m_
case
.
getId
();
}
public
String
getName
()
{
return
m_
entity
.
getName
();
return
m_
case
.
getName
();
}
public
Date
getEndDate
()
{
return
m_entity
.
getEndDate
();
}
return
m_run
.
getEndDate
();
}
public
Date
getStartDate
()
{
return
m_entity
.
getStartDate
();
}
return
m_run
.
getStartDate
();
}
public
boolean
isEligible
(
Date
date
)
{
if
(
m_
entity
.
getDisabled
()
!=
null
&&
m_entity
.
getDisabled
())
{
if
(
m_
run
.
getDisabled
()
!=
null
&&
m_run
.
getDisabled
())
{
return
false
;
}
Date
startDate
=
m_
entity
.
getStartDate
();
Date
startDate
=
m_
run
.
getStartDate
();
if
(
startDate
!=
null
)
{
if
(
date
.
before
(
startDate
))
{
return
false
;
}
}
Date
endDate
=
m_
entity
.
getEndDate
();
Date
endDate
=
m_
run
.
getEndDate
();
if
(
endDate
!=
null
)
{
if
(
date
.
after
(
endDate
))
{
return
false
;
...
...
@@ -66,33 +70,27 @@ public class ABTestEntity {
}
public
boolean
isDisabled
()
{
return
m_
entity
.
isDisabled
();
return
m_
run
.
isDisabled
();
}
public
void
setDisabled
(
boolean
disabled
)
{
m_
entity
.
setDisabled
(
disabled
);
m_
run
.
setDisabled
(
disabled
);
}
public
void
setGroupStrategyName
(
String
groupStrategy
)
{
if
(
m_entity
.
getGroupStrategy
()
==
null
)
{
m_entity
.
setGroupStrategy
(
new
GroupStrategy
());
}
m_entity
.
getGroupStrategy
().
setName
(
groupStrategy
);
m_case
.
setGroupStrategy
(
groupStrategy
);
}
public
void
setGroupStrategyConfiguration
(
String
groupStrategyConfiguration
)
{
if
(
m_entity
.
getGroupStrategy
()
==
null
)
{
m_entity
.
setGroupStrategy
(
new
GroupStrategy
());
}
m_entity
.
getGroupStrategy
().
setConfiguration
(
groupStrategyConfiguration
);
m_run
.
setGroupStrategyConfiguration
(
groupStrategyConfiguration
);
}
public
void
setId
(
int
id
)
{
m_
entity
.
setId
(
id
);
m_
case
.
setId
(
id
);
}
public
void
setName
(
String
name
)
{
m_
entity
.
setName
(
name
);
m_
case
.
setName
(
name
);
}
public
ABTestGroupStrategy
getGroupStrategy
()
{
...
...
cat-core/src/main/java/com/dianping/cat/abtest/spi/internal/DefaultABTestEntityManager.java
浏览文件 @
76ac0de2
...
...
@@ -12,8 +12,9 @@ import org.unidal.lookup.ContainerHolder;
import
com.dianping.cat.Cat
;
import
com.dianping.cat.abtest.ABTestId
;
import
com.dianping.cat.abtest.model.entity.Abtest
;
import
com.dianping.cat.abtest.model.entity.Entity
;
import
com.dianping.cat.abtest.model.entity.AbtestModel
;
import
com.dianping.cat.abtest.model.entity.Case
;
import
com.dianping.cat.abtest.model.entity.Run
;
import
com.dianping.cat.abtest.model.transform.BaseVisitor
;
import
com.dianping.cat.abtest.model.transform.DefaultSaxParser
;
import
com.dianping.cat.abtest.spi.ABTestEntity
;
...
...
@@ -48,7 +49,7 @@ public class DefaultABTestEntityManager extends ContainerHolder implements ABTes
public
void
initialize
()
throws
InitializationException
{
try
{
InputStream
in
=
getClass
().
getResourceAsStream
(
"abtest.xml"
);
Abtest
abtest
=
DefaultSaxParser
.
parse
(
in
);
Abtest
Model
abtest
=
DefaultSaxParser
.
parse
(
in
);
ABTestVisitor
visitor
=
new
ABTestVisitor
(
m_entities
,
m_entityList
);
abtest
.
accept
(
visitor
);
...
...
@@ -60,8 +61,7 @@ public class DefaultABTestEntityManager extends ContainerHolder implements ABTes
entity
.
setGroupStrategy
(
groupStrategy
);
}
catch
(
Exception
e
)
{
Cat
.
logError
(
e
);
//TODO un-comment the following line later!
//entity.setDisabled(true);
entity
.
setDisabled
(
true
);
}
}
}
catch
(
Exception
e
)
{
...
...
@@ -80,11 +80,13 @@ public class DefaultABTestEntityManager extends ContainerHolder implements ABTes
}
@Override
public
void
visitEntity
(
Entity
entity
)
{
ABTestEntity
abTestEntity
=
new
ABTestEntity
(
entity
);
public
void
visitCase
(
Case
_case
)
{
for
(
Run
run
:
_case
.
getRuns
())
{
ABTestEntity
abTestEntity
=
new
ABTestEntity
(
_case
,
run
);
m_entities
.
put
(
abTestEntity
.
getId
(),
abTestEntity
);
m_entityList
.
add
(
abTestEntity
);
m_entities
.
put
(
abTestEntity
.
getId
(),
abTestEntity
);
m_entityList
.
add
(
abTestEntity
);
}
}
}
...
...
cat-core/src/main/resources/META-INF/dal/model/abtest-codegen.xml
浏览文件 @
76ac0de2
<?xml version="1.0" encoding="UTF-8"?>
<model>
<entity
name=
"abtest"
root=
"true"
>
<entity-ref
name=
"
entity"
type=
"list"
names=
"entiti
es"
/>
<entity
name=
"abtest
-model
"
root=
"true"
>
<entity-ref
name=
"
case"
type=
"list"
names=
"cas
es"
/>
</entity>
<entity
name=
"
entity
"
>
<entity
name=
"
case
"
>
<attribute
name=
"id"
value-type=
"int"
/>
<attribute
name=
"name"
value-type=
"String"
/>
<attribute
name=
"created-date"
value-type=
"Date"
format=
"yyyy-MM-dd HH:mm:ss"
/>
<attribute
name=
"last-modified-date"
value-type=
"Date"
format=
"yyyy-MM-dd HH:mm:ss"
/>
<element
name=
"description"
value-type=
"String"
/>
<element
name=
"owner"
value-type=
"String"
/>
<element
name=
"group-strategy"
value-type=
"String"
/>
<element
name=
"domain"
value-type=
"String"
type=
"list"
names=
"domains"
/>
<entity-ref
name=
"run"
type=
"list"
names=
"runs"
xml-indent=
"true"
/>
</entity>
<entity
name=
"run"
>
<attribute
name=
"id"
value-type=
"int"
/>
<attribute
name=
"start-date"
value-type=
"Date"
format=
"yyyy-MM-dd HH:mm:ss"
/>
<attribute
name=
"end-date"
value-type=
"Date"
format=
"yyyy-MM-dd HH:mm:ss"
/>
<attribute
name=
"disabled"
value-type=
"boolean"
/>
<element
name=
"
description
"
value-type=
"String"
/>
<element
name=
"
creator
"
value-type=
"String"
/>
<element
name=
"domain"
value-type=
"String"
type=
"list"
names=
"domains"
/>
<entity-ref
name=
"group-strategy"
/>
</entity>
<entity
name=
"group-strategy"
>
<attribute
name=
"name"
value-type=
"String"
/>
<element
name=
"configuration"
value-type=
"String"
/>
<element
name=
"group-strategy-configuration"
value-type=
"String"
/>
</entity>
</model>
cat-core/src/main/resources/META-INF/dal/model/abtest-model.xml
浏览文件 @
76ac0de2
<?xml version="1.0" encoding="UTF-8"?>
<model
model-package=
"com.dianping.cat.abtest.model"
enable-sax-parser=
"true"
enable-base-visitor=
"true"
>
<entity
name=
"abtest"
root=
"true"
>
<entity-ref
name=
"entity"
type=
"map"
names=
"entities"
/>
<entity
name=
"case"
>
<attribute
name=
"id"
value-type=
"int"
key=
"true"
primitive=
"true"
/>
<element
name=
"domain"
value-type=
"String"
type=
"set"
names=
"domains"
/>
</entity>
<entity
name=
"
entity
"
>
<entity
name=
"
run
"
>
<attribute
name=
"id"
value-type=
"int"
key=
"true"
primitive=
"true"
/>
<element
name=
"domain"
value-type=
"String"
type=
"set"
names=
"domains"
/>
</entity>
...
...
cat-core/src/test/java/com/dianping/cat/abtest/spi/internal/AbtestModelTest.java
浏览文件 @
76ac0de2
...
...
@@ -6,14 +6,14 @@ import java.io.InputStream;
import
org.junit.Test
;
import
org.xml.sax.SAXException
;
import
com.dianping.cat.abtest.model.entity.Abtest
;
import
com.dianping.cat.abtest.model.entity.Abtest
Model
;
import
com.dianping.cat.abtest.model.transform.DefaultSaxParser
;
public
class
AbtestModelTest
{
@Test
public
void
test
()
throws
SAXException
,
IOException
{
InputStream
in
=
getClass
().
getResourceAsStream
(
"abtest.xml"
);
Abtest
abtest
=
DefaultSaxParser
.
parse
(
in
);
Abtest
Model
abtest
=
DefaultSaxParser
.
parse
(
in
);
System
.
out
.
println
(
abtest
);
}
...
...
cat-core/src/test/resources/com/dianping/cat/abtest/spi/internal/abtest.xml
浏览文件 @
76ac0de2
<abtest>
<
entity
id=
"1001"
name=
"Mock1"
start-date=
"2013-04-10 17:00:00"
end-date=
"2013-12-30 18:00:00"
disabled=
"false
"
>
<abtest
-model
>
<
case
id=
"1001"
name=
"mock"
created-date=
"2013-04-10 17:00:00"
last-modified-date=
"2013-04-10 17:00:00
"
>
<description>
This is a mock ABTest for test
</description>
<group-strategy
name=
"roundrobin"
>
<configuration>
<![CDATA[This is the configuration]]>
</configuration>
</group-strategy>
<domain>
Cat
</domain>
<owner>
hao.zhu@dianping.com,kezhu.wu@dianping.com
</owner>
<group-strategy>
roundrobin
</group-strategy>
<domain>
TuanGouApi
</domain>
<domain>
TuanGouWeb
</domain>
</entity>
<entity
id=
"1002"
name=
"Mock2"
start-date=
"2013-04-11 17:00:00"
disabled=
"true"
>
</entity>
<entity
id=
"1003"
name=
"Mock3"
start-date=
"2013-12-30 17:00:00"
disabled=
"false"
>
</entity>
<entity
id=
"1004"
name=
"Mock4"
end-date=
"2013-04-03 18:00:00"
disabled=
"false"
>
</entity>
<entity
id=
"1005"
name=
"Mock5"
start-date=
"2013-04-11 17:00:00"
disabled=
"true"
>
</entity>
<entity
id=
"1006"
name=
"Mock6"
start-date=
"2013-12-30 17:00:00"
disabled=
"false"
>
</entity>
<entity
id=
"1007"
name=
"Mock7"
end-date=
"2013-04-03 18:00:00"
disabled=
"false"
>
</entity>
<entity
id=
"1008"
name=
"Mock8"
start-date=
"2013-04-11 17:00:00"
disabled=
"true"
>
</entity>
<entity
id=
"1009"
name=
"Mock9"
start-date=
"2013-12-30 17:00:00"
disabled=
"false"
>
</entity>
<entity
id=
"1010"
name=
"Mock10"
end-date=
"2013-04-03 18:00:00"
disabled=
"false"
>
</entity>
<entity
id=
"1011"
name=
"Mock11"
start-date=
"2013-04-11 17:00:00"
disabled=
"true"
>
</entity>
<entity
id=
"1012"
name=
"Mock12"
start-date=
"2013-12-30 17:00:00"
disabled=
"false"
>
</entity>
<entity
id=
"1013"
name=
"Mock13"
end-date=
"2013-04-03 18:00:00"
disabled=
"false"
>
</entity>
<entity
id=
"1014"
name=
"Mock14"
start-date=
"2013-12-30 17:00:00"
disabled=
"false"
>
</entity>
<entity
id=
"1015"
name=
"Mock15"
end-date=
"2013-04-03 18:00:00"
disabled=
"false"
>
</entity>
<entity
id=
"1016"
name=
"Mock16"
start-date=
"2013-04-11 17:00:00"
disabled=
"true"
>
</entity>
<entity
id=
"1017"
name=
"Mock17"
start-date=
"2013-12-30 17:00:00"
disabled=
"false"
>
</entity>
</abtest>
\ No newline at end of file
<domain>
TuanGouRemote
</domain>
<runs>
<run
id=
"1"
start-date=
"2013-04-10 17:00:00"
end-date=
"2013-12-30 18:00:00"
disabled=
"false"
>
<creator>
hao.zhu@dianping.com
</creator>
<domain>
TuanGouWeb
</domain>
<domain>
TuanGouRemote
</domain>
<group-strategy-configuration>
<![CDATA[This is the configuration]]>
</group-strategy-configuration>
</run>
<run
/>
</runs>
</case>
<case/>
</abtest-model>
\ No newline at end of file
cat-home/src/main/java/com/dianping/cat/build/CatDatabaseConfigurator.java
浏览文件 @
76ac0de2
...
...
@@ -22,9 +22,6 @@ final class CatDatabaseConfigurator extends AbstractJdbcResourceConfigurator {
defineSimpleTableProviderComponents
(
all
,
"cat"
,
com
.
dianping
.
cat
.
home
.
dal
.
abtest
.
_INDEX
.
getEntityClasses
());
defineDaoComponents
(
all
,
com
.
dianping
.
cat
.
home
.
dal
.
abtest
.
_INDEX
.
getDaoClasses
());
defineSimpleTableProviderComponents
(
all
,
"cat"
,
com
.
dainping
.
cat
.
consumer
.
dal
.
report
.
_INDEX
.
getEntityClasses
());
defineDaoComponents
(
all
,
com
.
dainping
.
cat
.
consumer
.
dal
.
report
.
_INDEX
.
getDaoClasses
());
return
all
;
}
}
cat-home/src/main/java/com/dianping/cat/build/ComponentsConfigurator.java
浏览文件 @
76ac0de2
...
...
@@ -16,7 +16,6 @@ import com.dainping.cat.consumer.dal.report.ReportDao;
import
com.dainping.cat.consumer.dal.report.TaskDao
;
import
com.dianping.cat.CatHomeModule
;
import
com.dianping.cat.configuration.ServerConfigManager
;
import
com.dianping.cat.home.dal.abtest.AbtestDao
;
import
com.dianping.cat.home.dal.report.DailygraphDao
;
import
com.dianping.cat.home.dal.report.DailyreportDao
;
import
com.dianping.cat.home.dal.report.GraphDao
;
...
...
@@ -208,7 +207,6 @@ public class ComponentsConfigurator extends AbstractResourceConfigurator {
// for alarm module
all
.
addAll
(
new
AlarmComponentConfigurator
().
defineComponents
());
// for abtest module
return
all
;
}
}
cat-home/src/main/java/com/dianping/cat/system/page/abtest/ABTestReport.java
浏览文件 @
76ac0de2
...
...
@@ -4,39 +4,48 @@ import java.util.Date;
import
java.util.Map
;
import
com.dianping.cat.home.dal.abtest.Abtest
;
import
com.dianping.cat.home.dal.abtest.AbtestRun
;
public
class
ABTestReport
{
private
Abtest
m_entity
;
private
AbtestRun
m_run
;
private
AbtestStatus
m_status
;
private
Map
<
String
,
String
>
m_items
;
public
ABTestReport
(
Abtest
entity
)
{
public
ABTestReport
(
Abtest
entity
,
AbtestRun
run
)
{
m_entity
=
entity
;
m_run
=
run
;
}
public
ABTestReport
(
Abtest
entity
,
Date
now
)
{
public
ABTestReport
(
Abtest
entity
,
AbtestRun
run
,
Date
now
)
{
m_entity
=
entity
;
m_run
=
run
;
setStatus
(
now
);
// TODO m_items setting
}
private
void
setStatus
(
Date
now
)
{
m_status
=
AbtestStatus
.
calculateStatus
(
m_
entity
,
now
);
m_status
=
AbtestStatus
.
calculateStatus
(
m_
run
,
now
);
}
public
Abtest
getEntity
()
{
return
m_entity
;
}
public
AbtestRun
getRun
()
{
return
m_run
;
}
public
void
setStatus
(
AbtestStatus
status
)
{
m_status
=
status
;
}
public
AbtestStatus
getStatus
()
{
return
m_status
;
return
m_status
;
}
public
Map
<
String
,
String
>
getItems
()
{
...
...
cat-home/src/main/java/com/dianping/cat/system/page/abtest/AbtestStatus.java
浏览文件 @
76ac0de2
...
...
@@ -3,7 +3,7 @@ package com.dianping.cat.system.page.abtest;
import
java.util.Calendar
;
import
java.util.Date
;
import
com.dianping.cat.home.dal.abtest.Abtest
;
import
com.dianping.cat.home.dal.abtest.Abtest
Run
;
public
enum
AbtestStatus
{
...
...
@@ -23,12 +23,12 @@ public enum AbtestStatus {
return
defaultStatus
;
}
public
static
AbtestStatus
calculateStatus
(
Abtest
abtest
,
Date
now
)
{
if
(
abtest
.
isDisabled
())
{
public
static
AbtestStatus
calculateStatus
(
Abtest
Run
run
,
Date
now
)
{
if
(
run
.
isDisabled
())
{
return
AbtestStatus
.
SUSPENDED
;
}
else
{
Date
startDate
=
abtest
.
getStartDate
();
Date
endDate
=
abtest
.
getEndDate
();
Date
startDate
=
run
.
getStartDate
();
Date
endDate
=
run
.
getEndDate
();
if
(
startDate
!=
null
)
{
calendar
.
setTime
(
startDate
);
...
...
cat-home/src/main/java/com/dianping/cat/system/page/abtest/Handler.java
浏览文件 @
76ac0de2
...
...
@@ -27,10 +27,14 @@ import com.dianping.cat.Cat;
import
com.dianping.cat.home.dal.abtest.Abtest
;
import
com.dianping.cat.home.dal.abtest.AbtestDao
;
import
com.dianping.cat.home.dal.abtest.AbtestEntity
;
import
com.dianping.cat.home.dal.abtest.AbtestRun
;
import
com.dianping.cat.home.dal.abtest.AbtestRunDao
;
import
com.dianping.cat.home.dal.abtest.AbtestRunEntity
;
import
com.dianping.cat.home.dal.abtest.GroupStrategy
;
import
com.dianping.cat.home.dal.abtest.GroupStrategyDao
;
import
com.dianping.cat.home.dal.abtest.GroupStrategyEntity
;
import
com.dianping.cat.system.SystemPage
;
import
com.dianping.cat.system.page.abtest.Model.AbtestDaoModel
;
public
class
Handler
implements
PageHandler
<
Context
>,
LogEnabled
{
...
...
@@ -46,6 +50,9 @@ public class Handler implements PageHandler<Context>, LogEnabled {
@Inject
private
AbtestDao
m_abtestDao
;
@Inject
private
AbtestRunDao
m_abtestRunDao
;
@Inject
private
ProjectDao
m_projectDao
;
...
...
@@ -65,74 +72,95 @@ public class Handler implements PageHandler<Context>, LogEnabled {
if
(
ctx
.
getHttpServletRequest
().
getMethod
().
equalsIgnoreCase
(
"post"
))
{
if
(
action
==
Action
.
CREATE
)
{
Abtest
abtest
=
new
Abtest
();
abtest
.
setName
(
payload
.
getName
());
abtest
.
setDescription
(
payload
.
getDescription
());
abtest
.
setStartDate
(
payload
.
getStartDate
());
abtest
.
setEndDate
(
payload
.
getEndDate
());
abtest
.
setDomains
(
StringUtils
.
join
(
payload
.
getDomains
(),
','
));
abtest
.
setStrategyId
(
payload
.
getStrategyId
());
abtest
.
setStrategyConfig
(
payload
.
getStrategyConfig
().
getBytes
(
CHARSET
));
try
{
m_abtestDao
.
insert
(
abtest
);
}
catch
(
DalException
e
)
{
m_logger
.
error
(
"Error when saving abtest"
,
e
);
ctx
.
setException
(
e
);
}
handleCreateAction
(
ctx
,
payload
);
}
else
if
(
action
==
Action
.
DETAIL
)
{
Abtest
abtest
=
new
Abtest
();
abtest
.
setKeyId
(
payload
.
getId
());
abtest
.
setName
(
payload
.
getName
());
abtest
.
setDescription
(
payload
.
getDescription
());
abtest
.
setStartDate
(
payload
.
getStartDate
());
abtest
.
setEndDate
(
payload
.
getEndDate
());
abtest
.
setDomains
(
StringUtils
.
join
(
payload
.
getDomains
(),
','
));
abtest
.
setStrategyId
(
payload
.
getStrategyId
());
abtest
.
setStrategyConfig
(
payload
.
getStrategyConfig
().
getBytes
(
CHARSET
));
try
{
m_abtestDao
.
updateByPK
(
abtest
,
AbtestEntity
.
UPDATESET_FULL
);
}
catch
(
DalException
e
)
{
m_logger
.
error
(
"Error when saving abtest"
,
e
);
ctx
.
setException
(
e
);
}
handleUpdateAction
(
ctx
,
payload
);
}
}
if
(
action
==
Action
.
VIEW
)
{
handleStatusChangeActions
(
ctx
);
handleStatusChangeAction
(
ctx
);
}
}
private
void
handleCreateAction
(
Context
ctx
,
Payload
payload
)
{
Abtest
abtest
=
new
Abtest
();
abtest
.
setName
(
payload
.
getName
());
abtest
.
setOwner
(
payload
.
getOwner
());
abtest
.
setDescription
(
payload
.
getDescription
());
abtest
.
setGroupStrategy
(
payload
.
getStrategyId
());
abtest
.
setDomains
(
StringUtils
.
join
(
payload
.
getDomains
(),
','
));
AbtestRun
run
=
new
AbtestRun
();
run
.
setStartDate
(
payload
.
getStartDate
());
run
.
setEndDate
(
payload
.
getEndDate
());
run
.
setDomains
(
StringUtils
.
join
(
payload
.
getDomains
(),
','
));
run
.
setStrategyConfiguration
(
payload
.
getStrategyConfig
());
run
.
setDisabled
(
false
);
try
{
m_abtestDao
.
insert
(
abtest
);
run
.
setCaseId
(
abtest
.
getId
());
m_abtestRunDao
.
insert
(
run
);
}
catch
(
DalException
e
)
{
m_logger
.
error
(
"Error when saving abtest"
,
e
);
Cat
.
logError
(
e
);
ctx
.
setException
(
e
);
}
}
private
void
handleStatusChangeActions
(
Context
ctx
)
{
private
void
handleUpdateAction
(
Context
ctx
,
Payload
payload
)
{
try
{
AbtestRun
run
=
new
AbtestRun
();
run
.
setId
(
payload
.
getId
());
run
.
setKeyId
(
payload
.
getId
());
run
.
setStartDate
(
payload
.
getStartDate
());
run
.
setEndDate
(
payload
.
getEndDate
());
run
.
setDomains
(
StringUtils
.
join
(
payload
.
getDomains
(),
','
));
run
.
setStrategyConfiguration
(
payload
.
getStrategyConfig
());
// only update run info, do not update abtest meta-info
m_abtestRunDao
.
updateByPK
(
run
,
AbtestRunEntity
.
UPDATESET_ALLOWED_MODIFYPART
);
}
catch
(
DalException
e
)
{
m_logger
.
error
(
"Error when updating abtest"
,
e
);
Cat
.
logError
(
e
);
ctx
.
setException
(
e
);
}
}
private
void
handleStatusChangeAction
(
Context
ctx
)
{
Payload
payload
=
ctx
.
getPayload
();
ErrorObject
error
=
new
ErrorObject
(
"disable"
);
String
[]
ids
=
payload
.
getIds
();
if
(
ids
!=
null
&&
ids
.
length
!=
0
)
{
for
(
String
id
:
ids
)
{
System
.
out
.
println
(
"change status for "
+
id
);
try
{
int
int
ID
=
Integer
.
parseInt
(
id
);
Abtest
abtest
=
m_abtestDao
.
findByPK
(
intID
,
Abtest
Entity
.
READSET_FULL
);
int
run
ID
=
Integer
.
parseInt
(
id
);
Abtest
Run
run
=
m_abtestRunDao
.
findByPK
(
runID
,
AbtestRun
Entity
.
READSET_FULL
);
if
(
payload
.
getDisableAbtest
()
==
-
1
)
{
// suspend
if
(!
abtest
.
isDisabled
())
{
abtest
.
setDisabled
(
true
);
m_abtest
Dao
.
updateByPK
(
abtest
,
AbtestEntity
.
UPDATESET_DISABLE
);
if
(!
run
.
isDisabled
())
{
run
.
setDisabled
(
true
);
m_abtest
RunDao
.
updateByPK
(
run
,
AbtestRunEntity
.
UPDATESET_STATUS
);
}
else
{
error
.
addArgument
(
id
,
"Abtest "
+
id
+
" has been already suspended!"
);
}
}
else
if
(
payload
.
getDisableAbtest
()
==
1
)
{
// resume
if
(
abtest
.
isDisabled
())
{
abtest
.
setDisabled
(
false
);
m_abtest
Dao
.
updateByPK
(
abtest
,
AbtestEntity
.
UPDATESET_DISABLE
);
if
(
run
.
isDisabled
())
{
run
.
setDisabled
(
false
);
m_abtest
RunDao
.
updateByPK
(
run
,
AbtestRunEntity
.
UPDATESET_STATUS
);
}
else
{
error
.
addArgument
(
id
,
"Abtest "
+
id
+
" has been already active!"
);
}
}
}
catch
(
NumberFormatException
e
)
{
// do nothing
Cat
.
logError
(
e
);
}
catch
(
DalException
e
)
{
Cat
.
logError
(
e
);
}
}
...
...
@@ -143,7 +171,6 @@ public class Handler implements PageHandler<Context>, LogEnabled {
ctx
.
addError
(
error
);
}
}
}
@Override
...
...
@@ -153,28 +180,19 @@ public class Handler implements PageHandler<Context>, LogEnabled {
Payload
payload
=
ctx
.
getPayload
();
Action
action
=
payload
.
getAction
();
if
(
action
==
Action
.
VIEW
)
{
renderListView
(
model
,
payload
);
}
else
if
(
action
==
Action
.
CREATE
)
{
Map
<
String
,
List
<
Project
>>
projectMap
=
getAllProjects
();
List
<
GroupStrategy
>
groupStrategyList
=
getAllGroupStrategys
();
model
.
setProjectMap
(
projectMap
);
model
.
setGroupStrategyList
(
groupStrategyList
);
}
else
if
(
action
==
Action
.
DETAIL
)
{
Map
<
String
,
List
<
Project
>>
projectMap
=
getAllProjects
();
List
<
GroupStrategy
>
groupStrategyList
=
getAllGroupStrategys
();
model
.
setProjectMap
(
projectMap
);
model
.
setGroupStrategyList
(
groupStrategyList
);
int
abtestId
=
payload
.
getId
();
try
{
Abtest
abtest
=
m_abtestDao
.
findByPK
(
abtestId
,
AbtestEntity
.
READSET_FULL
);
model
.
setAbtest
(
abtest
);
}
catch
(
DalException
e
)
{
m_logger
.
error
(
"Error when fetching abtest"
,
e
);
ctx
.
setException
(
e
);
}
}
else
if
(
action
==
Action
.
REPORT
)
{
switch
(
action
)
{
case
VIEW:
renderListModel
(
model
,
payload
);
break
;
case
CREATE:
renderCreateModel
(
model
);
break
;
case
DETAIL:
renderDetailModel
(
ctx
,
model
,
payload
);
break
;
case
REPORT:
renderReportModel
(
ctx
,
model
,
payload
);
break
;
}
model
.
setAction
(
action
);
...
...
@@ -182,43 +200,79 @@ public class Handler implements PageHandler<Context>, LogEnabled {
m_jspViewer
.
view
(
ctx
,
model
);
}
private
void
renderListView
(
Model
model
,
Payload
payload
)
{
private
void
renderCreateModel
(
Model
model
)
{
Map
<
String
,
List
<
Project
>>
projectMap
=
getAllProjects
();
List
<
GroupStrategy
>
groupStrategyList
=
getAllGroupStrategys
();
model
.
setProjectMap
(
projectMap
);
model
.
setGroupStrategyList
(
groupStrategyList
);
}
private
void
renderDetailModel
(
Context
ctx
,
Model
model
,
Payload
payload
)
{
renderCreateModel
(
model
);
renderReportModel
(
ctx
,
model
,
payload
);
}
private
void
renderReportModel
(
Context
ctx
,
Model
model
,
Payload
payload
)
{
try
{
int
runId
=
payload
.
getId
();
AbtestRun
run
=
m_abtestRunDao
.
findByPK
(
runId
,
AbtestRunEntity
.
READSET_FULL
);
Abtest
abtest
=
m_abtestDao
.
findByPK
(
run
.
getCaseId
(),
AbtestEntity
.
READSET_FULL
);
AbtestDaoModel
abtestModel
=
new
AbtestDaoModel
(
abtest
,
run
);
model
.
setAbtest
(
abtestModel
);
}
catch
(
DalException
e
)
{
Cat
.
logError
(
e
);
m_logger
.
error
(
"Error when fetching abtest"
,
e
);
ctx
.
setException
(
e
);
}
}
private
void
renderListModel
(
Model
model
,
Payload
payload
)
{
List
<
ABTestReport
>
reports
=
new
ArrayList
<
ABTestReport
>();
List
<
Abtest
>
entities
=
new
ArrayList
<
Abtest
>();
AbtestStatus
status
=
AbtestStatus
.
getByName
(
payload
.
getStatus
(),
null
);
Date
now
=
new
Date
();
List
<
ABTestReport
>
filterReports
=
new
ArrayList
<
ABTestReport
>();
List
<
ABTestReport
>
totalReports
=
new
ArrayList
<
ABTestReport
>();
int
createdCount
=
0
,
readyCount
=
0
,
runningCount
=
0
,
terminatedCount
=
0
,
suspendedCount
=
0
;
List
<
AbtestRun
>
runs
=
new
ArrayList
<
AbtestRun
>();
try
{
entities
=
m_abtestDao
.
findAllAbtest
(
Abtest
Entity
.
READSET_FULL
);
runs
=
m_abtestRunDao
.
findAll
(
AbtestRun
Entity
.
READSET_FULL
);
}
catch
(
DalException
e
)
{
Cat
.
logError
(
e
);
}
List
<
Abtest
>
filterTests
=
new
ArrayList
<
Abtest
>();
int
createdCount
=
0
,
readyCount
=
0
,
runningCount
=
0
,
terminatedCount
=
0
,
suspendedCount
=
0
;
for
(
AbtestRun
run
:
runs
)
{
try
{
Abtest
abtest
=
m_abtestDao
.
findByPK
(
run
.
getCaseId
(),
AbtestEntity
.
READSET_FULL
);
ABTestReport
report
=
new
ABTestReport
(
abtest
,
run
,
now
);
for
(
Abtest
abtest
:
entities
)
{
ABTestReport
report
=
new
ABTestReport
(
abtest
,
now
);
totalReports
.
add
(
report
);
if
(
status
!=
null
&&
report
.
getStatus
()
==
status
)
{
filterReports
.
add
(
report
);
}
if
(
status
!=
null
&&
report
.
getStatus
()
==
status
)
{
filterTests
.
add
(
abtest
);
}
switch
(
report
.
getStatus
())
{
case
CREATED
:
created
Count
++;
break
;
case
READY
:
ready
Count
++;
break
;
case
RUNNING
:
running
Count
++;
break
;
case
TERMINAT
ED:
terminat
edCount
++;
break
;
case
SUSPENDED:
suspendedCount
++;
break
;
switch
(
report
.
getStatus
()
)
{
case
CREATED:
createdCount
++;
break
;
case
READY
:
ready
Count
++;
break
;
case
RUNNING
:
running
Count
++;
break
;
case
TERMINATED
:
terminated
Count
++;
break
;
case
SUSPEND
ED:
suspend
edCount
++;
break
;
}
}
catch
(
DalException
e
)
{
Cat
.
logError
(
e
)
;
}
}
...
...
@@ -227,11 +281,13 @@ public class Handler implements PageHandler<Context>, LogEnabled {
model
.
setRunningCount
(
runningCount
);
model
.
setTerminatedCount
(
terminatedCount
);
model
.
setSuspendedCount
(
suspendedCount
);
if
(
status
!=
null
)
{
entities
=
filterTests
;
totalReports
=
null
;
totalReports
=
filterReports
;
}
int
totalSize
=
entitie
s
.
size
();
int
totalSize
=
totalReport
s
.
size
();
int
totalPages
=
totalSize
%
m_pageSize
==
0
?
(
totalSize
/
m_pageSize
)
:
(
totalSize
/
m_pageSize
+
1
);
// safe guarder for pageNum
...
...
@@ -248,7 +304,7 @@ public class Handler implements PageHandler<Context>, LogEnabled {
int
fromIndex
=
(
payload
.
getPageNum
()
-
1
)
*
m_pageSize
;
int
toIndex
=
(
fromIndex
+
m_pageSize
)
<=
totalSize
?
(
fromIndex
+
m_pageSize
)
:
totalSize
;
for
(
int
i
=
fromIndex
;
i
<
toIndex
;
i
++)
{
reports
.
add
(
new
ABTestReport
(
entities
.
get
(
i
),
now
));
reports
.
add
(
totalReports
.
get
(
i
));
}
model
.
setTotalPages
(
totalPages
);
...
...
@@ -258,7 +314,7 @@ public class Handler implements PageHandler<Context>, LogEnabled {
private
List
<
GroupStrategy
>
getAllGroupStrategys
()
{
try
{
return
m_groupStrategyDao
.
findAll
GroupStrategy
(
GroupStrategyEntity
.
READSET_FULL
);
return
m_groupStrategyDao
.
findAll
ByStatus
(
1
,
GroupStrategyEntity
.
READSET_FULL
);
}
catch
(
DalException
e
)
{
m_logger
.
error
(
e
.
getMessage
(),
e
);
Cat
.
logError
(
e
);
...
...
cat-home/src/main/java/com/dianping/cat/system/page/abtest/Model.java
浏览文件 @
76ac0de2
...
...
@@ -9,6 +9,7 @@ import org.unidal.web.mvc.ViewModel;
import
com.dainping.cat.consumer.dal.report.Project
;
import
com.dianping.cat.abtest.spi.ABTestEntity
;
import
com.dianping.cat.home.dal.abtest.Abtest
;
import
com.dianping.cat.home.dal.abtest.AbtestRun
;
import
com.dianping.cat.home.dal.abtest.GroupStrategy
;
import
com.dianping.cat.system.SystemPage
;
...
...
@@ -37,7 +38,7 @@ public class Model extends ViewModel<SystemPage, Action, Context> {
private
List
<
GroupStrategy
>
m_groupStrategyList
;
private
Abtest
m_abtest
;
private
Abtest
DaoModel
m_abtest
;
public
Model
(
Context
ctx
)
{
super
(
ctx
);
...
...
@@ -144,12 +145,82 @@ public class Model extends ViewModel<SystemPage, Action, Context> {
m_groupStrategyList
=
groupStrategyList
;
}
public
Abtest
getAbtest
()
{
public
Abtest
DaoModel
getAbtest
()
{
return
m_abtest
;
}
public
void
setAbtest
(
Abtest
abtest
)
{
public
void
setAbtest
(
Abtest
DaoModel
abtest
)
{
m_abtest
=
abtest
;
}
public
static
class
AbtestDaoModel
{
private
Abtest
m_abtest
;
private
AbtestRun
m_run
;
public
AbtestDaoModel
(
Abtest
abtest
,
AbtestRun
abtestRun
)
{
super
();
m_abtest
=
abtest
;
m_run
=
abtestRun
;
}
public
Abtest
getAbtest
()
{
return
m_abtest
;
}
public
void
setAbtest
(
Abtest
abtest
)
{
m_abtest
=
abtest
;
}
public
AbtestRun
getRun
()
{
return
m_run
;
}
public
void
setRun
(
AbtestRun
run
)
{
m_run
=
run
;
}
public
String
getDescription
()
{
return
m_abtest
.
getDescription
();
}
public
int
getGroupStrategy
()
{
return
m_abtest
.
getGroupStrategy
();
}
public
String
getName
()
{
return
m_abtest
.
getName
();
}
public
String
getOwner
()
{
return
m_abtest
.
getOwner
();
}
public
int
getCaseId
()
{
return
m_run
.
getCaseId
();
}
public
String
getDomains
()
{
return
m_run
.
getDomains
();
}
public
Date
getEndDate
()
{
return
m_run
.
getEndDate
();
}
public
int
getId
()
{
return
m_run
.
getId
();
}
public
Date
getStartDate
()
{
return
m_run
.
getStartDate
();
}
public
String
getStrategyConfiguration
()
{
return
m_run
.
getStrategyConfiguration
();
}
}
}
cat-home/src/main/java/com/dianping/cat/system/page/abtest/Payload.java
浏览文件 @
76ac0de2
...
...
@@ -28,6 +28,9 @@ public class Payload implements ActionPayload<SystemPage, Action> {
@FieldMeta
(
"name"
)
private
String
m_name
;
@FieldMeta
(
"owner"
)
private
String
m_owner
;
@FieldMeta
(
"description"
)
private
String
m_description
;
...
...
@@ -122,6 +125,14 @@ public class Payload implements ActionPayload<SystemPage, Action> {
public
void
setName
(
String
name
)
{
this
.
m_name
=
name
;
}
public
String
getOwner
()
{
return
m_owner
;
}
public
void
setOwner
(
String
owner
)
{
m_owner
=
owner
;
}
public
String
getDescription
()
{
return
m_description
;
...
...
cat-home/src/main/resources/META-INF/dal/jdbc/abtest-codegen.xml
浏览文件 @
76ac0de2
...
...
@@ -3,15 +3,55 @@
<entity
name=
"abtest"
table=
"abtest"
alias=
"a"
>
<member
name=
"id"
field=
"id"
value-type=
"int"
length=
"10"
nullable=
"false"
key=
"true"
auto-increment=
"true"
/>
<member
name=
"name"
field=
"name"
value-type=
"String"
length=
"45"
nullable=
"false"
/>
<member
name=
"owner"
field=
"owner"
value-type=
"String"
length=
"45"
nullable=
"false"
/>
<member
name=
"group-strategy"
field=
"group_strategy"
value-type=
"int"
length=
"10"
/>
<member
name=
"domains"
field=
"domains"
value-type=
"String"
length=
"200"
/>
<member
name=
"creation-date"
field=
"creation_date"
value-type=
"Date"
/>
<member
name=
"modified-date"
field=
"modified_date"
value-type=
"Date"
/>
<member
name=
"description"
field=
"description"
value-type=
"String"
length=
"512"
/>
<var
name=
"key-id"
value-type=
"int"
key-member=
"id"
/>
<primary-key
name=
"PRIMARY"
members=
"id"
/>
<readsets>
<readset
name=
"FULL"
all=
"true"
/>
</readsets>
<updatesets>
<updateset
name=
"FULL"
all=
"true"
/>
</updatesets>
<query-defs>
<query
name=
"find-by-PK"
type=
"SELECT"
>
<param
name=
"key-id"
/>
<statement>
<![CDATA[SELECT <FIELDS/>
FROM
<TABLE/>
WHERE
<FIELD
name=
'id'
/>
= ${key-id}]]>
</statement>
</query>
<query
name=
"insert"
type=
"INSERT"
>
<statement>
<![CDATA[INSERT INTO <TABLE/>
(
<FIELDS/>
)
VALUES(
<VALUES/>
)]]>
</statement>
</query>
<query
name=
"update-by-PK"
type=
"UPDATE"
>
<param
name=
"key-id"
/>
<statement>
<![CDATA[UPDATE <TABLE/>
SET
<FIELDS/>
WHERE
<FIELD
name=
'id'
/>
= ${key-id}]]>
</statement>
</query>
<query
name=
"delete-by-PK"
type=
"DELETE"
>
<param
name=
"key-id"
/>
<statement>
<![CDATA[DELETE FROM <TABLE/>
WHERE
<FIELD
name=
'id'
/>
= ${key-id}]]>
</statement>
</query>
</query-defs>
</entity>
<entity
name=
"abtest-run"
table=
"abtest_run"
alias=
"ar"
>
<member
name=
"id"
field=
"id"
value-type=
"int"
length=
"10"
nullable=
"false"
key=
"true"
auto-increment=
"true"
/>
<member
name=
"creator"
field=
"creator"
value-type=
"String"
length=
"45"
/>
<member
name=
"case-id"
field=
"case_id"
value-type=
"int"
length=
"10"
nullable=
"false"
/>
<member
name=
"start-date"
field=
"start_date"
value-type=
"Date"
/>
<member
name=
"end-date"
field=
"end_date"
value-type=
"Date"
/>
<member
name=
"disabled"
field=
"disabled"
value-type=
"int"
length=
"3"
nullable=
"false"
/>
<member
name=
"domains"
field=
"domains"
value-type=
"String"
length=
"100"
nullable=
"false"
/>
<member
name=
"strategy-id"
field=
"strategy_id"
value-type=
"int"
length=
"10"
nullable=
"false"
/>
<member
name=
"strategy-config"
field=
"strategy_config"
value-type=
"byte[]"
length=
"65535"
/>
<member
name=
"description"
field=
"description"
value-type=
"String"
length=
"100"
/>
<member
name=
"strategy-configuration"
field=
"strategy_configuration"
value-type=
"String"
length=
"1024"
/>
<member
name=
"creation-date"
field=
"creation_date"
value-type=
"Date"
nullable=
"false"
/>
<member
name=
"modif
y-date"
field=
"modify_date"
value-type=
"Dat
e"
/>
<member
name=
"modif
ied-date"
field=
"modified_date"
value-type=
"Date"
nullable=
"fals
e"
/>
<var
name=
"key-id"
value-type=
"int"
key-member=
"id"
/>
<primary-key
name=
"PRIMARY"
members=
"id"
/>
<readsets>
...
...
@@ -44,11 +84,13 @@
</query>
</query-defs>
</entity>
<entity
name=
"group-strategy"
table=
"group
Strategy"
alias=
"g
"
>
<entity
name=
"group-strategy"
table=
"group
_strategy"
alias=
"gs
"
>
<member
name=
"id"
field=
"id"
value-type=
"int"
length=
"10"
nullable=
"false"
key=
"true"
auto-increment=
"true"
/>
<member
name=
"name"
field=
"name"
value-type=
"String"
length=
"45"
nullable=
"false"
/>
<member
name=
"alias"
field=
"alias"
value-type=
"String"
length=
"45"
nullable=
"false"
/>
<member
name=
"class-name"
field=
"className"
value-type=
"String"
length=
"45"
nullable=
"false"
/>
<member
name=
"classname"
field=
"classname"
value-type=
"String"
length=
"45"
nullable=
"false"
/>
<member
name=
"configuration"
field=
"configuration"
value-type=
"String"
length=
"512"
/>
<member
name=
"status"
field=
"status"
value-type=
"int"
length=
"3"
nullable=
"false"
/>
<member
name=
"description"
field=
"description"
value-type=
"String"
length=
"45"
/>
<var
name=
"key-id"
value-type=
"int"
key-member=
"id"
/>
<primary-key
name=
"PRIMARY"
members=
"id"
/>
...
...
cat-home/src/main/resources/META-INF/dal/jdbc/abtest-dal.xml
浏览文件 @
76ac0de2
...
...
@@ -2,16 +2,44 @@
<entities
do-package=
"com.dianping.cat.home.dal.abtest"
gen=
"true"
>
<entity
name=
"abtest"
table=
"abtest"
alias=
"a"
>
<member
name=
"creation-date"
insert-expr=
"NOW()"
/>
<member
name=
"modify-date"
insert-expr=
"NOW()"
update-expr=
"NOW()"
/>
<member
name=
"modified-date"
insert-expr=
"NOW()"
update-expr=
"NOW()"
/>
<query-defs>
<query
name=
"find-all"
type=
"SELECT"
multiple=
"true"
>
<statement>
<![CDATA[
SELECT <FIELDS/>
FROM
<TABLE/>
ORDER BY
<FIELD
name=
'creation-date'
/>
DESC
]]>
</statement>
</query>
</query-defs>
</entity>
<entity
name=
"abtest-run"
table=
"abtest_run"
alias=
"ar"
>
<member
name=
"disabled"
field=
"disabled"
value-type=
"boolean"
length=
"3"
nullable=
"false"
/>
<member
name=
"creation-date"
insert-expr=
"NOW()"
/>
<member
name=
"modified-date"
insert-expr=
"NOW()"
update-expr=
"NOW()"
/>
<updatesets>
<updateset
name=
"DISABLE"
>
<member
name=
"disabled"
/>
<member
name=
"modify-date"
/>
</updateset>
</updatesets>
<updateset
name=
"STATUS"
>
<member
name=
"disabled"
field=
"disabled"
value-type=
"boolean"
length=
"3"
nullable=
"false"
/>
<member
name=
"modified-date"
insert-expr=
"NOW()"
update-expr=
"NOW()"
/>
</updateset>
<updateset
name=
"ALLOWED_MODIFYPART"
>
<member
name=
"start-date"
field=
"start_date"
value-type=
"Date"
/>
<member
name=
"end-date"
field=
"end_date"
value-type=
"Date"
/>
<member
name=
"domains"
field=
"domains"
value-type=
"String"
length=
"100"
nullable=
"false"
/>
<member
name=
"strategy-configuration"
field=
"strategy_configuration"
value-type=
"String"
length=
"1024"
/>
<member
name=
"modified-date"
insert-expr=
"NOW()"
update-expr=
"NOW()"
/>
</updateset>
</updatesets>
<query-defs>
<query
name=
"find-all-abtest"
type=
"SELECT"
multiple=
"true"
>
<query
name=
"find-by-case-id"
type=
"SELECT"
multiple=
"true"
>
<param
name=
"case-id"
/>
<statement>
<![CDATA[
SELECT <FIELDS/>
FROM
<TABLE/>
WHERE
<FIELD
name=
'case-id'
/>
= ${case-id}
]]>
</statement>
</query>
<query
name=
"find-all"
type=
"SELECT"
multiple=
"true"
>
<statement>
<![CDATA[
SELECT <FIELDS/>
FROM
<TABLE/>
ORDER BY
<FIELD
name=
'creation-date'
/>
DESC
...
...
@@ -19,15 +47,18 @@
</query>
</query-defs>
</entity>
<entity
name=
"group-strategy"
table=
"groupStrategy"
alias=
"g"
>
<query-defs>
<query
name=
"find-all-groupStrategy"
type=
"SELECT"
multiple=
"true"
>
<statement>
<![CDATA[
<entity
name=
"group-strategy"
table=
"group_strategy"
alias=
"gs"
>
<query-defs>
<query
name=
"find-all-by-status"
type=
"SELECT"
multiple=
"true"
>
<param
name=
"status"
/>
<statement>
<![CDATA[
SELECT <FIELDS/>
FROM
<TABLE/>
ORDER BY
<FIELD
name=
'id'
/>
FROM
<TABLE/>
WHERE
<FIELD
name=
'status'
/>
= ${status}
]]>
</statement>
</query>
</query-defs>
</entity>
</query>
</query-defs>
</entity>
</entities>
cat-home/src/main/resources/META-INF/plexus/components.xml
浏览文件 @
76ac0de2
...
...
@@ -1412,103 +1412,27 @@
</component>
<component>
<role>
org.unidal.dal.jdbc.mapping.TableProvider
</role>
<role-hint>
group-strategy
</role-hint>
<role-hint>
abtest-run
</role-hint>
<implementation>
org.unidal.dal.jdbc.mapping.SimpleTableProvider
</implementation>
<configuration>
<logical-table-name>
group-strategy
</logical-table-name>
<physical-table-name>
groupStrategy
</physical-table-name>
<logical-table-name>
abtest-run
</logical-table-name>
<physical-table-name>
abtest_run
</physical-table-name>
<data-source-name>
cat
</data-source-name>
</configuration>
</component>
<component>
<role>
com.dianping.cat.home.dal.abtest.AbtestDao
</role>
<implementation>
com.dianping.cat.home.dal.abtest.AbtestDao
</implementation>
<requirements>
<requirement>
<role>
org.unidal.dal.jdbc.QueryEngine
</role>
</requirement>
</requirements>
</component>
<component>
<role>
com.dianping.cat.home.dal.abtest.GroupStrategyDao
</role>
<implementation>
com.dianping.cat.home.dal.abtest.GroupStrategyDao
</implementation>
<requirements>
<requirement>
<role>
org.unidal.dal.jdbc.QueryEngine
</role>
</requirement>
</requirements>
</component>
<component>
<role>
org.unidal.dal.jdbc.mapping.TableProvider
</role>
<role-hint>
report
</role-hint>
<implementation>
org.unidal.dal.jdbc.mapping.SimpleTableProvider
</implementation>
<configuration>
<logical-table-name>
report
</logical-table-name>
<physical-table-name>
report
</physical-table-name>
<data-source-name>
cat
</data-source-name>
</configuration>
</component>
<component>
<role>
org.unidal.dal.jdbc.mapping.TableProvider
</role>
<role-hint>
hostinfo
</role-hint>
<implementation>
org.unidal.dal.jdbc.mapping.SimpleTableProvider
</implementation>
<configuration>
<logical-table-name>
hostinfo
</logical-table-name>
<physical-table-name>
hostinfo
</physical-table-name>
<data-source-name>
cat
</data-source-name>
</configuration>
</component>
<component>
<role>
org.unidal.dal.jdbc.mapping.TableProvider
</role>
<role-hint>
sqltable
</role-hint>
<implementation>
org.unidal.dal.jdbc.mapping.SimpleTableProvider
</implementation>
<configuration>
<logical-table-name>
sqltable
</logical-table-name>
<physical-table-name>
sqltable
</physical-table-name>
<data-source-name>
cat
</data-source-name>
</configuration>
</component>
<component>
<role>
org.unidal.dal.jdbc.mapping.TableProvider
</role>
<role-hint>
task
</role-hint>
<implementation>
org.unidal.dal.jdbc.mapping.SimpleTableProvider
</implementation>
<configuration>
<logical-table-name>
task
</logical-table-name>
<physical-table-name>
task
</physical-table-name>
<data-source-name>
cat
</data-source-name>
</configuration>
</component>
<component>
<role>
org.unidal.dal.jdbc.mapping.TableProvider
</role>
<role-hint>
project
</role-hint>
<role-hint>
group-strategy
</role-hint>
<implementation>
org.unidal.dal.jdbc.mapping.SimpleTableProvider
</implementation>
<configuration>
<logical-table-name>
project
</logical-table-name>
<physical-table-name>
project
</physical-table-name>
<logical-table-name>
group-strategy
</logical-table-name>
<physical-table-name>
group_strategy
</physical-table-name>
<data-source-name>
cat
</data-source-name>
</configuration>
</component>
<component>
<role>
com.dainping.cat.consumer.dal.report.ReportDao
</role>
<implementation>
com.dainping.cat.consumer.dal.report.ReportDao
</implementation>
<requirements>
<requirement>
<role>
org.unidal.dal.jdbc.QueryEngine
</role>
</requirement>
</requirements>
</component>
<component>
<role>
com.dainping.cat.consumer.dal.report.HostinfoDao
</role>
<implementation>
com.dainping.cat.consumer.dal.report.HostinfoDao
</implementation>
<requirements>
<requirement>
<role>
org.unidal.dal.jdbc.QueryEngine
</role>
</requirement>
</requirements>
</component>
<component>
<role>
com.dainping.cat.consumer.dal.report.SqltableDao
</role>
<implementation>
com.dainping.cat.consumer.dal.report.SqltableDao
</implementation>
<role>
com.dianping.cat.home.dal.abtest.AbtestDao
</role>
<implementation>
com.dianping.cat.home.dal.abtest.AbtestDao
</implementation>
<requirements>
<requirement>
<role>
org.unidal.dal.jdbc.QueryEngine
</role>
...
...
@@ -1516,8 +1440,8 @@
</requirements>
</component>
<component>
<role>
com.d
ainping.cat.consumer.dal.report.Task
Dao
</role>
<implementation>
com.d
ainping.cat.consumer.dal.report.Task
Dao
</implementation>
<role>
com.d
ianping.cat.home.dal.abtest.AbtestRun
Dao
</role>
<implementation>
com.d
ianping.cat.home.dal.abtest.AbtestRun
Dao
</implementation>
<requirements>
<requirement>
<role>
org.unidal.dal.jdbc.QueryEngine
</role>
...
...
@@ -1525,8 +1449,8 @@
</requirements>
</component>
<component>
<role>
com.d
ainping.cat.consumer.dal.report.Project
Dao
</role>
<implementation>
com.d
ainping.cat.consumer.dal.report.Project
Dao
</implementation>
<role>
com.d
ianping.cat.home.dal.abtest.GroupStrategy
Dao
</role>
<implementation>
com.d
ianping.cat.home.dal.abtest.GroupStrategy
Dao
</implementation>
<requirements>
<requirement>
<role>
org.unidal.dal.jdbc.QueryEngine
</role>
...
...
@@ -3238,6 +3162,9 @@
<requirement>
<role>
com.dianping.cat.home.dal.abtest.AbtestDao
</role>
</requirement>
<requirement>
<role>
com.dianping.cat.home.dal.abtest.AbtestRunDao
</role>
</requirement>
<requirement>
<role>
com.dainping.cat.consumer.dal.report.ProjectDao
</role>
</requirement>
...
...
@@ -3264,6 +3191,15 @@
</requirement>
</requirements>
</component>
<component>
<role>
com.dianping.cat.home.dal.abtest.AbtestRunDao
</role>
<implementation>
com.dianping.cat.home.dal.abtest.AbtestRunDao
</implementation>
<requirements>
<requirement>
<role>
org.unidal.dal.jdbc.QueryEngine
</role>
</requirement>
</requirements>
</component>
<component>
<role>
com.dianping.cat.home.dal.abtest.GroupStrategyDao
</role>
<implementation>
com.dianping.cat.home.dal.abtest.GroupStrategyDao
</implementation>
...
...
cat-home/src/main/resources/META-INF/wizard/jdbc/wizard.xml
浏览文件 @
76ac0de2
...
...
@@ -26,7 +26,8 @@
</group>
<group
name=
"abtest"
package=
"com.dianping.cat.home.dal.abtest"
>
<table
name=
"abtest"
/>
<table
name=
"groupStrategy"
/>
<table
name=
"abtest_run"
/>
<table
name=
"group_strategy"
/>
</group>
</jdbc>
<jdbc
package=
"com.dainping.cat.home.dal"
name=
"user"
>
...
...
cat-home/src/main/webapp/js/abtestAllTest.js
浏览文件 @
76ac0de2
...
...
@@ -18,13 +18,7 @@ $(document)
var
checkbox
=
$
(
"
.table input[type='checkbox']:checked
"
);
var
id
=
""
;
for
(
var
i
=
0
;
i
<
checkbox
.
length
;
i
++
)
{
id
=
id
+
$
(
"
:nth-child(2)
"
,
$
(
checkbox
[
i
])
.
closest
(
'
tr
'
))
.
html
()
+
"
-
"
;
id
=
id
+
$
(
"
:nth-child(2)
"
,
$
(
checkbox
[
i
]).
closest
(
'
tr
'
)).
html
()
+
"
-
"
;
}
url
=
window
.
location
.
href
;
index
=
url
.
indexOf
(
"
&suspend
"
);
...
...
@@ -33,7 +27,7 @@ $(document)
.
substring
(
0
,
index
)
+
"
&suspend=-1&ids=
"
+
id
;
}
else
{
if
(
url
.
indexOf
(
"
?
"
)
==
-
1
)
{
if
(
url
.
indexOf
(
"
?
"
)
==
-
1
)
{
url
=
url
+
'
?
'
;
}
window
.
location
.
href
=
url
...
...
@@ -48,13 +42,7 @@ $(document)
var
checkbox
=
$
(
"
.table input[type='checkbox']:checked
"
);
var
id
=
""
;
for
(
var
i
=
0
;
i
<
checkbox
.
length
;
i
++
)
{
id
=
id
+
$
(
"
:nth-child(2)
"
,
$
(
checkbox
[
i
])
.
closest
(
'
tr
'
))
.
html
()
+
"
-
"
;
id
=
id
+
$
(
"
:nth-child(2)
"
,
$
(
checkbox
[
i
]).
closest
(
'
tr
'
)).
html
()
+
"
-
"
;
}
url
=
window
.
location
.
href
;
index
=
url
.
indexOf
(
"
&suspend
"
);
...
...
cat-home/src/main/webapp/jsp/system/abtestAllTest.jsp
浏览文件 @
76ac0de2
...
...
@@ -170,7 +170,7 @@
<c:forEach
var=
"item"
items=
"
${
model
.
reports
}
"
>
<tr
class=
"middle center rowlink"
>
<td
class=
"nolink"
style=
"padding-bottom: 8px"
><input
type=
"checkbox"
/></td>
<td><a
href=
"abtest?op=report&id=${item.
entity.id}"
>
${item.entity
.id}
</a></td>
<td><a
href=
"abtest?op=report&id=${item.
run.id}"
>
${item.run
.id}
</a></td>
<td>
${item.entity.name}
</td>
<td>
1000
</td>
<td>
10%
</td>
...
...
cat-home/src/main/webapp/jsp/system/abtestCreate.jsp
浏览文件 @
76ac0de2
...
...
@@ -21,6 +21,7 @@ div.controls input {
<res:useJs
value=
"
${
res
.
js
.
local
[
'select2.min.js'
]
}
"
target=
"head-js"
/>
<res:useJs
value=
"
${
res
.
js
.
local
[
'abtestAllTest.js'
]
}
"
target=
"head-js"
/>
<res:useJs
value=
"
${
res
.
js
.
local
[
'bootstrap-validation.min.js'
]
}
"
target=
"head-js"
/>
<div
style=
"width: 950px; margin: 0 auto; margin-bottom: 250px;"
>
<h4
style=
"margin: 0 auto;"
>
Create ABTest
</h4>
<c:choose>
...
...
@@ -39,15 +40,11 @@ div.controls input {
seconds ...
</span>
<script>
$
(
function
()
{
countDown
();
$
(
'
#submit
'
)
.
attr
(
"
disabled
"
,
"
disabled
"
);
});
</script>
$
(
function
()
{
countDown
();
$
(
'
#submit
'
).
attr
(
"
disabled
"
,
"
disabled
"
);
});
</script>
</div>
</div>
</c:when>
...
...
@@ -68,6 +65,16 @@ div.controls input {
required-message=
"Name is required!"
value=
"${payload.name}"
>
</div>
</div>
<div
class=
"control-group"
>
<label
class=
"control-label"
>
Owner
<i
tips=
""
data-trigger=
"hover"
class=
"icon-question-sign"
data-toggle=
"popover"
data-placement=
"top"
data-original-title=
"tips"
data-content=
"Only charactor, number and underline are allowed. e.g. CatWeb_1"
></i>
</label>
<div
class=
"controls"
>
<input
type=
"text"
name=
"owner"
placeholder=
"give it a owner ..."
check-type=
"required"
required-message=
"Owner is required!"
value=
"${payload.owner}"
>
</div>
</div>
<div
class=
"control-group"
>
<label
class=
"control-label"
>
Description
</label>
<div
class=
"controls"
>
...
...
@@ -193,7 +200,7 @@ div.controls input {
$
(
"
#successMsg
"
).
html
(
$
(
"
#alert_success
"
).
html
());
}
}
var
timeout
=
5
;
var
timeout
=
1
;
function
countDown
()
{
$
(
'
#countDown
'
).
text
(
timeout
);
timeout
--
;
...
...
cat-home/src/main/webapp/jsp/system/abtestDetail.jsp
浏览文件 @
76ac0de2
...
...
@@ -83,7 +83,7 @@ div.controls input {
data-content=
"Only charactor, number and underline are allowed. e.g. CatWeb_1"
></i>
</label>
<div
class=
"controls"
>
<input
type=
"text"
name=
"name"
placeholder=
"give it a name ..."
check-type=
"required"
<input
id=
"inputName"
type=
"text"
name=
"name"
placeholder=
"give it a name ..."
check-type=
"required"
required-message=
"Name is required!"
value=
"${model.abtest.name}"
readonly=
"readonly"
>
</div>
</div>
...
...
@@ -143,7 +143,7 @@ div.controls input {
<div
class=
"controls"
>
<select
name=
"strategyId"
check-type=
"required"
required-message=
"Strategy is required!"
disabled=
"disabled"
>
<c:forEach
var=
"item"
items=
"
${
model
.
groupStrategyList
}
"
>
<option
value=
"${item.id }"
<c:if
test=
"
${
item
.
id
==
model
.
abtest
.
strategyId
}
"
>
selected=
"selected"
</c:if>>
${item.name
<option
value=
"${item.id }"
<c:if
test=
"
${
item
.
id
==
model
.
abtest
.
groupStrategy
}
"
>
selected=
"selected"
</c:if>>
${item.name
}
</option>
</c:forEach>
</select>
...
...
@@ -152,7 +152,7 @@ div.controls input {
<div
class=
"control-group"
>
<label
class=
"control-label"
>
Strategy Configuration
</label>
<div
class=
"controls"
>
<textarea
name=
"strategyConfig"
class=
"span6"
rows=
"3"
cols=
"60"
readonly=
"readonly"
>
${model.abtest.strategyConfig
}
</textarea>
<textarea
id=
"txtStrategyConfig"
name=
"strategyConfig"
class=
"span6"
rows=
"3"
cols=
"60"
readonly=
"readonly"
>
${model.abtest.strategyConfiguration
}
</textarea>
</div>
</div>
</form>
...
...
@@ -212,8 +212,10 @@ div.controls input {
function
enableEdit
()
{
//input
$
(
'
#form input,#form textarea
'
).
removeAttr
(
"
readonly
"
);
$
(
'
#form select
'
).
removeAttr
(
"
disabled
"
);
$
(
'
#form input
'
).
removeAttr
(
"
readonly
"
);
$
(
'
#txtStrategyConfig
'
).
removeAttr
(
"
readonly
"
);
$
(
'
#inputName
'
).
attr
(
"
readonly
"
,
"
readonly
"
);
//$('#form select').removeAttr("disabled");
$
(
"
#domains
"
).
select2
(
"
enable
"
);
$
(
"
#datetimepicker1>span
"
).
removeClass
(
'
hide
'
);
$
(
"
#datetimepicker2>span
"
).
removeClass
(
'
hide
'
);
...
...
@@ -227,8 +229,7 @@ div.controls input {
if
(
changed
)
{
$
(
"
#cancleAffirmModal
"
).
modal
(
'
show
'
);
}
else
{
$
(
'
#form input,#form textarea
'
).
attr
(
"
readonly
"
,
"
readonly
"
);
$
(
'
#form input
'
).
attr
(
"
readonly
"
,
"
readonly
"
);
$
(
'
#form select
'
).
attr
(
"
disabled
"
,
"
disabled
"
);
$
(
"
#domains
"
).
select2
(
"
disable
"
);
$
(
"
#datetimepicker1>span
"
).
addClass
(
'
hide
'
);
...
...
@@ -264,7 +265,7 @@ div.controls input {
$
(
"
#successMsg
"
).
html
(
$
(
"
#alert_success
"
).
html
());
}
}
var
timeout
=
5
;
var
timeout
=
1
;
function
countDown
()
{
$
(
'
#countDown
'
).
text
(
timeout
);
timeout
--
;
...
...
cat-home/src/main/webapp/jsp/system/abtestReport.jsp
浏览文件 @
76ac0de2
...
...
@@ -24,9 +24,7 @@
<div
id=
"content"
lass=
"row-fluid"
>
<div
class=
"span12 column"
>
<h3>
Report
<small>
${model.abtest.name} #${model.abtest.id}
</small>
</h3>
<h3>
Report
<small>
${model.abtest.name} #${model.abtest.id}
</small></h3>
<ul
class=
"nav nav-tabs"
>
<li
class=
"active"
>
<a
href=
"?op=report&id=${payload.id }"
>
...
...
script/Cat.sql
浏览文件 @
76ac0de2
...
...
@@ -245,29 +245,44 @@ CREATE TABLE `project` (
PRIMARY
KEY
(
`id`
)
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8
COMMENT
=
'项目基本信息'
;
CREATE
TABLE
`groupStrategy`
(
`id`
int
(
11
)
NOT
NULL
AUTO_INCREMENT
,
`name`
varchar
(
45
)
NOT
NULL
COMMENT
'GroupStrategy的名字'
,
`alias`
varchar
(
45
)
NOT
NULL
COMMENT
'GroupStrategy的英文名'
,
`className`
varchar
(
45
)
NOT
NULL
COMMENT
'GroupStrategy的class名字'
,
`description`
varchar
(
45
)
DEFAULT
NULL
,
PRIMARY
KEY
(
`id`
)
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8
$$
CREATE
TABLE
`abtest`
(
`id`
int
(
11
)
NOT
NULL
AUTO_INCREMENT
COMMENT
'ID'
,
`name`
varchar
(
45
)
NOT
NULL
COMMENT
'abtest的名字'
,
`start_date`
datetime
DEFAULT
NULL
COMMENT
'开始时间'
,
`end_date`
datetime
DEFAULT
NULL
COMMENT
'结束时间'
,
`disabled`
tinyint
(
4
)
NOT
NULL
COMMENT
'是否有效'
,
`domains`
varchar
(
100
)
NOT
NULL
COMMENT
'属于的domain,用分号分割'
,
`strategy_id`
int
(
11
)
NOT
NULL
COMMENT
'分组策略ID'
,
`strategy_config`
blob
COMMENT
'策略配置'
,
`description`
varchar
(
100
)
DEFAULT
NULL
COMMENT
'实验描述'
,
`creation_date`
datetime
NOT
NULL
COMMENT
'创建时间'
,
`modify_date`
datetime
DEFAULT
NULL
COMMENT
'修改时间'
,
PRIMARY
KEY
(
`id`
)
)
ENGINE
=
InnoDB
AUTO_INCREMENT
=
24
DEFAULT
CHARSET
=
utf8
$$
CREATE
TABLE
`abtest`
(
`id`
int
(
11
)
NOT
NULL
COMMENT
'ID'
,
`name`
varchar
(
45
)
NOT
NULL
COMMENT
'名字'
,
`owner`
varchar
(
45
)
NOT
NULL
COMMENT
'case的Owner'
,
`group_strategy`
int
(
11
)
DEFAULT
NULL
COMMENT
'分组策略ID'
,
`domains`
varchar
(
200
)
DEFAULT
NULL
COMMENT
'Domains,分号分割'
,
`creation_date`
datetime
DEFAULT
NULL
COMMENT
'创建时间'
,
`modified_date`
datetime
DEFAULT
NULL
COMMENT
'上次修改时间'
,
`description`
varchar
(
512
)
DEFAULT
NULL
COMMENT
'描述'
,
PRIMARY
KEY
(
`id`
)
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8
CREATE
TABLE
`abtest_run`
(
`id`
int
(
11
)
NOT
NULL
AUTO_INCREMENT
COMMENT
'ID'
,
`creator`
varchar
(
45
)
DEFAULT
NULL
,
`case_id`
int
(
11
)
NOT
NULL
,
`start_date`
datetime
DEFAULT
NULL
COMMENT
'开始时间'
,
`end_date`
datetime
DEFAULT
NULL
COMMENT
'结束时间'
,
`disabled`
tinyint
(
4
)
NOT
NULL
COMMENT
'是否有效'
,
`domains`
varchar
(
100
)
NOT
NULL
COMMENT
'属于的domain,用分号分割'
,
`strategy_configuration`
varchar
(
1024
)
DEFAULT
NULL
COMMENT
'策略配置'
,
`creation_date`
datetime
NOT
NULL
COMMENT
'创建时间'
,
`modified_date`
datetime
NOT
NULL
COMMENT
'上次修改时间'
,
PRIMARY
KEY
(
`id`
)
)
ENGINE
=
InnoDB
AUTO_INCREMENT
=
24
DEFAULT
CHARSET
=
utf8
CREATE
TABLE
`group_strategy`
(
`id`
int
(
11
)
NOT
NULL
AUTO_INCREMENT
,
`name`
varchar
(
45
)
NOT
NULL
COMMENT
'GroupStrategy的名字'
,
`alias`
varchar
(
45
)
NOT
NULL
COMMENT
'GroupStrategy的英文名'
,
`classname`
varchar
(
45
)
NOT
NULL
COMMENT
'GroupStrategy的class名字'
,
`configuration`
varchar
(
512
)
DEFAULT
NULL
COMMENT
'配置的schema'
,
`status`
tinyint
(
4
)
NOT
NULL
COMMENT
'是否开/关'
,
`description`
varchar
(
45
)
DEFAULT
NULL
COMMENT
'描述'
,
PRIMARY
KEY
(
`id`
)
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录