Commit 39743cd6 authored by xiebaofa's avatar xiebaofa

创建Demo

parent 0f8c85ee
......@@ -51,7 +51,7 @@
<transformer
implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<manifestEntries>
<Main-Class>com.miya.App</Main-Class>
<Main-Class>com.miya.Demo</Main-Class>
<X-Compile-Source-JDK>${maven.compiler.source}</X-Compile-Source-JDK>
<X-Compile-Target-JDK>${maven.compiler.target}</X-Compile-Target-JDK>
</manifestEntries>
......
......@@ -9,7 +9,7 @@ import java.sql.SQLException;
*
*/
public class App {
public class Demo {
private static final String CREATE_SOURCE_SQL = "CREATE TABLE source_table_4 (\n" +
" `mysql_type` STRING,\n" +
......@@ -32,45 +32,12 @@ public class App {
" 'format' = 'csv'\n" +
")";
private static final String CREATE_PRINT_SQL = "CREATE TABLE print_table3(`mysql_type` STRING) " +
"WITH ('connector'='filesystem', \n" +
" 'path'='file:///tmp/abc', \n" +
" 'format'='csv' )";
private static final String CREATE_HBASE_SQL = "CREATE TABLE hTable (\n" +
" rowkey INT,\n" +
" family1 ROW<q1 STRING>,\n" +
" PRIMARY KEY (rowkey) NOT ENFORCED\n" +
") WITH (\n" +
" 'connector' = 'hbase-2.2',\n" +
" 'table-name' = 'mytable',\n" +
" 'zookeeper.quorum' = '172.16.128.133:2181'\n" +
")" ;
private static final String CREATE_HBASE_SQL2 = "CREATE TABLE hTable2 (\n" +
" rowkey INT,\n" +
" family1 ROW<q1 STRING>,\n" +
" PRIMARY KEY (rowkey) NOT ENFORCED\n" +
") WITH (\n" +
" 'connector' = 'hbase-2.2',\n" +
" 'table-name' = 'mytable2',\n" +
" 'zookeeper.quorum' = '172.16.128.3:2181',\n" +
" 'zookeeper.znode.parent' = '/hbase'\n" +
")" ;
private static final String SHOW_TABLES_SQL = "show tables";
private static final String CREATE_JOB_SQL = "insert into sink_table_4(mysql_type) select mysql_type from source_table_4";
private static final String CREATE_JOB_SQL2 = "INSERT INTO hTable\n" +
"SELECT CAST(mysql_type as INT),ROW(mysql_type) FROM source_table_4";
private static final String CREATE_JOB_SQL3 = "INSERT INTO hTable2\n" +
"SELECT CAST(mysql_type as INT),ROW(mysql_type) FROM source_table_4";
// private static final String CREATE_JOB_SQL = " select mysql_type from source_table_4";
public static void main(String[] args) throws Exception {
SessionClient session = new SessionClient(new App().getClass().getName(),"123.60.47.52", 8083, "streaming");
SessionClient session = new SessionClient(new Demo().getClass().getName(),"123.60.47.52", 8083, "streaming");
kafka2kafka(session);
......@@ -78,11 +45,6 @@ public class App {
session.close();
}
private static void kafka2hbase(SessionClient session) throws SQLException {
System.out.println(session.submitStatement(CREATE_SOURCE_SQL).getResults());
System.out.println(session.submitStatement(CREATE_HBASE_SQL2).getResults());
System.out.println(session.submitStatement(CREATE_JOB_SQL3).getResults());
}
private static void kafka2kafka(SessionClient session) throws SQLException {
System.out.println(session.submitStatement(CREATE_SOURCE_SQL).getResults());
......
package com.miya;
import static org.junit.Assert.assertTrue;
import org.junit.Test;
/**
* Unit test for simple App.
*/
public class AppTest
{
/**
* Rigorous Test :-)
*/
@Test
public void shouldAnswerWithTrue()
{
assertTrue( true );
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment