package com.thinkbiganalytics.schema;

import com.thinkbiganalytics.kerberos.KerberosTicketConfiguration;
import com.thinkbiganalytics.spring.CommonsSpringConfiguration;

import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.SpringApplicationConfiguration;
import org.springframework.test.context.TestPropertySource;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import java.util.List;

import javax.inject.Inject;
import javax.sql.DataSource;

/**
 * Created by sr186054 on 1/9/17.
 */
@RunWith(SpringJUnit4ClassRunner.class)
@TestPropertySource(locations = "classpath:test-application.properties")
@SpringApplicationConfiguration(classes = {CommonsSpringConfiguration.class, TestDbSchemaConfig.class})
@Ignore
public class DBSchemaParserTest {

    @Inject
    private DataSource dataSource;


    @Test
    public void test() {
        DBSchemaParser schemaParser = new DBSchemaParser(dataSource, new KerberosTicketConfiguration());
        List<String> schemas = schemaParser.listCatalogs();

        if (schemas != null) {
            schemas.stream().forEach(schema ->
                                     {
                                         List<String> tables = schemaParser.listTables(schema);
                                         if (tables != null) {
                                             //    tables.forEach(table -> System.out.println(table));
                                         }
                                     });
        }

        List<String> tables = schemaParser.listTables("thinkbig");
        if (tables != null) {
            tables.forEach(table -> System.out.println(table));
        }

    }

}

@@ -1016,24 +1016,34 @@
 uration());%0A
+       /*%0A
         List
@@ -1301,16 +1301,20 @@
 s(schema
+,%22%25%22
 );%0A     
@@ -1564,24 +1564,34 @@
 ;%0A        %7D%0A
+        */
 %0A        Lis
@@ -1613,41 +1613,240 @@
 s = 
-schemaParser.listTables(%22thinkbig
+null;%0A       /*  tables = schemaParser.listTables(null,null);%0A        if (tables != null) %7B%0A            tables.forEach(table -%3E System.out.println(table));%0A        %7D%0A        */%0A%0A        tables = schemaParser.listTables(null, %22batch%25
 %22);%0A

fix build