Repository: ambari
Updated Branches:
  refs/heads/trunk 0bade7ced -> e423a65e5


http://git-wip-us.apache.org/repos/asf/ambari/blob/e423a65e/contrib/views/hive/src/test/java/org/apache/ambari/view/hive/resources/upload/OpenCSVTest.java
----------------------------------------------------------------------
diff --git 
a/contrib/views/hive/src/test/java/org/apache/ambari/view/hive/resources/upload/OpenCSVTest.java
 
b/contrib/views/hive/src/test/java/org/apache/ambari/view/hive/resources/upload/OpenCSVTest.java
deleted file mode 100644
index 0bdf5cf..0000000
--- 
a/contrib/views/hive/src/test/java/org/apache/ambari/view/hive/resources/upload/OpenCSVTest.java
+++ /dev/null
@@ -1,259 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you 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
- * <p/>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p/>
- * 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 org.apache.ambari.view.hive.resources.upload;
-
-import com.opencsv.CSVParser;
-import com.opencsv.CSVReader;
-import com.opencsv.CSVWriter;
-import org.junit.Assert;
-import org.junit.Test;
-
-import java.io.IOException;
-import java.io.StringReader;
-import java.io.StringWriter;
-
-public class OpenCSVTest {
-
-  /**
-   * no exception in creating csvParser with emtpy stream
-   *
-   * @throws IOException
-   */
-  @Test
-  public void testEmptyStream() throws Exception {
-    String csv = "";
-
-    CSVParser jp = new CSVParser();
-    String[] columns = jp.parseLine(csv);
-    Assert.assertEquals("Should detect one column.", 1, columns.length);
-    Assert.assertEquals("Should detect one column with empty value.", new 
String[]{""}, columns);
-  }
-
-  /**
-   * in case of csv an empty line is still considered as row
-   *
-   * @throws IOException
-   */
-  @Test
-  public void testEmptyRow() throws Exception {
-    String csv = "       ";
-    CSVParser jp = new CSVParser();
-
-    String[] columns = jp.parseLine(csv);
-    Assert.assertEquals("One column not detected.", 1, columns.length);
-    Assert.assertArrayEquals("Row should not be empty", new String[]{"       
"}, columns);
-  }
-
-  @Test
-  public void testParse1Row() throws Exception {
-    String csv = "value1,c,10,10.1";
-
-    String[] cols = csv.split(",");
-    CSVParser jp = new CSVParser();
-    String[] columns = jp.parseLine(csv);
-    Assert.assertEquals("4 columns not detect", 4, columns.length);
-    Assert.assertArrayEquals("Row not equal!", cols, columns);
-  }
-
-  @Test
-  public void testParseMultipleRow() throws Exception {
-
-    String csv = "value1,c,10,10.1\n" +
-      "value2,c2,102,true";
-
-    try(
-      StringReader sr = new StringReader(csv);
-      CSVReader csvReader = new CSVReader(sr,',','"','\\');
-    ) {
-      String[] row1 = csvReader.readNext();
-      String[] row2 = csvReader.readNext();
-
-      Assert.assertArrayEquals("Failed to match 1st row!",new 
String[]{"value1", "c", "10", "10.1"}, row1);
-
-      Assert.assertArrayEquals("Failed to match 2nd row!",new 
String[]{"value2", "c2", "102", "true"}, row2);
-    }
-  }
-
-  @Test
-  public void testParseCustomSeparator() throws Exception {
-
-    String csv = "value1#c#10#10.1\n" +
-      "value2#c2#102#true";
-
-    try(
-      StringReader sr = new StringReader(csv);
-      CSVReader csvReader = new CSVReader(sr,'#','"','\\');
-    ) {
-      String[] row1 = csvReader.readNext();
-      String[] row2 = csvReader.readNext();
-
-      Assert.assertArrayEquals("Failed to match 1st row!",new 
String[]{"value1", "c", "10", "10.1"}, row1);
-
-      Assert.assertArrayEquals("Failed to match 2nd row!",new 
String[]{"value2", "c2", "102", "true"}, row2);
-    }
-  }
-
-
-  @Test
-  public void testParseCustomSeparatorAndQuote() throws Exception {
-
-    String csv = "\"valu#e1\"#c#10#10.1\n" +
-      "value2#c2#102#true";
-
-    try(
-      StringReader sr = new StringReader(csv);
-      CSVReader csvReader = new CSVReader(sr,'#','"','\\');
-    ) {
-      String[] row1 = csvReader.readNext();
-      String[] row2 = csvReader.readNext();
-
-      Assert.assertArrayEquals("Failed to match 1st row!",new 
String[]{"valu#e1", "c", "10", "10.1"}, row1);
-
-      Assert.assertArrayEquals("Failed to match 2nd row!",new 
String[]{"value2", "c2", "102", "true"}, row2);
-    }
-  }
-
-  @Test
-  public void testMultipleEscape() throws Exception {
-
-    String csv = "BBAABBKMAABB";
-
-    try(
-      StringReader sr = new StringReader(csv);
-      CSVReader csvReader = new CSVReader(sr,'M','"','B');
-    ) {
-      String[] row1 = csvReader.readNext();
-      Assert.assertArrayEquals("Failed to match 1st row!",new String[]{"AABK", 
"AAB"}, row1);
-    }
-  }
-
-  @Test
-  public void testParseCustomSeparatorAndCustomQuote() throws Exception {
-
-    String csv = "\'valu#e1\'#c#10#10.1\n" +
-      "value2#c2#102#true";
-
-    try(
-      StringReader sr = new StringReader(csv);
-      CSVReader csvReader = new CSVReader(sr,'#','\'','\\');
-    ) {
-      String[] row1 = csvReader.readNext();
-      String[] row2 = csvReader.readNext();
-      String[] row3 = csvReader.readNext();
-
-      Assert.assertArrayEquals("Failed to match 1st row!",new 
String[]{"valu#e1", "c", "10", "10.1"}, row1);
-
-      Assert.assertArrayEquals("Failed to match 2nd row!",new 
String[]{"value2", "c2", "102", "true"}, row2);
-
-      Assert.assertArrayEquals("should match Null", null, row3);
-    }
-  }
-
-  @Test
-  public void testWriter() throws Exception {
-
-    String csv = "\'valu#e1\'#c#10#10.1\n" +
-      "value2#c2#102#true";
-
-    try(
-      StringReader sr = new StringReader(csv);
-      CSVReader csvReader = new CSVReader(sr,'#','\'','\\');
-      StringWriter sw = new StringWriter();
-      CSVWriter csvWriter = new CSVWriter(sw);
-    ) {
-      String[] row1 = csvReader.readNext();
-      csvWriter.writeNext(row1);
-      String[] row2 = csvReader.readNext();
-      csvWriter.writeNext(row2);
-
-      Assert.assertEquals("CSVWriter 
failed.","\"valu#e1\",\"c\",\"10\",\"10.1\"\n" +
-        "\"value2\",\"c2\",\"102\",\"true\"\n", sw.getBuffer().toString());
-    }
-  }
-
-  @Test
-  public void testWriterCustomSeparator() throws Exception {
-
-    String csv = "\'valu#e1\'#c#10#10.1\n" +
-      "value2#c2#102#true";
-
-    try(
-      StringReader sr = new StringReader(csv);
-      CSVReader csvReader = new CSVReader(sr,'#','\'','\\');
-      StringWriter sw = new StringWriter();
-      CSVWriter csvWriter = new CSVWriter(sw,'$');
-    ) {
-      String[] row1 = csvReader.readNext();
-      csvWriter.writeNext(row1);
-      String[] row2 = csvReader.readNext();
-      csvWriter.writeNext(row2);
-
-      Assert.assertEquals("CSVWriter 
failed.","\"valu#e1\"$\"c\"$\"10\"$\"10.1\"\n" +
-        "\"value2\"$\"c2\"$\"102\"$\"true\"\n", sw.getBuffer().toString());
-    }
-  }
-
-  @Test
-  public void testWriterCustomSeparatorAndEnline() throws Exception {
-
-    String csv = "value1,c,10,10.1\n" +
-      "value2,c2,102,true";
-
-    try(
-      StringReader sr = new StringReader(csv);
-      CSVReader csvReader = new CSVReader(sr,',','\'','\\');
-      StringWriter sw = new StringWriter();
-      CSVWriter csvWriter = new CSVWriter(sw,'\002',',',"\003");
-    ) {
-      String[] row1 = csvReader.readNext();
-      csvWriter.writeNext(row1,false);
-      String[] row2 = csvReader.readNext();
-      csvWriter.writeNext(row2,false);
-
-      Assert.assertEquals("CSVWriter failed.","value1\002c\00210\00210.1\003" +
-        "value2\002c2\002102\002true\003", sw.getBuffer().toString());
-    }
-  }
-
-  @Test
-  public void testWriterQuote() throws Exception {
-
-    String csv = "val#ue1,c,10,10.1\n" +
-      "'val,ue2',c2,102,true\n" +
-      "val\002ue3,c\0033,103,false";
-
-    try(
-      StringReader sr = new StringReader(csv);
-      CSVReader csvReader = new CSVReader(sr,',','\'','\\');
-      StringWriter sw = new StringWriter();
-      CSVWriter csvWriter = new CSVWriter(sw,'\002','\'',"\003");
-    ) {
-      String[] row1 = csvReader.readNext();
-      csvWriter.writeNext(row1,false);
-      String[] row2 = csvReader.readNext();
-      csvWriter.writeNext(row2,false);
-      String[] row3 = csvReader.readNext();
-      csvWriter.writeNext(row3,false);
-
-      Assert.assertEquals("CSVWriter 
failed.","val#ue1\u0002c\u000210\u000210.1\u0003" +
-        "val,ue2\u0002c2\u0002102\u0002true\u0003" +
-        "'val\u0002ue3'\u0002c\u00033\u0002103\u0002false\u0003", 
sw.getBuffer().toString());
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/e423a65e/contrib/views/hive/src/test/java/org/apache/ambari/view/hive/resources/upload/ParseUtilsTest.java
----------------------------------------------------------------------
diff --git 
a/contrib/views/hive/src/test/java/org/apache/ambari/view/hive/resources/upload/ParseUtilsTest.java
 
b/contrib/views/hive/src/test/java/org/apache/ambari/view/hive/resources/upload/ParseUtilsTest.java
deleted file mode 100644
index d1ce211..0000000
--- 
a/contrib/views/hive/src/test/java/org/apache/ambari/view/hive/resources/upload/ParseUtilsTest.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you 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
- * <p/>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p/>
- * 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 org.apache.ambari.view.hive.resources.upload;
-
-import org.apache.ambari.view.hive.resources.uploads.parsers.ParseUtils;
-import org.junit.Assert;
-import org.junit.Test;
-
-public class ParseUtilsTest {
-  @Test
-  public void testDateFormats() {
-    Assert.assertTrue(ParseUtils.isDate("1970-01-01"));
-    Assert.assertTrue(ParseUtils.isDate("1970-01-01 "));
-    Assert.assertTrue(ParseUtils.isDate("0001-1-3"));
-    Assert.assertTrue(ParseUtils.isDate("1996-1-03"));
-    Assert.assertTrue(ParseUtils.isDate("1996-01-3"));
-    Assert.assertTrue(ParseUtils.isDate("1996-10-3"));
-    Assert.assertFalse(ParseUtils.isDate("1970-01-01 01:01:01"));
-    Assert.assertFalse(ParseUtils.isDate("1970-01-01 23:59:59.999999"));
-    Assert.assertFalse(ParseUtils.isDate("1970/01/01"));
-    Assert.assertFalse(ParseUtils.isDate("01-01-1970"));
-    Assert.assertFalse(ParseUtils.isDate("1970-13-01"));
-    Assert.assertFalse(ParseUtils.isDate("1970-01-32"));
-    Assert.assertFalse(ParseUtils.isDate("01/01/1970"));
-    Assert.assertFalse(ParseUtils.isDate("001-1-3"));
-  }
-
-  @Test
-  public void testTimestampFormats() {
-    Assert.assertFalse(ParseUtils.isTimeStamp("1999-11-30"));
-    Assert.assertFalse(ParseUtils.isTimeStamp("1999-12-31 23:59"));
-    Assert.assertTrue(ParseUtils.isTimeStamp("1999-12-31 23:59:59"));
-    Assert.assertTrue(ParseUtils.isTimeStamp("1999-12-31 23:59:59.100"));
-    Assert.assertTrue(ParseUtils.isTimeStamp("1999-12-31 23:59:59.999999"));
-    Assert.assertTrue(ParseUtils.isTimeStamp("1999-12-31 23:59:59.99999999"));
-    Assert.assertTrue(ParseUtils.isTimeStamp("1999-12-31 23:59:59.999999999"));
-    Assert.assertTrue(ParseUtils.isTimeStamp("1999-10-31 23:59:59.999999999"));
-    Assert.assertFalse(ParseUtils.isTimeStamp("1999-12-31 
23:59:59.9999999999"));
-    Assert.assertFalse(ParseUtils.isTimeStamp("1999/12/31 
23:59:59.9999999999"));
-  }
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/e423a65e/contrib/views/hive/src/test/java/org/apache/ambari/view/hive/resources/upload/QueryGeneratorTest.java
----------------------------------------------------------------------
diff --git 
a/contrib/views/hive/src/test/java/org/apache/ambari/view/hive/resources/upload/QueryGeneratorTest.java
 
b/contrib/views/hive/src/test/java/org/apache/ambari/view/hive/resources/upload/QueryGeneratorTest.java
deleted file mode 100644
index 4c4a03a..0000000
--- 
a/contrib/views/hive/src/test/java/org/apache/ambari/view/hive/resources/upload/QueryGeneratorTest.java
+++ /dev/null
@@ -1,108 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you 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
- * <p/>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p/>
- * 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 org.apache.ambari.view.hive.resources.upload;
-
-import org.apache.ambari.view.hive.client.ColumnDescription;
-import org.apache.ambari.view.hive.resources.uploads.ColumnDescriptionImpl;
-import org.apache.ambari.view.hive.resources.uploads.HiveFileType;
-import org.apache.ambari.view.hive.resources.uploads.query.DeleteQueryInput;
-import 
org.apache.ambari.view.hive.resources.uploads.query.InsertFromQueryInput;
-import org.apache.ambari.view.hive.resources.uploads.query.QueryGenerator;
-import org.apache.ambari.view.hive.resources.uploads.query.RowFormat;
-import org.apache.ambari.view.hive.resources.uploads.query.TableInfo;
-import org.junit.Assert;
-import org.junit.Test;
-
-import java.util.ArrayList;
-import java.util.List;
-
-public class QueryGeneratorTest {
-  @Test
-  public void testCreateTextFile() {
-
-    List<ColumnDescriptionImpl> cdl = new ArrayList<>(4);
-    cdl.add(new ColumnDescriptionImpl("col1", 
ColumnDescription.DataTypes.CHAR.toString(), 0, 10));
-    cdl.add(new ColumnDescriptionImpl("col2", 
ColumnDescription.DataTypes.STRING.toString(), 1));
-    cdl.add(new ColumnDescriptionImpl("col3", 
ColumnDescription.DataTypes.DECIMAL.toString(), 2, 10, 5));
-    cdl.add(new ColumnDescriptionImpl("col4", 
ColumnDescription.DataTypes.VARCHAR.toString(), 3, 40));
-    cdl.add(new ColumnDescriptionImpl("col5", 
ColumnDescription.DataTypes.INT.toString(), 4));
-
-    TableInfo ti = new TableInfo("databaseName", "tableName", cdl, 
HiveFileType.TEXTFILE, new RowFormat(',', '\\'));
-
-    QueryGenerator qg = new QueryGenerator();
-    Assert.assertEquals("Create query for text file not correct ","CREATE 
TABLE tableName (col1 CHAR(10), col2 STRING," +
-      " col3 DECIMAL(10,5), col4 VARCHAR(40), col5 INT) ROW FORMAT DELIMITED 
FIELDS TERMINATED BY ','" +
-      " ESCAPED BY '\\\\' STORED AS TEXTFILE;",qg.generateCreateQuery(ti));
-  }
-
-  @Test
-  public void testCreateORC() {
-
-    List<ColumnDescriptionImpl> cdl = new ArrayList<>(4);
-    cdl.add(new ColumnDescriptionImpl("col1", 
ColumnDescription.DataTypes.CHAR.toString(), 0, 10));
-    cdl.add(new ColumnDescriptionImpl("col2", 
ColumnDescription.DataTypes.STRING.toString(), 1));
-    cdl.add(new ColumnDescriptionImpl("col3", 
ColumnDescription.DataTypes.DECIMAL.toString(), 2, 10, 5));
-    cdl.add(new ColumnDescriptionImpl("col4", 
ColumnDescription.DataTypes.VARCHAR.toString(), 3, 40));
-    cdl.add(new ColumnDescriptionImpl("col5", 
ColumnDescription.DataTypes.INT.toString(), 4));
-
-    TableInfo ti = new TableInfo("databaseName", "tableName", cdl, 
HiveFileType.ORC, new RowFormat(',', '\\'));
-
-    QueryGenerator qg = new QueryGenerator();
-    Assert.assertEquals("Create query for text file not correct ","CREATE 
TABLE tableName (col1 CHAR(10), col2 STRING, col3 DECIMAL(10,5), col4 
VARCHAR(40), col5 INT) STORED AS ORC;",qg.generateCreateQuery(ti));
-  }
-
-  @Test
-  public void testInsertWithoutUnhexFromQuery() {
-    List<ColumnDescriptionImpl> cdl = new ArrayList<>(4);
-    cdl.add(new ColumnDescriptionImpl("col1", 
ColumnDescription.DataTypes.CHAR.toString(), 0, 10));
-    cdl.add(new ColumnDescriptionImpl("col2", 
ColumnDescription.DataTypes.STRING.toString(), 1));
-    cdl.add(new ColumnDescriptionImpl("col3", 
ColumnDescription.DataTypes.DECIMAL.toString(), 2, 10, 5));
-    cdl.add(new ColumnDescriptionImpl("col4", 
ColumnDescription.DataTypes.VARCHAR.toString(), 3, 40));
-    cdl.add(new ColumnDescriptionImpl("col5", 
ColumnDescription.DataTypes.INT.toString(), 4));
-
-    InsertFromQueryInput ifqi = new 
InsertFromQueryInput("fromDB","fromTable","toDB","toTable", cdl, Boolean.FALSE);
-
-    QueryGenerator qg = new QueryGenerator();
-    Assert.assertEquals("insert from one table to another not correct 
","INSERT INTO TABLE toDB.toTable SELECT col1, col2, col3, col4, col5 FROM 
fromDB.fromTable;",qg.generateInsertFromQuery(ifqi));
-  }
-
-  @Test
-  public void testInsertWithUnhexFromQuery() {
-    List<ColumnDescriptionImpl> cdl = new ArrayList<>(4);
-    cdl.add(new ColumnDescriptionImpl("col1", 
ColumnDescription.DataTypes.CHAR.toString(), 0, 10));
-    cdl.add(new ColumnDescriptionImpl("col2", 
ColumnDescription.DataTypes.STRING.toString(), 1));
-    cdl.add(new ColumnDescriptionImpl("col3", 
ColumnDescription.DataTypes.DECIMAL.toString(), 2, 10, 5));
-    cdl.add(new ColumnDescriptionImpl("col4", 
ColumnDescription.DataTypes.VARCHAR.toString(), 3, 40));
-    cdl.add(new ColumnDescriptionImpl("col5", 
ColumnDescription.DataTypes.INT.toString(), 4));
-
-    InsertFromQueryInput ifqi = new 
InsertFromQueryInput("fromDB","fromTable","toDB","toTable", cdl, Boolean.TRUE);
-
-    QueryGenerator qg = new QueryGenerator();
-    Assert.assertEquals("insert from one table to another not correct 
","INSERT INTO TABLE toDB.toTable SELECT UNHEX(col1), UNHEX(col2), col3, 
UNHEX(col4), col5 FROM fromDB.fromTable;",qg.generateInsertFromQuery(ifqi));
-  }
-
-  @Test
-  public void testDropTableQuery() {
-
-    DeleteQueryInput deleteQueryInput = new 
DeleteQueryInput("dbName","tableName");
-
-    QueryGenerator qg = new QueryGenerator();
-    Assert.assertEquals("drop table query not correct ","DROP TABLE 
dbName.tableName;",qg.generateDropTableQuery(deleteQueryInput ));
-  }
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/e423a65e/contrib/views/hive/src/test/java/org/apache/ambari/view/hive/resources/upload/TableDataReaderTest.java
----------------------------------------------------------------------
diff --git 
a/contrib/views/hive/src/test/java/org/apache/ambari/view/hive/resources/upload/TableDataReaderTest.java
 
b/contrib/views/hive/src/test/java/org/apache/ambari/view/hive/resources/upload/TableDataReaderTest.java
deleted file mode 100644
index 2e9c2b0..0000000
--- 
a/contrib/views/hive/src/test/java/org/apache/ambari/view/hive/resources/upload/TableDataReaderTest.java
+++ /dev/null
@@ -1,127 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you 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
- * <p/>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p/>
- * 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 org.apache.ambari.view.hive.resources.upload;
-
-import org.apache.ambari.view.hive.client.ColumnDescription;
-import org.apache.ambari.view.hive.client.Row;
-import org.apache.ambari.view.hive.resources.uploads.ColumnDescriptionImpl;
-import org.apache.ambari.view.hive.resources.uploads.TableDataReader;
-import org.junit.Assert;
-import org.junit.Test;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-
-public class TableDataReaderTest {
-
-  private class RowIter implements Iterator<Row> {
-    int numberOfRows;
-    int numberOfCols;
-    int index = 0 ;
-    ArrayList<Row> rows = new ArrayList<Row>();
-    public RowIter(int numberOfRows, int numberOfCols){
-      this.numberOfRows = numberOfRows;
-      this.numberOfCols = numberOfCols;
-      int x = 0 ;
-      for(int i = 0; i < this.numberOfRows; i++ ){
-        Object [] objArray = new Object[10];
-        for(int j = 0; j < this.numberOfCols; j++ ){
-          objArray[j] = x++ + "" ;
-        }
-        Row row = new Row(objArray);
-        rows.add(row);
-      }
-    }
-    @Override
-    public boolean hasNext() {
-      return index < numberOfRows;
-    }
-
-    @Override
-    public Row next() {
-      return rows.get(index++);
-    }
-
-    @Override
-    public void remove() {
-      throw new RuntimeException("Operation not supported.");
-    }
-
-    @Override
-    public String toString() {
-      return "RowIter{" +
-              "index=" + index +
-              ", rows=" + rows +
-              '}';
-    }
-  }
-
-  @Test
-  public void testCSVReader() throws IOException {
-    RowIter rowIter = new RowIter(10,10);
-    List<ColumnDescriptionImpl> colDescs = new LinkedList<>();
-    for(int i = 0 ; i < 10 ; i++ ) {
-      ColumnDescriptionImpl cd = new ColumnDescriptionImpl("col" + (i+1) , 
ColumnDescription.DataTypes.STRING.toString(), i);
-      colDescs.add(cd);
-    }
-
-    TableDataReader tableDataReader = new TableDataReader(rowIter, colDescs, 
false);
-
-    char del = TableDataReader.CSV_DELIMITER;
-    char[] first10 = {'0', del, '1', del, '2', del, '3', del, '4', del};
-    char [] buf = new char[10];
-    tableDataReader.read(buf,0,10);
-
-    Assert.assertArrayEquals(first10,buf);
-
-    char[] next11 = {'5', del, '6', del, '7', del, '8', del, '9', '\n', '1'}; 
//"5,6,7,8,9\n1".toCharArray();
-    char [] buf1 = new char[11];
-    tableDataReader.read(buf1,0,11);
-
-    Assert.assertArrayEquals(next11,buf1);
-
-    // read it fully
-    while( tableDataReader.read(buf,0,10) != -1 );
-
-    char [] last10 = {'9', '7', del, '9', '8', del, '9', '9', '\n', del}; 
//"97,98,99\n,".toCharArray(); // last comma is the left over of previous read.
-
-    Assert.assertArrayEquals(last10,buf);
-  }
-
-  @Test
-  public void testEmptyCSVReader() throws IOException {
-    RowIter rowIter = new RowIter(0,0);
-
-    TableDataReader tableDataReader = new TableDataReader(rowIter, null, 
false);
-
-    char[] first10 = new char [10];
-    char [] buf = new char[10];
-    for( int i = 0 ; i < 10 ; i++ ){
-      first10[i] = '\0';
-      buf[i] = '\0';
-    }
-
-    tableDataReader.read(buf,0,10);
-
-    Assert.assertArrayEquals(first10,buf);
-  }
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/e423a65e/contrib/views/hive/src/test/java/org/apache/ambari/view/hive/resources/upload/XMLParserTest.java
----------------------------------------------------------------------
diff --git 
a/contrib/views/hive/src/test/java/org/apache/ambari/view/hive/resources/upload/XMLParserTest.java
 
b/contrib/views/hive/src/test/java/org/apache/ambari/view/hive/resources/upload/XMLParserTest.java
deleted file mode 100644
index 1bdf031..0000000
--- 
a/contrib/views/hive/src/test/java/org/apache/ambari/view/hive/resources/upload/XMLParserTest.java
+++ /dev/null
@@ -1,138 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you 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
- * <p/>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p/>
- * 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 org.apache.ambari.view.hive.resources.upload;
-
-import com.google.gson.JsonArray;
-import com.google.gson.JsonObject;
-import org.apache.ambari.view.hive.client.Row;
-import org.apache.ambari.view.hive.resources.uploads.parsers.json.JSONParser;
-import org.apache.ambari.view.hive.resources.uploads.parsers.xml.XMLParser;
-import org.junit.Assert;
-import org.junit.Test;
-
-import java.io.IOException;
-import java.io.StringReader;
-import java.util.Iterator;
-
-public class XMLParserTest {
-
-  @Test(expected = IOException.class)
-  public void testEmptyStream() throws Exception {
-    String xml = "";
-
-    try(
-      StringReader sr = new StringReader(xml);
-      XMLParser jp = new XMLParser(sr, null);
-      ) {
-        // creation of XMLParser will throw exception.
-    }
-  }
-
-  @Test
-  public void testEmptyRow() throws Exception {
-    String xml = "<table><row></row></table>";
-    try(
-      StringReader sr = new StringReader(xml);
-      XMLParser jp = new XMLParser(sr, null);
-      ) {
-      Iterator<Row> iterator = jp.iterator();
-
-      Assert.assertEquals("Iterator should not be Empty", true, 
iterator.hasNext());
-      Assert.assertArrayEquals("Row should be empty",new 
Object[]{},iterator.next().getRow());
-    }
-  }
-
-
-  @Test
-  public void testEmptyTable() throws Exception {
-    String xml = "<table></table>";
-
-    try(
-      StringReader sr = new StringReader(xml);
-      XMLParser jp = new XMLParser(sr, null);
-      ) {
-      Iterator<Row> iterator = jp.iterator();
-
-      Assert.assertEquals("Iterator Empty!", false, iterator.hasNext());
-    }
-  }
-
-  @Test
-  public void testParse1Row() throws Exception {
-
-    String xml =
-    "<table>"
-    + "<row>"
-    + "<col name=\"key1\">value1</col>"
-    + "<col name=\"key2\">c</col>"
-    + "<col name=\"key3\">10</col>"
-    + "<col name=\"key4\">10.1</col>"
-    + "</row>"
-    + "</table>"  ;
-
-    try(
-      StringReader sr = new StringReader(xml);
-      XMLParser jp = new XMLParser(sr, null)
-    ) {
-      Iterator<Row> iterator = jp.iterator();
-
-      Assert.assertEquals("Iterator Empty!", true, iterator.hasNext());
-      Row row = iterator.next();
-      Row expected = new Row(new Object[]{"value1", "c", "10", "10.1"});
-      Assert.assertEquals("Row not equal!", expected, row);
-
-      Assert.assertEquals("Should report no more rows!", false, 
iterator.hasNext());
-    }
-  }
-
-  @Test
-  public void testParseMultipleRow() throws Exception {
-    String xml =
-    "<table>"
-    + "<row>"
-    + "<col name=\"key1\">value1</col>"
-    + "<col name=\"key2\">c</col>"
-    + "<col name=\"key3\">10</col>"
-    + "<col name=\"key4\">10.1</col>"
-    + "</row>"
-    + "<row>"
-    + "<col name=\"key1\">value2</col>"
-    + "<col name=\"key2\">c2</col>"
-    + "<col name=\"key3\">102</col>"
-    + "<col name=\"key4\">true</col>"
-    + "</row>"
-    + "</table>"  ;
-
-    try(
-      StringReader sr = new StringReader(xml);
-      XMLParser jp = new XMLParser(sr, null)
-    ) {
-      Iterator<Row> iterator = jp.iterator();
-
-      Assert.assertEquals("Failed to detect 1st row!", true, 
iterator.hasNext());
-      Assert.assertEquals("Failed to match 1st row!", new Row(new 
Object[]{"value1", "c", "10", "10.1"}), iterator.next());
-
-      Assert.assertEquals("Failed to detect 2nd row!", true, 
iterator.hasNext());
-      Assert.assertEquals("Failed to match 2nd row!", new Row(new 
Object[]{"value2", "c2", "102", Boolean.TRUE.toString()}), iterator.next());
-
-      Assert.assertEquals("Failed to detect end of rows!", false, 
iterator.hasNext());
-      Assert.assertEquals("Failed to detect end of rows 2nd time!", false, 
iterator.hasNext());
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/e423a65e/contrib/views/hive/src/test/java/org/apache/ambari/view/hive/utils/HdfsApiMock.java
----------------------------------------------------------------------
diff --git 
a/contrib/views/hive/src/test/java/org/apache/ambari/view/hive/utils/HdfsApiMock.java
 
b/contrib/views/hive/src/test/java/org/apache/ambari/view/hive/utils/HdfsApiMock.java
deleted file mode 100644
index 8eae827..0000000
--- 
a/contrib/views/hive/src/test/java/org/apache/ambari/view/hive/utils/HdfsApiMock.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you 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 org.apache.ambari.view.hive.utils;
-
-import org.apache.ambari.view.utils.hdfs.HdfsApi;
-import org.apache.ambari.view.utils.hdfs.HdfsApiException;
-import org.apache.hadoop.fs.FSDataInputStream;
-import org.apache.hadoop.fs.FSDataOutputStream;
-
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-
-import static org.easymock.EasyMock.*;
-
-/**
-* Created by roma on 2/6/15.
-*/
-public class HdfsApiMock {
-  private ByteArrayOutputStream fsQueryOutputStream;
-  private ByteArrayOutputStream fsLogsOutputStream;
-  private HdfsApi hdfsApi;
-
-  public HdfsApiMock(String inputFileContent) throws IOException, 
InterruptedException, HdfsApiException {
-    setupHdfsApi(inputFileContent);
-  }
-
-  protected void setupHdfsApi(String inputFileContent) throws IOException, 
InterruptedException, HdfsApiException {
-    hdfsApi = createNiceMock(HdfsApi.class);
-
-    hdfsApi.copy(anyString(), anyString());
-
-    fsQueryOutputStream = setupQueryOutputStream(hdfsApi);
-    fsLogsOutputStream = setupLogsOutputStream(hdfsApi);
-    setupQueryInputStream(hdfsApi, inputFileContent);
-
-    expect(hdfsApi.mkdir(anyString())).andReturn(true).anyTimes();
-  }
-
-  protected SeekableByteArrayInputStream setupQueryInputStream(HdfsApi 
hdfsApi, String query) throws IOException, InterruptedException {
-    SeekableByteArrayInputStream inputStreamHQL = new 
SeekableByteArrayInputStream(query.getBytes());
-    expect(hdfsApi.open(endsWith(".hql"))).andReturn(new 
FSDataInputStream(inputStreamHQL)).anyTimes();
-    return inputStreamHQL;
-  }
-
-  protected ByteArrayOutputStream setupQueryOutputStream(HdfsApi hdfsApi) 
throws IOException, InterruptedException {
-    ByteArrayOutputStream queryOutputStream = new ByteArrayOutputStream();
-    FSDataOutputStream fsQueryOutputStream = new 
FSDataOutputStream(queryOutputStream);
-    expect(hdfsApi.create(endsWith(".hql"), 
anyBoolean())).andReturn(fsQueryOutputStream);
-    return queryOutputStream;
-  }
-
-  protected ByteArrayOutputStream setupLogsOutputStream(HdfsApi hdfsApi) 
throws IOException, InterruptedException {
-    ByteArrayOutputStream logsOutputStream = new ByteArrayOutputStream();
-    FSDataOutputStream fsLogsOutputStream = new 
FSDataOutputStream(logsOutputStream);
-    expect(hdfsApi.create(endsWith("logs"), 
anyBoolean())).andReturn(fsLogsOutputStream).anyTimes();
-    return logsOutputStream;
-  }
-
-  public HdfsApi getHdfsApi() {
-    return hdfsApi;
-  }
-
-  public ByteArrayOutputStream getQueryOutputStream() {
-    return fsQueryOutputStream;
-  }
-
-  public ByteArrayOutputStream getLogsOutputStream() {
-    return fsLogsOutputStream;
-  }
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/e423a65e/contrib/views/hive/src/test/java/org/apache/ambari/view/hive/utils/SeekableByteArrayInputStream.java
----------------------------------------------------------------------
diff --git 
a/contrib/views/hive/src/test/java/org/apache/ambari/view/hive/utils/SeekableByteArrayInputStream.java
 
b/contrib/views/hive/src/test/java/org/apache/ambari/view/hive/utils/SeekableByteArrayInputStream.java
deleted file mode 100644
index 332dc5d..0000000
--- 
a/contrib/views/hive/src/test/java/org/apache/ambari/view/hive/utils/SeekableByteArrayInputStream.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you 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 org.apache.ambari.view.hive.utils;
-
-import org.apache.hadoop.fs.PositionedReadable;
-import org.apache.hadoop.fs.Seekable;
-
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-
-/**
-* Created by roma on 2/6/15.
-*/
-public class SeekableByteArrayInputStream extends ByteArrayInputStream
-    implements Seekable, PositionedReadable {
-  public SeekableByteArrayInputStream(byte[] buf) {
-    super(buf);
-  }
-
-  public SeekableByteArrayInputStream(byte buf[], int offset, int length) {
-    super(buf, offset, length);
-    throw new UnsupportedOperationException("Seek code assumes offset is 
zero");
-  }
-
-  public void seek(long position) {
-    if (position < 0 || position >= buf.length)
-      throw new IllegalArgumentException("pos = " + position + " buf.lenght = 
" + buf.length);
-    this.pos = (int) position;
-  }
-
-  public long getPos() {
-    return this.pos;
-  }
-
-  @Override
-  public boolean seekToNewSource(long l) throws IOException {
-    throw new UnsupportedOperationException("seekToNewSource is not 
supported");
-  }
-
-  @Override
-  public int read(long l, byte[] buffer, int offset, int length) throws 
IOException {
-    this.seek(l);
-    return this.read(buffer, offset, length);
-  }
-
-  @Override
-  public void readFully(long l, byte[] bytes, int i, int i1) throws 
IOException {
-    throw new UnsupportedOperationException("readFully is not supported");
-  }
-
-  @Override
-  public void readFully(long l, byte[] bytes) throws IOException {
-    throw new UnsupportedOperationException("readFully is not supported");
-  }
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/e423a65e/contrib/views/pom.xml
----------------------------------------------------------------------
diff --git a/contrib/views/pom.xml b/contrib/views/pom.xml
index ea426cd..b6d4176 100644
--- a/contrib/views/pom.xml
+++ b/contrib/views/pom.xml
@@ -48,7 +48,6 @@
     <module>storm</module>
     <module>hueambarimigration</module>
     <module>hive-next</module>
-    <module>hive</module>
     <module>wfmanager</module>
     <!--ambari-views-package should be last in the module list for it to 
function properly-->
     <module>ambari-views-package</module>
@@ -172,9 +171,6 @@
           <family>unix</family>
         </os>
       </activation>
-      <modules>
-        <module>hive</module>
-      </modules>
     </profile>
   </profiles>
   <dependencyManagement>

http://git-wip-us.apache.org/repos/asf/ambari/blob/e423a65e/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index aeb1467..d6418ff 100644
--- a/pom.xml
+++ b/pom.xml
@@ -318,8 +318,6 @@
             
<exclude>contrib/views/commons/src/main/resources/ui/*/vendor/**</exclude>
             
<exclude>contrib/views/commons/src/main/resources/ui/*/tests/**/public/**</exclude>
             
<exclude>contrib/views/commons/src/main/resources/ui/*/tests/**/vendor/**</exclude>
-            
<exclude>contrib/views/hive/src/main/resources/ui/hive-web/vendor/codemirror/**</exclude>
-            
<exclude>contrib/views/hive/src/main/resources/ui/hive-web/.bowerrc</exclude>
             
<exclude>contrib/views/hive-next/src/main/resources/ui/hive-web/vendor/codemirror/**</exclude>
             
<exclude>contrib/views/hive-next/src/main/resources/ui/hive-web/.bowerrc</exclude>
             
<exclude>contrib/views/files/src/main/resources/ui/.bowerrc</exclude>

Reply via email to