Skip to content

Commit

Permalink
+ add some code 3
Browse files Browse the repository at this point in the history
  • Loading branch information
ninqing committed Aug 10, 2016
1 parent b575fae commit 03bbffe
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 50 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@ public class TAtomDataSourceTest extends BaseAtomTest {
// TAtomDataSource tAtomDataSource = createTAtomDataSource(appName,
// dbKey, "oracle");
// JdbcTemplate jtp = new JdbcTemplate(tAtomDataSource);
// int actual = jtp.queryForInt(TAtomDataSourceUnitTest.TEST_SQL);
// int actual = jtp.queryForObject(TAtomDataSourceUnitTest.TEST_SQL);
// Assert.assertEquals(actual, 1);
// tAtomDataSource.destroyDataSource();
// mysql测试
TAtomDataSource tAtomDataSource = createTAtomDataSource(appName, dbKey, "mysql");
JdbcTemplate jtp = new JdbcTemplate(tAtomDataSource);
int actual = jtp.queryForInt(TAtomDataSourceTest.TEST_SQL);
int actual = jtp.queryForObject(TAtomDataSourceTest.TEST_SQL,Integer.class);
Assert.assertEquals(actual, 1);
tAtomDataSource.destroyDataSource();
}
Expand Down Expand Up @@ -256,7 +256,7 @@ private void testChangePasswd(ChangeTestConfig change, ChangeTestConfig restore,
configName = dbType;
TAtomDataSource tAtomDataSource = createTAtomDataSource(appName, dbKey, configName);
JdbcTemplate jtp = new JdbcTemplate(tAtomDataSource);
int actual = jtp.queryForInt(testSql);
int actual = jtp.queryForObject(testSql,Integer.class);
Assert.assertEquals(actual, 1);
// 设置错误的IP进行推送
// 全局配置
Expand All @@ -276,7 +276,7 @@ private void testChangePasswd(ChangeTestConfig change, ChangeTestConfig restore,
// 期待出现错误
boolean result = false;
try {
actual = jtp.queryForInt(testSql);
actual = jtp.queryForObject(testSql,Integer.class);
} catch (Throwable e) {
result = true;
}
Expand All @@ -286,7 +286,7 @@ private void testChangePasswd(ChangeTestConfig change, ChangeTestConfig restore,
+ "/passwd.properties"))));
Thread.sleep(3000);
// 期待结果正常
actual = jtp.queryForInt(testSql);
actual = jtp.queryForObject(testSql,Integer.class);
Assert.assertEquals(actual, 1);
tAtomDataSource.destroyDataSource();

Expand All @@ -300,7 +300,7 @@ private void testChange(ChangeTestConfig change, ChangeTestConfig restore, Strin
String testSql = TAtomDataSourceTest.TEST_SQL;
TAtomDataSource tAtomDataSource = createTAtomDataSource(appName, dbKey, configName);
JdbcTemplate jtp = new JdbcTemplate(tAtomDataSource);
int actual = jtp.queryForInt(testSql);
int actual = jtp.queryForObject(testSql,Integer.class);
Assert.assertEquals(actual, 1);
// 设置错误的IP进行推送
String fileName = "";
Expand All @@ -318,7 +318,7 @@ private void testChange(ChangeTestConfig change, ChangeTestConfig restore, Strin
// 期待出现错误
boolean result = false;
try {
actual = jtp.queryForInt(testSql);
actual = jtp.queryForObject(testSql,Integer.class);
} catch (Throwable e) {
result = true;
}
Expand All @@ -328,7 +328,7 @@ private void testChange(ChangeTestConfig change, ChangeTestConfig restore, Strin
+ fileName))));
Thread.sleep(3000);
// 期待结果正常
actual = jtp.queryForInt(testSql);
actual = jtp.queryForObject(testSql,Integer.class);
Assert.assertEquals(actual, 1);
tAtomDataSource.destroyDataSource();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public void createStaticTAtomDataSource() throws Exception {
dataSource.init();
JdbcTemplate jtp = new JdbcTemplate();
jtp.setDataSource(dataSource);
int actual = jtp.queryForInt("select 1 from dual");
int actual = jtp.queryForObject("select 1 from dual",Integer.class);
Assert.assertEquals(actual, 1);
dataSource.destroyDataSource();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,23 +0,0 @@
package com.taobao.tddl.common.utils;

import org.junit.Test;

import com.googlecode.concurrentlinkedhashmap.EvictionListener;

public class GoogleConcurrentLruCacheTest {

@Test
public void testSimple() {

GoogleConcurrentLruCache cache = new GoogleConcurrentLruCache(10, new EvictionListener<String, String>() {

public void onEviction(String key, String value) {
System.out.println("evict key:" + key + " values:" + value);
}
});

for (int i = 0; i < 11; i++) {
cache.put("key" + i, "value" + i);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -428,4 +428,16 @@ public void setLocalInfileInputStream(InputStream stream) {
public InputStream getLocalInfileInputStream() {
return this.executionContext.getLocalInfileInputStream();
}

@Override
public void closeOnCompletion() throws SQLException {
// TODO Auto-generated method stub

}

@Override
public boolean isCloseOnCompletion() throws SQLException {
// TODO Auto-generated method stub
return false;
}
}
29 changes: 11 additions & 18 deletions tddl-repo-demo/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,25 +32,18 @@
<artifactId>tddl-group</artifactId>
<version>${project.version}</version>
</dependency>
<!-- HBase -->
<dependency>
<groupId>org.apache.hbase</groupId>
<artifactId>hbase</artifactId>
</dependency>
<dependency>
<groupId>org.apache.zookeeper</groupId>
<artifactId>zookeeper</artifactId>
</dependency>
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-core</artifactId>
</dependency>

<!-- Test libs -->
<!-- HBase -->
<dependency>
<groupId>org.apache.hbase</groupId>
<artifactId>hbase</artifactId>
</dependency>
<dependency>
<groupId>org.apache.zookeeper</groupId>
<artifactId>zookeeper</artifactId>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-core</artifactId>
</dependency>
</dependencies>

Expand Down

0 comments on commit 03bbffe

Please sign in to comment.