重构测试并且删除多余代码

git-svn-id: http://code.alibabatech.com/svn/druid/trunk@965 b9813039-fb51-4c41-a8b9-e21c2acb5095
This commit is contained in:
wenshao
2011-10-15 01:33:20 +00:00
parent 5fc5e94e92
commit 1f57c0f205
21 changed files with 73 additions and 308 deletions
@@ -19,6 +19,7 @@ public class HADataSource extends MultiDataSource implements DataSource {
private final static Log LOG = LogFactory.getLog(HADataSource.class);
protected DruidDataSource master;
protected ArrayList<DruidDataSource> dataSources = new ArrayList<DruidDataSource>();
protected final List<DruidDataSource> notAvailableDatasources = new CopyOnWriteArrayList<DruidDataSource>();
@@ -28,6 +29,14 @@ public class HADataSource extends MultiDataSource implements DataSource {
}
public DruidDataSource getMaster() {
return master;
}
public void setMaster(DruidDataSource master) {
this.master = master;
}
public List<DruidDataSource> getDataSources() {
return Collections.unmodifiableList(dataSources);
}
@@ -1,63 +0,0 @@
/*
* Copyright 1999-2011 Alibaba Group Holding Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.alibaba.druid.sql.ast.expr;
import com.alibaba.druid.sql.visitor.SQLASTVisitor;
public class SQLTimeLiteralExpr extends SQLLiteralExpr {
private static final long serialVersionUID = 1L;
private SQLTimeLiteralValue time;
private SQLTimeZoneIntervalValue timeZone;
public SQLTimeLiteralExpr(){
}
public SQLTimeLiteralValue getTime() {
return time;
}
public void setTime(SQLTimeLiteralValue time) {
this.time = time;
}
public SQLTimeZoneIntervalValue getTimeZone() {
return timeZone;
}
public void setTimeZone(SQLTimeZoneIntervalValue timeZone) {
this.timeZone = timeZone;
}
public void output(StringBuffer buf) {
buf.append("TIME'");
this.time.output(buf);
if (timeZone != null) {
timeZone.output(buf);
}
buf.append("'");
}
@Override
protected void accept0(SQLASTVisitor visitor) {
visitor.visit(this);
visitor.endVisit(this);
}
}
@@ -1,68 +0,0 @@
/*
* Copyright 1999-2011 Alibaba Group Holding Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.alibaba.druid.sql.ast.expr;
public class SQLTimeLiteralValue {
private int hours;
private int minutes;
private int seconds;
private int secondsFraction;
public int getHours() {
return hours;
}
public void setHours(int hours) {
this.hours = hours;
}
public int getMinutes() {
return minutes;
}
public void setMinutes(int minutes) {
this.minutes = minutes;
}
public int getSeconds() {
return seconds;
}
public void setSeconds(int seconds) {
this.seconds = seconds;
}
public int getSecondsFraction() {
return secondsFraction;
}
public void setSecondsFraction(int secondsFraction) {
this.secondsFraction = secondsFraction;
}
public void output(StringBuffer buf) {
buf.append(hours);
buf.append(':');
buf.append(minutes);
buf.append(':');
buf.append(seconds);
if (secondsFraction > 0) {
buf.append('.');
buf.append(secondsFraction);
}
}
}
@@ -1,58 +0,0 @@
/*
* Copyright 1999-2011 Alibaba Group Holding Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.alibaba.druid.sql.ast.expr;
public class SQLTimeZoneIntervalValue {
private SQLUnaryOperator sign = SQLUnaryOperator.Plus;
private int hours;
private int minutes;
public SQLUnaryOperator getSign() {
return sign;
}
public void setSign(SQLUnaryOperator sign) {
this.sign = sign;
}
public int getHours() {
return hours;
}
public void setHours(int hours) {
this.hours = hours;
}
public int getMinutes() {
return minutes;
}
public void setMinutes(int minutes) {
this.minutes = minutes;
}
public void output(StringBuffer buf) {
if (sign == SQLUnaryOperator.Plus) {
buf.append('+');
} else {
buf.append('-');
}
buf.append(hours);
buf.append(':');
buf.append(minutes);
}
}
@@ -1,73 +0,0 @@
/*
* Copyright 1999-2011 Alibaba Group Holding Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.alibaba.druid.sql.ast.expr;
import com.alibaba.druid.sql.visitor.SQLASTVisitor;
public class SQLTimestampLiteralExpr extends SQLLiteralExpr {
private static final long serialVersionUID = 1L;
private SQLDateLiteralValue dateValue;
private SQLTimeLiteralValue timeValue;
private SQLTimeZoneIntervalValue timeZoneValue;
public SQLTimestampLiteralExpr(){
}
public SQLDateLiteralValue getDateValue() {
return dateValue;
}
public void setDateValue(SQLDateLiteralValue dateValue) {
this.dateValue = dateValue;
}
public SQLTimeLiteralValue getTimeValue() {
return timeValue;
}
public void setTimeValue(SQLTimeLiteralValue timeValue) {
this.timeValue = timeValue;
}
public SQLTimeZoneIntervalValue getTimeZoneValue() {
return timeZoneValue;
}
public void setTimeZoneValue(SQLTimeZoneIntervalValue timeZoneValue) {
this.timeZoneValue = timeZoneValue;
}
public void output(StringBuffer buf) {
buf.append("TIMESTAMP'");
this.dateValue.output(buf);
buf.append(' ');
this.timeValue.output(buf);
if (timeZoneValue != null) {
timeZoneValue.output(buf);
}
buf.append("'");
}
@Override
protected void accept0(SQLASTVisitor visitor) {
visitor.visit(this);
visitor.endVisit(this);
}
}
@@ -47,8 +47,6 @@ import com.alibaba.druid.sql.ast.expr.SQLNumberExpr;
import com.alibaba.druid.sql.ast.expr.SQLPropertyExpr;
import com.alibaba.druid.sql.ast.expr.SQLQueryExpr;
import com.alibaba.druid.sql.ast.expr.SQLSomeExpr;
import com.alibaba.druid.sql.ast.expr.SQLTimeLiteralExpr;
import com.alibaba.druid.sql.ast.expr.SQLTimestampLiteralExpr;
import com.alibaba.druid.sql.ast.expr.SQLUnaryExpr;
import com.alibaba.druid.sql.ast.expr.SQLVariantRefExpr;
import com.alibaba.druid.sql.ast.statement.NotNullConstraint;
@@ -194,14 +192,6 @@ public interface SQLASTVisitor {
void endVisit(SQLDateLiteralExpr x);
boolean visit(SQLTimeLiteralExpr x);
void endVisit(SQLTimeLiteralExpr x);
boolean visit(SQLTimestampLiteralExpr x);
void endVisit(SQLTimestampLiteralExpr x);
boolean visit(SQLSelect x);
void endVisit(SQLSelect select);
@@ -47,8 +47,6 @@ import com.alibaba.druid.sql.ast.expr.SQLNumberExpr;
import com.alibaba.druid.sql.ast.expr.SQLPropertyExpr;
import com.alibaba.druid.sql.ast.expr.SQLQueryExpr;
import com.alibaba.druid.sql.ast.expr.SQLSomeExpr;
import com.alibaba.druid.sql.ast.expr.SQLTimeLiteralExpr;
import com.alibaba.druid.sql.ast.expr.SQLTimestampLiteralExpr;
import com.alibaba.druid.sql.ast.expr.SQLUnaryExpr;
import com.alibaba.druid.sql.ast.expr.SQLVariantRefExpr;
import com.alibaba.druid.sql.ast.statement.NotNullConstraint;
@@ -267,20 +265,6 @@ public class SQLASTVisitorAdapter implements SQLASTVisitor {
public void endVisit(SQLDateLiteralExpr x) {
}
public boolean visit(SQLTimeLiteralExpr x) {
return true;
}
public void endVisit(SQLTimeLiteralExpr x) {
}
public boolean visit(SQLTimestampLiteralExpr x) {
return true;
}
public void endVisit(SQLTimestampLiteralExpr x) {
}
public boolean visit(SQLSelect x) {
return true;
}