Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id C0B33200BFC for ; Sat, 14 Jan 2017 08:57:23 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id BF379160B35; Sat, 14 Jan 2017 07:57:23 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 590EA160B51 for ; Sat, 14 Jan 2017 08:57:21 +0100 (CET) Received: (qmail 21283 invoked by uid 500); 14 Jan 2017 07:57:20 -0000 Mailing-List: contact commits-help@carbondata.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@carbondata.incubator.apache.org Delivered-To: mailing list commits@carbondata.incubator.apache.org Received: (qmail 21274 invoked by uid 99); 14 Jan 2017 07:57:20 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 14 Jan 2017 07:57:20 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id CE22FC0A83 for ; Sat, 14 Jan 2017 07:57:19 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -6.219 X-Spam-Level: X-Spam-Status: No, score=-6.219 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, KAM_LAZY_DOMAIN_SECURITY=1, RCVD_IN_DNSWL_HI=-5, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RP_MATCHES_RCVD=-2.999] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id zpst--XDeesr for ; Sat, 14 Jan 2017 07:57:14 +0000 (UTC) Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with SMTP id 5A66B5FB7D for ; Sat, 14 Jan 2017 07:57:12 +0000 (UTC) Received: (qmail 21118 invoked by uid 99); 14 Jan 2017 07:57:11 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 14 Jan 2017 07:57:11 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 67331DFC16; Sat, 14 Jan 2017 07:57:11 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: jackylk@apache.org To: commits@carbondata.incubator.apache.org Date: Sat, 14 Jan 2017 07:57:55 -0000 Message-Id: In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [46/57] [abbrv] incubator-carbondata git commit: fix style archived-at: Sat, 14 Jan 2017 07:57:23 -0000 http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/48316190/core/src/test/java/org/apache/carbondata/core/datastorage/filesystem/LocalCarbonFileTest.java ---------------------------------------------------------------------- diff --git a/core/src/test/java/org/apache/carbondata/core/datastorage/filesystem/LocalCarbonFileTest.java b/core/src/test/java/org/apache/carbondata/core/datastorage/filesystem/LocalCarbonFileTest.java deleted file mode 100644 index 9d1ab42..0000000 --- a/core/src/test/java/org/apache/carbondata/core/datastorage/filesystem/LocalCarbonFileTest.java +++ /dev/null @@ -1,471 +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.carbondata.core.datastorage.filesystem; - -import mockit.Mock; -import mockit.MockUp; - -import org.apache.carbondata.core.datastorage.impl.FileFactory; - -import org.junit.AfterClass; -import org.junit.BeforeClass; -import org.junit.Test; -import sun.nio.ch.FileChannelImpl; - -import java.io.*; -import java.nio.channels.ReadableByteChannel; -import java.util.Objects; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - - -public class LocalCarbonFileTest { - - private static LocalCarbonFile localCarbonFile; - private static File file; - private static File dir; - private static FileOutputStream oFile; - - @BeforeClass - static public void setUp() { - file = new File("Test.carbondata"); - dir = new File("Testdir.carbondata"); - if (!file.exists()) - try { - file.createNewFile(); - dir.mkdir(); - } catch (IOException e) { - e.printStackTrace(); - } - try { - oFile = new FileOutputStream(file, true); - - - byte[] bytes = "core java api".getBytes(); - - oFile.write(bytes); - } catch (FileNotFoundException e) { - e.printStackTrace(); - localCarbonFile = new LocalCarbonFile(file); - } catch (IOException e) { - e.printStackTrace(); - } - } - - @AfterClass - static public void cleanUp() { - file.delete(); - dir.delete(); - - } - - @Test - public void testListFilesWithCarbonFileFilterAndWithOutOutDirectoryPermission() { - CarbonFileFilter carbonFileFilter = new CarbonFileFilter() { - @Override - public boolean accept(CarbonFile file) { - return false; - } - }; - new MockUp() { - @Mock - public boolean isDirectory() { - return false; - } - - - }; - assertTrue(localCarbonFile.listFiles(carbonFileFilter) == null); - } - - @Test - public void testListFilesWithOutDirPermission() { - localCarbonFile = new LocalCarbonFile(file); - new MockUp() { - @Mock - public boolean isDirectory() { - return false; - } - }; - assertTrue(localCarbonFile.listFiles() == null); - } - - @Test - public void testCreateNewFileForException() throws IOException { - localCarbonFile = new LocalCarbonFile(new File("")); - assertTrue(!localCarbonFile.createNewFile()); - } - - @Test - public void testCheckIfFileExists() throws IOException { - localCarbonFile = new LocalCarbonFile(new File("")); - assertTrue(!localCarbonFile.exists()); - } - - @Test - public void testRenameForce() { - localCarbonFile = new LocalCarbonFile(file); - assertTrue(localCarbonFile.renameForce("Testdb.carbon")); - File file1 = new File("Testdb.carbon"); - if (file1.exists()) { - file1.delete(); - } - } - - @Test - public void testRenameTo() { - localCarbonFile = new LocalCarbonFile(file); - assertTrue(!localCarbonFile.renameTo("Testdb.carbon")); - } - - @Test - public void testsetLastModifiedTime() { - localCarbonFile = new LocalCarbonFile(file); - assertTrue(!localCarbonFile.setLastModifiedTime(50L)); - } - - @Test - public void testtruncate() { - localCarbonFile = new LocalCarbonFile(file); - final int[] counter = {0}; - new MockUp() { - @Mock - public FileFactory.FileType getFileType(String path) { - { - return FileFactory.FileType.LOCAL; - } - } - }; - new MockUp() { - @Mock - public boolean isFileExist(String filePath, FileFactory.FileType fileType) throws IOException { - { - return true; - } - } - }; - new MockUp() { - @Mock - boolean delete() { - return true; - } - }; - new MockUp() { - @Mock - public boolean createNewFile(String filePath, FileFactory.FileType fileType) throws IOException { - { - return true; - } - } - }; - new MockUp() { - @Mock - public CarbonFile getCarbonFile(String path, FileFactory.FileType fileType) { - { - return new LocalCarbonFile(path); - } - } - }; - new MockUp() { - @Mock - boolean delete() { - return true; - } - }; - - new MockUp() { - @Mock - public long transferFrom(ReadableByteChannel var1, long var2, long var4) throws IOException { - if (counter[0] == 0) { - counter[0] = counter[0] + 1; - return 0L; - } else { - return 1L; - } - } - }; - new MockUp() { - @Mock - boolean renameForce(String changetoName) { - return true; - } - }; - localCarbonFile = new LocalCarbonFile(file); - assertTrue(localCarbonFile.truncate(file.getName(), 1L)); - } - - @Test - public void testtruncateForException() throws IOException { - localCarbonFile = new LocalCarbonFile(file); - new MockUp() { - @Mock - public FileFactory.FileType getFileType(String path) { - { - return FileFactory.FileType.LOCAL; - } - } - }; - new MockUp() { - @Mock - public boolean isFileExist(String filePath, FileFactory.FileType fileType) throws IOException { - { - return true; - } - } - }; - new MockUp() { - @Mock - public CarbonFile getCarbonFile(String path, FileFactory.FileType fileType) { - { - return new LocalCarbonFile(path); - } - } - }; - new MockUp() { - @Mock - boolean delete() { - return true; - } - }; - new MockUp() { - @Mock - public boolean createNewFile(String filePath, FileFactory.FileType fileType) throws IOException { - { - throw new IOException(); - } - } - }; - - - localCarbonFile.truncate(file.getName(), 2L); - } - - @Test - public void testListFilesWithDirPermission() { - localCarbonFile = new LocalCarbonFile(file); - new MockUp() { - @Mock - public boolean isDirectory() { - return true; - } - }; - new MockUp() { - @Mock - public File[] listFiles() { - return null; - } - - - }; - localCarbonFile = new LocalCarbonFile(dir); - assertTrue(localCarbonFile.listFiles().length == 0); - } - - @Test - public void testListFilesWithCarbonFileFilterAndDirectoryPermission() { - CarbonFileFilter carbonFileFilter = new CarbonFileFilter() { - @Override - public boolean accept(CarbonFile file) { - return true; - } - }; - new MockUp() { - @Mock - public boolean isDirectory() { - return true; - } - }; - new MockUp() { - @Mock - public File[] listFiles(FileFilter filter) { - - File[] file = new File[]{dir}; - return file; - } - - - }; - - localCarbonFile = new LocalCarbonFile(dir); - - assertTrue(localCarbonFile.listFiles(carbonFileFilter).length == 1); - } - - @Test - public void testListFilesForNullWithCarbonFileFilterAndDirectoryPermission() { - CarbonFileFilter carbonFileFilter = new CarbonFileFilter() { - @Override - public boolean accept(CarbonFile file) { - return true; - } - }; - new MockUp() { - @Mock - public File[] listFiles(FileFilter filter) { - return null; - } - - - }; - new MockUp() { - @Mock - public boolean isDirectory() { - return false; - } - - @Mock - public File[] listFiles(FileFilter filter) { - return null; - } - - - }; - localCarbonFile = new LocalCarbonFile(dir); - - assertTrue(localCarbonFile.listFiles(carbonFileFilter) == null); - } - - @Test - public void testListFilesForEmptyFileArrayWithCarbonFileFilter() { - CarbonFileFilter carbonFileFilter = new CarbonFileFilter() { - @Override - public boolean accept(CarbonFile file) { - return true; - } - }; - new MockUp() { - @Mock - boolean accept(CarbonFile file) { - return true; - } - }; - new MockUp() { - @Mock - public File[] listFiles(FileFilter filter) { - return null; - } - }; - new MockUp() { - @Mock - public boolean isDirectory() { - return true; - } - - @Mock - public File[] listFiles(FileFilter filter) { - return null; - } - }; - localCarbonFile = new LocalCarbonFile(dir); - - assertTrue(localCarbonFile.listFiles(carbonFileFilter).length == 0); - } - - @Test - public void testFilesForConnicalPath() { - - new MockUp() { - @Mock - public String getCanonicalPath() throws IOException { - return "testFile"; - } - - - }; - localCarbonFile = new LocalCarbonFile(dir); - - assertTrue(Objects.equals(localCarbonFile.getCanonicalPath(), "testFile")); - } - - @Test - public void testFilesForConnicalPathException() throws IOException { - - new MockUp() { - @Mock - public String getCanonicalPath() throws IOException { - throw new IOException(); - } - - - }; - localCarbonFile = new LocalCarbonFile(dir); - - localCarbonFile.getCanonicalPath(); - } - - @Test - public void testFilesForAbsolutePath() { - - new MockUp() { - @Mock - public String getAbsolutePath() { - return "testFile"; - } - - - }; - localCarbonFile = new LocalCarbonFile(dir); - - assertEquals(localCarbonFile.getAbsolutePath(), "testFile"); - } - - @Test - public void testFilesForGetPath() { - - new MockUp() { - @Mock - public String getPath() { - return "testFile"; - } - - - }; - localCarbonFile = new LocalCarbonFile(dir); - - assertEquals(localCarbonFile.getPath(), "testFile"); - } - - @Test - public void testFilesForFileExists() { - - localCarbonFile = new LocalCarbonFile(new File("")); - assertEquals(localCarbonFile.exists(), false); - } - - @Test - public void testRenameForceForFileNotExists() { - new MockUp() { - @Mock - public boolean exists() { - return false; - } - - @Mock - public boolean renameTo(File dest) { - return true; - } - }; - - localCarbonFile = new LocalCarbonFile("demo.txt"); - - assertEquals(localCarbonFile.renameForce("Test.carbondata"), true); - } -} http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/48316190/core/src/test/java/org/apache/carbondata/core/datastorage/filesystem/ViewFsCarbonFileTest.java ---------------------------------------------------------------------- diff --git a/core/src/test/java/org/apache/carbondata/core/datastorage/filesystem/ViewFsCarbonFileTest.java b/core/src/test/java/org/apache/carbondata/core/datastorage/filesystem/ViewFsCarbonFileTest.java deleted file mode 100644 index 9cdef3a..0000000 --- a/core/src/test/java/org/apache/carbondata/core/datastorage/filesystem/ViewFsCarbonFileTest.java +++ /dev/null @@ -1,311 +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.carbondata.core.datastorage.filesystem; - -import mockit.Mock; -import mockit.MockUp; -import org.apache.hadoop.conf.Configuration; -import org.apache.hadoop.fs.FileStatus; -import org.apache.hadoop.fs.FileSystem; -import org.apache.hadoop.fs.Path; -import org.apache.hadoop.fs.viewfs.ViewFileSystem; -import org.apache.hadoop.hdfs.DistributedFileSystem; -import org.apache.hadoop.hdfs.web.WebHdfsFileSystem; -import org.junit.AfterClass; -import org.junit.BeforeClass; -import org.junit.Test; - -import java.io.File; -import java.io.FileNotFoundException; -import java.io.FileOutputStream; -import java.io.IOException; - -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; - - -public class ViewFsCarbonFileTest { - - private static ViewFSCarbonFile viewFSCarbonFile; - private static FileStatus fileStatus; - private static FileStatus fileStatusWithOutDirectoryPermission; - private static String fileName; - private static File file; - - - @BeforeClass - static public void setUp() { - file = new File("Test.carbondata"); - if (!file.exists()) - try { - file.createNewFile(); - } catch (IOException e) { - e.printStackTrace(); - } - try { - FileOutputStream oFile = new FileOutputStream(file, true); - } catch (FileNotFoundException e) { - e.printStackTrace(); - } - - fileStatus = new FileStatus(12L, true, 60, 120l, 180L, new Path(file.getAbsolutePath())); - fileStatusWithOutDirectoryPermission = new FileStatus(12L, false, 60, 120l, 180L, new Path(file.getAbsolutePath())); - fileName = file.getAbsolutePath(); - viewFSCarbonFile = new ViewFSCarbonFile(fileStatus); - } - - @AfterClass - static public void cleanUp() { - file.delete(); - } - - @Test - public void testRenameForceForException() throws IOException { - - new MockUp() { - @Mock - public FileSystem getFileSystem(Configuration conf) throws IOException { - throw new IOException(); - } - - }; - viewFSCarbonFile = new ViewFSCarbonFile(fileStatus); - viewFSCarbonFile.renameForce(fileName); - } - - @Test - public void testListFilesWithOutDirectoryPermission() { - viewFSCarbonFile = new ViewFSCarbonFile(fileStatusWithOutDirectoryPermission); - assertTrue(viewFSCarbonFile.listFiles() == null); - } - - @Test - public void testConstructorWithFilePath() { - viewFSCarbonFile = new ViewFSCarbonFile(file.getAbsolutePath()); - assertTrue(viewFSCarbonFile instanceof ViewFSCarbonFile); - } - - @Test - public void testListFilesForNullListStatus() { - viewFSCarbonFile = new ViewFSCarbonFile(fileStatusWithOutDirectoryPermission); - new MockUp() { - @Mock - public FileSystem getFileSystem(Configuration conf) throws IOException { - return new ViewFileSystem(); - } - - }; - new MockUp() { - @Mock - public FileStatus[] listStatus(Path var1) throws IOException { - - return null; - } - - }; - new MockUp() { - @Mock - public boolean delete(Path var1, boolean var2) throws IOException { - - return true; - } - - }; - //public boolean delete(Path var1, boolean var2) throws IOException; - viewFSCarbonFile = new ViewFSCarbonFile(fileStatus); - assertTrue(viewFSCarbonFile.listFiles().length == 0); - } - - @Test - public void testListDirectory() { - viewFSCarbonFile = new ViewFSCarbonFile(fileStatus); - new MockUp() { - @Mock - public FileSystem getFileSystem(Configuration conf) throws IOException { - return new ViewFileSystem(); - } - - }; - new MockUp() { - @Mock - public FileStatus[] listStatus(Path var1) throws IOException { - - FileStatus[] fileStatus = new FileStatus[]{new FileStatus(12L, true, 60, 120l, 180L, new Path(fileName))}; - return fileStatus; - } - - }; - - assertTrue(viewFSCarbonFile.listFiles().length == 1); - } - - @Test - public void testListFilesForException() throws IOException { - viewFSCarbonFile = new ViewFSCarbonFile(fileStatusWithOutDirectoryPermission); - - new MockUp() { - @Mock - public Path getPath() { - return new Path(file.getAbsolutePath()); - } - - }; - new MockUp() { - @Mock - public FileSystem getFileSystem(Configuration conf) throws IOException { - throw new IOException(); - } - - }; - new MockUp() { - @Mock - public FileStatus[] listStatus(Path var1) throws IOException { - - throw new IOException(); - } - - }; - viewFSCarbonFile = new ViewFSCarbonFile(fileStatus); - viewFSCarbonFile.listFiles(); - } - - @Test - public void testListFilesWithCarbonFilter() { - CarbonFileFilter carbonFileFilter = new CarbonFileFilter() { - - @Override - public boolean accept(CarbonFile file) { - return true; - } - }; - viewFSCarbonFile = new ViewFSCarbonFile(fileStatus); - assertTrue(viewFSCarbonFile.listFiles(carbonFileFilter).length == 1); - } - - @Test - public void testlistFilesWithoutFilter() { - CarbonFileFilter carbonFileFilter = new CarbonFileFilter() { - - @Override - public boolean accept(CarbonFile file) { - return false; - } - }; - new MockUp() { - @Mock - public FileSystem getFileSystem(Configuration conf) throws IOException { - return new ViewFileSystem(); - } - - }; - new MockUp() { - @Mock - public FileStatus[] listStatus(Path var1) throws IOException { - - FileStatus[] fileStatus = new FileStatus[]{new FileStatus(12L, true, 60, 120l, 180L, new Path(fileName))}; - return fileStatus; - } - - }; - viewFSCarbonFile = new ViewFSCarbonFile(fileStatus); - assertTrue(viewFSCarbonFile.listFiles(carbonFileFilter).length == 0); - } - - @Test - public void testGetParentFIle() { - new MockUp() { - @Mock - public FileSystem getFileSystem(Configuration conf) throws IOException { - return new DistributedFileSystem(); - } - - }; - new MockUp() { - @Mock - public Path getParent() { - return new Path(file.getAbsolutePath() - ); - } - - }; - new MockUp() { - @Mock - public Path getPath() { - return new Path(file.getAbsolutePath()); - } - - }; - new MockUp() { - @Mock - public FileStatus getFileStatus(Path f) throws IOException { - - return new FileStatus(12L, true, 60, 120l, 180L, new Path(file.getAbsolutePath())); - } - - }; - - viewFSCarbonFile = new ViewFSCarbonFile(fileStatus); - assertFalse(viewFSCarbonFile.getParentFile().equals(null)); - } - - @Test - public void testForNonDisributedSystem() { - viewFSCarbonFile = new ViewFSCarbonFile(fileStatus); - new MockUp() { - @Mock - public FileSystem getFileSystem(Configuration conf) throws IOException { - return new WebHdfsFileSystem(); - } - - }; - assertFalse(viewFSCarbonFile.renameForce(fileName)); - } - - @Test - public void testrenameForceForViewFileSystem() { - new MockUp() { - @Mock - public FileSystem getFileSystem(Configuration conf) throws IOException { - return new ViewFileSystem(); - } - - }; - new MockUp() { - @Mock - public boolean delete(Path f, boolean recursive) throws - IOException { - return true; - - } - - }; - new MockUp() { - @Mock - public boolean rename(Path src, Path dst) throws IOException { - return true; - - } - - }; - - assertTrue(viewFSCarbonFile.renameForce(fileName)); - - } -} http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/48316190/core/src/test/java/org/apache/carbondata/core/datastore/chunk/reader/measure/CompressedMeasureChunkFileBasedReaderTest.java ---------------------------------------------------------------------- diff --git a/core/src/test/java/org/apache/carbondata/core/datastore/chunk/reader/measure/CompressedMeasureChunkFileBasedReaderTest.java b/core/src/test/java/org/apache/carbondata/core/datastore/chunk/reader/measure/CompressedMeasureChunkFileBasedReaderTest.java index 29fe16d..e723ac7 100644 --- a/core/src/test/java/org/apache/carbondata/core/datastore/chunk/reader/measure/CompressedMeasureChunkFileBasedReaderTest.java +++ b/core/src/test/java/org/apache/carbondata/core/datastore/chunk/reader/measure/CompressedMeasureChunkFileBasedReaderTest.java @@ -5,11 +5,11 @@ import java.math.BigDecimal; import java.util.ArrayList; import java.util.List; -import org.apache.carbondata.core.datastorage.FileHolder; -import org.apache.carbondata.core.datastorage.compression.MeasureMetaDataModel; -import org.apache.carbondata.core.datastorage.compression.WriterCompressModel; -import org.apache.carbondata.core.datastorage.dataholder.CarbonWriteDataHolder; -import org.apache.carbondata.core.datastorage.impl.data.compressed +import org.apache.carbondata.core.datastore.FileHolder; +import org.apache.carbondata.core.datastore.compression.MeasureMetaDataModel; +import org.apache.carbondata.core.datastore.compression.WriterCompressModel; +import org.apache.carbondata.core.datastore.dataholder.CarbonWriteDataHolder; +import org.apache.carbondata.core.datastore.impl.data.compressed .HeavyCompressedDoubleArrayDataInMemoryStore; import org.apache.carbondata.core.datastore.chunk.MeasureColumnDataChunk; import org.apache.carbondata.core.datastore.chunk.reader.measure http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/48316190/core/src/test/java/org/apache/carbondata/core/datastore/columnar/ColumnarKeyStoreDataHolderUnitTest.java ---------------------------------------------------------------------- diff --git a/core/src/test/java/org/apache/carbondata/core/datastore/columnar/ColumnarKeyStoreDataHolderUnitTest.java b/core/src/test/java/org/apache/carbondata/core/datastore/columnar/ColumnarKeyStoreDataHolderUnitTest.java new file mode 100644 index 0000000..132b3a9 --- /dev/null +++ b/core/src/test/java/org/apache/carbondata/core/datastore/columnar/ColumnarKeyStoreDataHolderUnitTest.java @@ -0,0 +1,93 @@ +/* + * 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.carbondata.core.datastore.columnar; + +import java.util.List; + +import org.junit.BeforeClass; +import org.junit.Test; + +import static org.junit.Assert.assertEquals; + +public class ColumnarKeyStoreDataHolderUnitTest { + + private static ColumnarKeyStoreDataHolder columnarKeyStoreDataHolder; + private static ColumnarKeyStoreMetadata columnarKeyStoreMetadata; + + @BeforeClass public static void setup() { + byte[] keyBlockData = new byte[] { 16, 8, 32, 40, 8, 8, 8 }; + int eachRowSize = 2; + int[] reverseIndex = new int[] { 1, 5, 6, 3, 8 }; + columnarKeyStoreMetadata = new ColumnarKeyStoreMetadata(eachRowSize); + columnarKeyStoreMetadata.setColumnReverseIndex(reverseIndex); + columnarKeyStoreDataHolder = + new ColumnarKeyStoreDataHolder(keyBlockData, columnarKeyStoreMetadata); + } + + @Test public void testGetSurrogateKeyWithNullINGetColumnReverseIndex() { + byte[] keyBlockData = new byte[] { 16, 8, 32, 40, 8, 8, 8 }; + int eachRowSize = 1; + ColumnarKeyStoreMetadata columnarKeyStoreMetadata = new ColumnarKeyStoreMetadata(eachRowSize); + ColumnarKeyStoreDataHolder columnarKeyStoreDataHolderNew = + new ColumnarKeyStoreDataHolder(keyBlockData, columnarKeyStoreMetadata); + int columnIndex = 5; + int expected_result = 8; + int result = columnarKeyStoreDataHolderNew.getSurrogateKey(columnIndex); + assertEquals(expected_result, result); + } + + @Test public void testGetSurrogateKeyWithNullINGetColumnReverseIndexAndRowSizeTwo() { + byte[] keyBlockData = new byte[] { 16, 8, 32, 40, 8, 8, 8 }; + int eachRowSize = 2; + ColumnarKeyStoreMetadata columnarKeyStoreMetadata = new ColumnarKeyStoreMetadata(eachRowSize); + ColumnarKeyStoreDataHolder columnarKeyStoreDataHolderNew = + new ColumnarKeyStoreDataHolder(keyBlockData, columnarKeyStoreMetadata); + int columnIndex = 0; + int expected_result = 4104; + int result = columnarKeyStoreDataHolderNew.getSurrogateKey(columnIndex); + assertEquals(expected_result, result); + } + + @Test public void testGetSurrogateKeyWithNotNullINGetColumnReverseIndex() { + int columnIndex = 0; + int expected_result = 8232; + int result = columnarKeyStoreDataHolder.getSurrogateKey(columnIndex); + assertEquals(expected_result, result); + } + + @Test(expected = ArrayIndexOutOfBoundsException.class) + public void testExceptionInGetSurrogateKey() { + int columnIndex = 10; + int expected_result = 8232; + int result = columnarKeyStoreDataHolder.getSurrogateKey(columnIndex); + assertEquals(expected_result, result); + } + + @Test public void testGetSurrogateKeyWithListOfByteWhileCreatingObject() { + byte[] keyBlockData = new byte[] { 32, 64, 32, 40, 64, 8, 8 }; + List noDictionaryValBasedKeyBlockData = new java.util.ArrayList<>(); + noDictionaryValBasedKeyBlockData.add(keyBlockData); + new ColumnarKeyStoreDataHolder(columnarKeyStoreMetadata); + int columnIndex = 0; + int expected_result = 8232; + int result = columnarKeyStoreDataHolder.getSurrogateKey(columnIndex); + assertEquals(expected_result, result); + } + +} http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/48316190/core/src/test/java/org/apache/carbondata/core/datastore/filesystem/AlluxioCarbonFileTest.java ---------------------------------------------------------------------- diff --git a/core/src/test/java/org/apache/carbondata/core/datastore/filesystem/AlluxioCarbonFileTest.java b/core/src/test/java/org/apache/carbondata/core/datastore/filesystem/AlluxioCarbonFileTest.java new file mode 100644 index 0000000..aada6f8 --- /dev/null +++ b/core/src/test/java/org/apache/carbondata/core/datastore/filesystem/AlluxioCarbonFileTest.java @@ -0,0 +1,292 @@ +/* + * 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.carbondata.core.datastore.filesystem; + +import mockit.Mock; +import mockit.MockUp; +import org.apache.hadoop.conf.Configuration; +import org.apache.hadoop.fs.FileStatus; +import org.apache.hadoop.fs.FileSystem; +import org.apache.hadoop.fs.Options; +import org.apache.hadoop.fs.Path; +import org.apache.hadoop.hdfs.DistributedFileSystem; +import org.apache.hadoop.hdfs.web.WebHdfsFileSystem; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; + +import java.io.File; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.IOException; + +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +public class AlluxioCarbonFileTest { + + private static AlluxioCarbonFile alluxioCarbonFile; + private static FileStatus fileStatus; + private static FileStatus fileStatusWithOutDirectoryPermission; + private static String fileName; + private static File file; + + + @BeforeClass + static public void setUp() { + file = new File("Test.carbondata"); + if (!file.exists()) + try { + file.createNewFile(); + } catch (IOException e) { + e.printStackTrace(); + } + try { + FileOutputStream oFile = new FileOutputStream(file, true); + } catch (FileNotFoundException e) { + e.printStackTrace(); + } + + fileStatus = new FileStatus(12L, true, 60, 120l, 180L, new Path(file.getAbsolutePath())); + fileStatusWithOutDirectoryPermission = new FileStatus(12L, false, 60, 120l, 180L, new Path(file.getAbsolutePath())); + fileName = file.getAbsolutePath(); + alluxioCarbonFile = new AlluxioCarbonFile(fileStatus); + } + + @AfterClass + static public void cleanUp() { + file.delete(); + } + + @Test + public void testRenameForceForException() throws IOException { + + new MockUp() { + @Mock + public FileSystem getFileSystem(Configuration conf) throws IOException { + throw new IOException(); + } + + }; + alluxioCarbonFile = new AlluxioCarbonFile(fileStatus); + alluxioCarbonFile.renameForce(fileName); + } + + @Test + public void testListFilesWithOutDirectoryPermission() { + alluxioCarbonFile = new AlluxioCarbonFile(fileStatusWithOutDirectoryPermission); + assertTrue(alluxioCarbonFile.listFiles() == null); + } + + @Test + public void testConstructorWithFilePath() { + alluxioCarbonFile = new AlluxioCarbonFile(file.getAbsolutePath()); + assertTrue(alluxioCarbonFile instanceof AlluxioCarbonFile); + } + + @Test + public void testListFilesForNullListStatus() { + alluxioCarbonFile = new AlluxioCarbonFile(fileStatusWithOutDirectoryPermission); + new MockUp() { + @Mock + public FileSystem getFileSystem(Configuration conf) throws IOException { + return new DistributedFileSystem(); + } + + }; + new MockUp() { + @Mock + public FileStatus[] listStatus(Path var1) throws IOException { + + return null; + } + + }; + alluxioCarbonFile = new AlluxioCarbonFile(fileStatus); + assertTrue(alluxioCarbonFile.listFiles().length == 0); + } + + @Test + public void testListDirectory() { + alluxioCarbonFile = new AlluxioCarbonFile(fileStatus); + new MockUp() { + @Mock + public FileSystem getFileSystem(Configuration conf) throws IOException { + return new DistributedFileSystem(); + } + + }; + new MockUp() { + @Mock + public FileStatus[] listStatus(Path var1) throws IOException { + + FileStatus[] fileStatus = new FileStatus[]{new FileStatus(12L, true, 60, 120l, 180L, new Path(fileName))}; + return fileStatus; + } + + }; + + assertTrue(alluxioCarbonFile.listFiles().length == 1); + } + + @Test + public void testListFilesForException() throws IOException { + alluxioCarbonFile = new AlluxioCarbonFile(fileStatusWithOutDirectoryPermission); + + new MockUp() { + @Mock + public Path getPath() { + return new Path(file.getAbsolutePath()); + } + + }; + new MockUp() { + @Mock + public FileSystem getFileSystem(Configuration conf) throws IOException { + throw new IOException(); + } + + }; + new MockUp() { + @Mock + public FileStatus[] listStatus(Path var1) throws IOException { + + throw new IOException(); + } + + }; + alluxioCarbonFile = new AlluxioCarbonFile(fileStatus); + alluxioCarbonFile.listFiles(); + } + + @Test + public void testListFilesWithCarbonFilter() { + CarbonFileFilter carbonFileFilter = new CarbonFileFilter() { + + @Override + public boolean accept(CarbonFile file) { + return true; + } + }; + alluxioCarbonFile = new AlluxioCarbonFile(fileStatus); + assertTrue(alluxioCarbonFile.listFiles(carbonFileFilter).length == 1); + } + + @Test + public void testlistFilesWithoutFilter() { + CarbonFileFilter carbonFileFilter = new CarbonFileFilter() { + + @Override + public boolean accept(CarbonFile file) { + return false; + } + }; + new MockUp() { + @Mock + public FileSystem getFileSystem(Configuration conf) throws IOException { + return new DistributedFileSystem(); + } + + }; + new MockUp() { + @Mock + public FileStatus[] listStatus(Path var1) throws IOException { + + FileStatus[] fileStatus = new FileStatus[]{new FileStatus(12L, true, 60, 120l, 180L, new Path(fileName))}; + return fileStatus; + } + + }; + alluxioCarbonFile = new AlluxioCarbonFile(fileStatus); + assertTrue(alluxioCarbonFile.listFiles(carbonFileFilter).length == 0); + } + + @Test + public void testGetParentFile() { + new MockUp() { + @Mock + public FileSystem getFileSystem(Configuration conf) throws IOException { + return new DistributedFileSystem(); + } + + }; + new MockUp() { + @Mock + public Path getParent() { + return new Path(file.getAbsolutePath() + ); + } + + }; + new MockUp() { + @Mock + public Path getPath() { + return new Path(file.getAbsolutePath()); + } + + }; + new MockUp() { + @Mock + public FileStatus getFileStatus(Path path) throws IOException { + + return new FileStatus(12L, true, 60, 120l, 180L, new Path(file.getAbsolutePath())); + } + + }; + + alluxioCarbonFile = new AlluxioCarbonFile(fileStatus); + assertFalse(alluxioCarbonFile.getParentFile().equals(null)); + } + + @Test + public void testForNonDisributedSystem() { + alluxioCarbonFile = new AlluxioCarbonFile(fileStatus); + new MockUp() { + @Mock + public FileSystem getFileSystem(Configuration conf) throws IOException { + return new WebHdfsFileSystem(); + } + + }; + assertFalse(alluxioCarbonFile.renameForce(fileName)); + } + + @Test + public void testrenameForceForDisributedSystem() { + new MockUp() { + @Mock + public FileSystem getFileSystem(Configuration conf) throws IOException { + return new DistributedFileSystem(); + } + + }; + new MockUp() { + @Mock + public void rename(Path src, Path dst, final Options.Rename... options) throws IOException { + + } + + }; + + alluxioCarbonFile = new AlluxioCarbonFile(fileStatus); + assertTrue(alluxioCarbonFile.renameForce(fileName)); + + } +} http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/48316190/core/src/test/java/org/apache/carbondata/core/datastore/filesystem/HDFSCarbonFileTest.java ---------------------------------------------------------------------- diff --git a/core/src/test/java/org/apache/carbondata/core/datastore/filesystem/HDFSCarbonFileTest.java b/core/src/test/java/org/apache/carbondata/core/datastore/filesystem/HDFSCarbonFileTest.java new file mode 100644 index 0000000..a85280a --- /dev/null +++ b/core/src/test/java/org/apache/carbondata/core/datastore/filesystem/HDFSCarbonFileTest.java @@ -0,0 +1,400 @@ +/* + * 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.carbondata.core.datastore.filesystem; + +import mockit.Mock; +import mockit.MockUp; +import org.apache.carbondata.common.logging.LogService; +import org.apache.carbondata.common.logging.LogServiceFactory; + +import org.apache.hadoop.conf.Configuration; +import org.apache.hadoop.fs.FileStatus; +import org.apache.hadoop.fs.FileSystem; +import org.apache.hadoop.fs.Options; +import org.apache.hadoop.fs.Path; +import org.apache.hadoop.hdfs.DistributedFileSystem; +import org.apache.hadoop.hdfs.web.WebHdfsFileSystem; +import org.apache.hadoop.util.Progressable; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; + +import java.io.BufferedWriter; +import java.io.IOException; +import java.io.OutputStream; +import java.io.OutputStreamWriter; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + + +public class HDFSCarbonFileTest { + + private static final LogService LOGGER = + LogServiceFactory.getLogService(HDFSCarbonFile.class.getName()); + private static HDFSCarbonFile hdfsCarbonFile; + private static FileStatus fileStatus = null; + private static FileStatus fileStatusWithOutDirectoryPermission; + private static String fileName = null; + private static FileSystem fs = null; + private static Path pt; + + @BeforeClass + static public void setUp() throws IOException { + Configuration config = new Configuration(); +//adding local hadoop configuration + config.addResource(new Path("core-site.xml")); + config.addResource(new Path("hdfs-site.xml")); + fileName = "Test.carbondata"; //this path is HDFS path + pt = new Path(fileName); + fs = FileSystem.get(new Configuration(config)); + fs.create(pt); + if (fs.exists(pt)) { + OutputStream os = fs.create(pt, + new Progressable() { + public void progress() { + LOGGER.info("Started Writing to File==="); + } + }); + BufferedWriter br = new BufferedWriter(new OutputStreamWriter(os, "UTF-8")); + br.write("Hello World"); + br.close(); + fs.close(); + + fileStatus = new FileStatus(12L, true, 60, 120l, 180L, new Path(fileName)); + fileStatusWithOutDirectoryPermission = new FileStatus(12L, false, 60, 120l, 180L, new Path(fileName)); + hdfsCarbonFile = new HDFSCarbonFile(fileStatus); + + } + } + + @AfterClass + static public void cleanUp() { + try { + fs.delete(pt, true); + } catch (IOException e) { + LOGGER.error("Exception Occured" + e.getMessage()); + } + } + + @Test + public void testRenameForceForException() throws IOException { + + new MockUp() { + @Mock + public FileSystem getFileSystem(Configuration conf) throws IOException { + throw new IOException(); + } + + }; + hdfsCarbonFile = new HDFSCarbonFile(fileStatus); + hdfsCarbonFile.renameForce(fileName); + } + + @Test + public void testListFilesWithOutDirectoryPermission() { + hdfsCarbonFile = new HDFSCarbonFile(fileStatusWithOutDirectoryPermission); + new MockUp() { + @Mock + public boolean isDirectory() { + return false; + } + + }; + + new MockUp() { + @Mock + public FileSystem getFileSystem(Configuration conf) throws IOException { + return new DistributedFileSystem(); + } + + }; + + new MockUp() { + @Mock + public Path getPath() { + return new Path(fileName); + } + + }; + assertEquals(hdfsCarbonFile.listFiles(), null); + } + + @Test + public void testConstructorWithFilePath() { + hdfsCarbonFile = new HDFSCarbonFile(fileName); + assertTrue(hdfsCarbonFile instanceof HDFSCarbonFile); + } + + @Test + public void testListFilesForNullListStatus() { + new MockUp() { + @Mock + public FileSystem getFileSystem(Configuration conf) throws IOException { + return new DistributedFileSystem(); + } + + }; + new MockUp() { + @Mock + public FileStatus[] listStatus(Path var1) throws IOException { + + return null; + } + + }; + hdfsCarbonFile = new HDFSCarbonFile(fileStatus); + assertEquals(hdfsCarbonFile.listFiles().length, 0); + } + + @Test + public void testListDirectory() { + hdfsCarbonFile = new HDFSCarbonFile(fileStatus); + new MockUp() { + @Mock + public FileSystem getFileSystem(Configuration conf) throws IOException { + return new DistributedFileSystem(); + } + + }; + new MockUp() { + @Mock + public FileStatus[] listStatus(Path var1) throws IOException { + + FileStatus[] fileStatus = new FileStatus[]{new FileStatus(12L, true, 60, 120l, 180L, new Path(fileName))}; + return fileStatus; + } + + }; + + assertEquals(hdfsCarbonFile.listFiles().length, 1); + } + + @Test + public void testListFilesForException() throws IOException { + new HDFSCarbonFile(fileStatusWithOutDirectoryPermission); + + new MockUp() { + @Mock + public Path getPath() { + return new Path(fileName); + } + + }; + new MockUp() { + @Mock + public FileSystem getFileSystem(Configuration conf) throws IOException { + throw new IOException(); + } + + }; + new MockUp() { + @Mock + public FileStatus[] listStatus(Path var1) throws IOException { + + throw new IOException(); + } + + }; + hdfsCarbonFile = new HDFSCarbonFile(fileStatus); + hdfsCarbonFile.listFiles(); + } + + @Test + public void testListFilesWithCarbonFilter() { + CarbonFileFilter carbonFileFilter = new CarbonFileFilter() { + + @Override + public boolean accept(CarbonFile file) { + return true; + } + }; + new MockUp() { + @Mock + public boolean isDirectory() { + return true; + } + + }; + + new MockUp() { + @Mock + public FileSystem getFileSystem(Configuration conf) throws IOException { + return new DistributedFileSystem(); + } + + }; + + new MockUp() { + @Mock + public Path getPath() { + return new Path(fileName); + } + + }; + new MockUp() { + @Mock + public FileStatus[] listStatus(Path var1) throws IOException { + + FileStatus fileStatus[] = new FileStatus[]{new FileStatus(12L, true, 60, 120l, 180L, new Path(fileName))}; + return fileStatus; + } + + }; + hdfsCarbonFile = new HDFSCarbonFile(fileStatus); + assertEquals(hdfsCarbonFile.listFiles(carbonFileFilter).length, 1); + } + + @Test + public void testlistFilesWithoutFilter() { + CarbonFileFilter carbonFileFilter = new CarbonFileFilter() { + + @Override + public boolean accept(CarbonFile file) { + return false; + } + }; + new MockUp() { + @Mock + public FileSystem getFileSystem(Configuration conf) throws IOException { + return new DistributedFileSystem(); + } + + }; + new MockUp() { + @Mock + public FileStatus[] listStatus(Path var1) throws IOException { + + FileStatus[] fileStatus = new FileStatus[]{new FileStatus(12L, true, 60, 120l, 180L, new Path(fileName))}; + return fileStatus; + } + + }; + hdfsCarbonFile = new HDFSCarbonFile(fileStatus); + assertEquals(hdfsCarbonFile.listFiles(carbonFileFilter).length, 0); + } + + @Test + public void testGetParentFileForNull() { + + new MockUp() { + @Mock + public Path getParent() { + return null; + } + + }; + new MockUp() { + @Mock + public Path getPath() { + return new Path(fileName); + } + + }; + new MockUp() { + @Mock + public FileSystem getFileSystem(Configuration conf) throws IOException { + return new DistributedFileSystem(); + } + + }; + + new MockUp() { + @Mock + public Path getPath() { + return new Path(fileName); + } + + }; + hdfsCarbonFile = new HDFSCarbonFile(fileStatus); + assertEquals(hdfsCarbonFile.getParentFile(), null); + } + + @Test + public void testGetParentFile() { + new MockUp() { + @Mock + public FileSystem getFileSystem(Configuration conf) throws IOException { + return new DistributedFileSystem(); + } + + }; + new MockUp() { + @Mock + public Path getParent() { + return new Path(fileName); + } + + }; + new MockUp() { + @Mock + public Path getPath() { + return new Path(fileName); + } + + }; + new MockUp() { + @Mock + public FileStatus getFileStatus(Path file) throws IOException { + + return new FileStatus(12L, true, 60, 120l, 180L, new Path(fileName)); + } + + }; + + hdfsCarbonFile = new HDFSCarbonFile(fileStatus); + assertTrue(hdfsCarbonFile.getParentFile() instanceof CarbonFile); + } + + @Test + public void testForNonDisributedSystem() { + new HDFSCarbonFile(fileStatus); + new MockUp() { + @Mock + public FileSystem getFileSystem(Configuration conf) throws IOException { + return new WebHdfsFileSystem(); + } + + }; + assertEquals(hdfsCarbonFile.renameForce(fileName), false); + } + + @Test + public void testrenameForceForDisributedSystem() { + new MockUp() { + @Mock + public FileSystem getFileSystem(Configuration conf) throws IOException { + return new DistributedFileSystem(); + } + + }; + new MockUp() { + @Mock + public void rename(Path src, Path dst, final Options.Rename... options) throws IOException { + + } + + }; + hdfsCarbonFile = new HDFSCarbonFile(fileStatus); + assertEquals(hdfsCarbonFile.renameForce(fileName), true); + + } +} + http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/48316190/core/src/test/java/org/apache/carbondata/core/datastore/filesystem/LocalCarbonFileTest.java ---------------------------------------------------------------------- diff --git a/core/src/test/java/org/apache/carbondata/core/datastore/filesystem/LocalCarbonFileTest.java b/core/src/test/java/org/apache/carbondata/core/datastore/filesystem/LocalCarbonFileTest.java new file mode 100644 index 0000000..4e2c650 --- /dev/null +++ b/core/src/test/java/org/apache/carbondata/core/datastore/filesystem/LocalCarbonFileTest.java @@ -0,0 +1,471 @@ +/* + * 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.carbondata.core.datastore.filesystem; + +import mockit.Mock; +import mockit.MockUp; + +import org.apache.carbondata.core.datastore.impl.FileFactory; + +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; +import sun.nio.ch.FileChannelImpl; + +import java.io.*; +import java.nio.channels.ReadableByteChannel; +import java.util.Objects; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + + +public class LocalCarbonFileTest { + + private static LocalCarbonFile localCarbonFile; + private static File file; + private static File dir; + private static FileOutputStream oFile; + + @BeforeClass + static public void setUp() { + file = new File("Test.carbondata"); + dir = new File("Testdir.carbondata"); + if (!file.exists()) + try { + file.createNewFile(); + dir.mkdir(); + } catch (IOException e) { + e.printStackTrace(); + } + try { + oFile = new FileOutputStream(file, true); + + + byte[] bytes = "core java api".getBytes(); + + oFile.write(bytes); + } catch (FileNotFoundException e) { + e.printStackTrace(); + localCarbonFile = new LocalCarbonFile(file); + } catch (IOException e) { + e.printStackTrace(); + } + } + + @AfterClass + static public void cleanUp() { + file.delete(); + dir.delete(); + + } + + @Test + public void testListFilesWithCarbonFileFilterAndWithOutOutDirectoryPermission() { + CarbonFileFilter carbonFileFilter = new CarbonFileFilter() { + @Override + public boolean accept(CarbonFile file) { + return false; + } + }; + new MockUp() { + @Mock + public boolean isDirectory() { + return false; + } + + + }; + assertTrue(localCarbonFile.listFiles(carbonFileFilter) == null); + } + + @Test + public void testListFilesWithOutDirPermission() { + localCarbonFile = new LocalCarbonFile(file); + new MockUp() { + @Mock + public boolean isDirectory() { + return false; + } + }; + assertTrue(localCarbonFile.listFiles() == null); + } + + @Test + public void testCreateNewFileForException() throws IOException { + localCarbonFile = new LocalCarbonFile(new File("")); + assertTrue(!localCarbonFile.createNewFile()); + } + + @Test + public void testCheckIfFileExists() throws IOException { + localCarbonFile = new LocalCarbonFile(new File("")); + assertTrue(!localCarbonFile.exists()); + } + + @Test + public void testRenameForce() { + localCarbonFile = new LocalCarbonFile(file); + assertTrue(localCarbonFile.renameForce("Testdb.carbon")); + File file1 = new File("Testdb.carbon"); + if (file1.exists()) { + file1.delete(); + } + } + + @Test + public void testRenameTo() { + localCarbonFile = new LocalCarbonFile(file); + assertTrue(!localCarbonFile.renameTo("Testdb.carbon")); + } + + @Test + public void testsetLastModifiedTime() { + localCarbonFile = new LocalCarbonFile(file); + assertTrue(!localCarbonFile.setLastModifiedTime(50L)); + } + + @Test + public void testtruncate() { + localCarbonFile = new LocalCarbonFile(file); + final int[] counter = {0}; + new MockUp() { + @Mock + public FileFactory.FileType getFileType(String path) { + { + return FileFactory.FileType.LOCAL; + } + } + }; + new MockUp() { + @Mock + public boolean isFileExist(String filePath, FileFactory.FileType fileType) throws IOException { + { + return true; + } + } + }; + new MockUp() { + @Mock + boolean delete() { + return true; + } + }; + new MockUp() { + @Mock + public boolean createNewFile(String filePath, FileFactory.FileType fileType) throws IOException { + { + return true; + } + } + }; + new MockUp() { + @Mock + public CarbonFile getCarbonFile(String path, FileFactory.FileType fileType) { + { + return new LocalCarbonFile(path); + } + } + }; + new MockUp() { + @Mock + boolean delete() { + return true; + } + }; + + new MockUp() { + @Mock + public long transferFrom(ReadableByteChannel var1, long var2, long var4) throws IOException { + if (counter[0] == 0) { + counter[0] = counter[0] + 1; + return 0L; + } else { + return 1L; + } + } + }; + new MockUp() { + @Mock + boolean renameForce(String changetoName) { + return true; + } + }; + localCarbonFile = new LocalCarbonFile(file); + assertTrue(localCarbonFile.truncate(file.getName(), 1L)); + } + + @Test + public void testtruncateForException() throws IOException { + localCarbonFile = new LocalCarbonFile(file); + new MockUp() { + @Mock + public FileFactory.FileType getFileType(String path) { + { + return FileFactory.FileType.LOCAL; + } + } + }; + new MockUp() { + @Mock + public boolean isFileExist(String filePath, FileFactory.FileType fileType) throws IOException { + { + return true; + } + } + }; + new MockUp() { + @Mock + public CarbonFile getCarbonFile(String path, FileFactory.FileType fileType) { + { + return new LocalCarbonFile(path); + } + } + }; + new MockUp() { + @Mock + boolean delete() { + return true; + } + }; + new MockUp() { + @Mock + public boolean createNewFile(String filePath, FileFactory.FileType fileType) throws IOException { + { + throw new IOException(); + } + } + }; + + + localCarbonFile.truncate(file.getName(), 2L); + } + + @Test + public void testListFilesWithDirPermission() { + localCarbonFile = new LocalCarbonFile(file); + new MockUp() { + @Mock + public boolean isDirectory() { + return true; + } + }; + new MockUp() { + @Mock + public File[] listFiles() { + return null; + } + + + }; + localCarbonFile = new LocalCarbonFile(dir); + assertTrue(localCarbonFile.listFiles().length == 0); + } + + @Test + public void testListFilesWithCarbonFileFilterAndDirectoryPermission() { + CarbonFileFilter carbonFileFilter = new CarbonFileFilter() { + @Override + public boolean accept(CarbonFile file) { + return true; + } + }; + new MockUp() { + @Mock + public boolean isDirectory() { + return true; + } + }; + new MockUp() { + @Mock + public File[] listFiles(FileFilter filter) { + + File[] file = new File[]{dir}; + return file; + } + + + }; + + localCarbonFile = new LocalCarbonFile(dir); + + assertTrue(localCarbonFile.listFiles(carbonFileFilter).length == 1); + } + + @Test + public void testListFilesForNullWithCarbonFileFilterAndDirectoryPermission() { + CarbonFileFilter carbonFileFilter = new CarbonFileFilter() { + @Override + public boolean accept(CarbonFile file) { + return true; + } + }; + new MockUp() { + @Mock + public File[] listFiles(FileFilter filter) { + return null; + } + + + }; + new MockUp() { + @Mock + public boolean isDirectory() { + return false; + } + + @Mock + public File[] listFiles(FileFilter filter) { + return null; + } + + + }; + localCarbonFile = new LocalCarbonFile(dir); + + assertTrue(localCarbonFile.listFiles(carbonFileFilter) == null); + } + + @Test + public void testListFilesForEmptyFileArrayWithCarbonFileFilter() { + CarbonFileFilter carbonFileFilter = new CarbonFileFilter() { + @Override + public boolean accept(CarbonFile file) { + return true; + } + }; + new MockUp() { + @Mock + boolean accept(CarbonFile file) { + return true; + } + }; + new MockUp() { + @Mock + public File[] listFiles(FileFilter filter) { + return null; + } + }; + new MockUp() { + @Mock + public boolean isDirectory() { + return true; + } + + @Mock + public File[] listFiles(FileFilter filter) { + return null; + } + }; + localCarbonFile = new LocalCarbonFile(dir); + + assertTrue(localCarbonFile.listFiles(carbonFileFilter).length == 0); + } + + @Test + public void testFilesForConnicalPath() { + + new MockUp() { + @Mock + public String getCanonicalPath() throws IOException { + return "testFile"; + } + + + }; + localCarbonFile = new LocalCarbonFile(dir); + + assertTrue(Objects.equals(localCarbonFile.getCanonicalPath(), "testFile")); + } + + @Test + public void testFilesForConnicalPathException() throws IOException { + + new MockUp() { + @Mock + public String getCanonicalPath() throws IOException { + throw new IOException(); + } + + + }; + localCarbonFile = new LocalCarbonFile(dir); + + localCarbonFile.getCanonicalPath(); + } + + @Test + public void testFilesForAbsolutePath() { + + new MockUp() { + @Mock + public String getAbsolutePath() { + return "testFile"; + } + + + }; + localCarbonFile = new LocalCarbonFile(dir); + + assertEquals(localCarbonFile.getAbsolutePath(), "testFile"); + } + + @Test + public void testFilesForGetPath() { + + new MockUp() { + @Mock + public String getPath() { + return "testFile"; + } + + + }; + localCarbonFile = new LocalCarbonFile(dir); + + assertEquals(localCarbonFile.getPath(), "testFile"); + } + + @Test + public void testFilesForFileExists() { + + localCarbonFile = new LocalCarbonFile(new File("")); + assertEquals(localCarbonFile.exists(), false); + } + + @Test + public void testRenameForceForFileNotExists() { + new MockUp() { + @Mock + public boolean exists() { + return false; + } + + @Mock + public boolean renameTo(File dest) { + return true; + } + }; + + localCarbonFile = new LocalCarbonFile("demo.txt"); + + assertEquals(localCarbonFile.renameForce("Test.carbondata"), true); + } +} http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/48316190/core/src/test/java/org/apache/carbondata/core/datastore/filesystem/ViewFsCarbonFileTest.java ---------------------------------------------------------------------- diff --git a/core/src/test/java/org/apache/carbondata/core/datastore/filesystem/ViewFsCarbonFileTest.java b/core/src/test/java/org/apache/carbondata/core/datastore/filesystem/ViewFsCarbonFileTest.java new file mode 100644 index 0000000..7569dc6 --- /dev/null +++ b/core/src/test/java/org/apache/carbondata/core/datastore/filesystem/ViewFsCarbonFileTest.java @@ -0,0 +1,311 @@ +/* + * 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.carbondata.core.datastore.filesystem; + +import mockit.Mock; +import mockit.MockUp; +import org.apache.hadoop.conf.Configuration; +import org.apache.hadoop.fs.FileStatus; +import org.apache.hadoop.fs.FileSystem; +import org.apache.hadoop.fs.Path; +import org.apache.hadoop.fs.viewfs.ViewFileSystem; +import org.apache.hadoop.hdfs.DistributedFileSystem; +import org.apache.hadoop.hdfs.web.WebHdfsFileSystem; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; + +import java.io.File; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.IOException; + +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + + +public class ViewFsCarbonFileTest { + + private static ViewFSCarbonFile viewFSCarbonFile; + private static FileStatus fileStatus; + private static FileStatus fileStatusWithOutDirectoryPermission; + private static String fileName; + private static File file; + + + @BeforeClass + static public void setUp() { + file = new File("Test.carbondata"); + if (!file.exists()) + try { + file.createNewFile(); + } catch (IOException e) { + e.printStackTrace(); + } + try { + FileOutputStream oFile = new FileOutputStream(file, true); + } catch (FileNotFoundException e) { + e.printStackTrace(); + } + + fileStatus = new FileStatus(12L, true, 60, 120l, 180L, new Path(file.getAbsolutePath())); + fileStatusWithOutDirectoryPermission = new FileStatus(12L, false, 60, 120l, 180L, new Path(file.getAbsolutePath())); + fileName = file.getAbsolutePath(); + viewFSCarbonFile = new ViewFSCarbonFile(fileStatus); + } + + @AfterClass + static public void cleanUp() { + file.delete(); + } + + @Test + public void testRenameForceForException() throws IOException { + + new MockUp() { + @Mock + public FileSystem getFileSystem(Configuration conf) throws IOException { + throw new IOException(); + } + + }; + viewFSCarbonFile = new ViewFSCarbonFile(fileStatus); + viewFSCarbonFile.renameForce(fileName); + } + + @Test + public void testListFilesWithOutDirectoryPermission() { + viewFSCarbonFile = new ViewFSCarbonFile(fileStatusWithOutDirectoryPermission); + assertTrue(viewFSCarbonFile.listFiles() == null); + } + + @Test + public void testConstructorWithFilePath() { + viewFSCarbonFile = new ViewFSCarbonFile(file.getAbsolutePath()); + assertTrue(viewFSCarbonFile instanceof ViewFSCarbonFile); + } + + @Test + public void testListFilesForNullListStatus() { + viewFSCarbonFile = new ViewFSCarbonFile(fileStatusWithOutDirectoryPermission); + new MockUp() { + @Mock + public FileSystem getFileSystem(Configuration conf) throws IOException { + return new ViewFileSystem(); + } + + }; + new MockUp() { + @Mock + public FileStatus[] listStatus(Path var1) throws IOException { + + return null; + } + + }; + new MockUp() { + @Mock + public boolean delete(Path var1, boolean var2) throws IOException { + + return true; + } + + }; + //public boolean delete(Path var1, boolean var2) throws IOException; + viewFSCarbonFile = new ViewFSCarbonFile(fileStatus); + assertTrue(viewFSCarbonFile.listFiles().length == 0); + } + + @Test + public void testListDirectory() { + viewFSCarbonFile = new ViewFSCarbonFile(fileStatus); + new MockUp() { + @Mock + public FileSystem getFileSystem(Configuration conf) throws IOException { + return new ViewFileSystem(); + } + + }; + new MockUp() { + @Mock + public FileStatus[] listStatus(Path var1) throws IOException { + + FileStatus[] fileStatus = new FileStatus[]{new FileStatus(12L, true, 60, 120l, 180L, new Path(fileName))}; + return fileStatus; + } + + }; + + assertTrue(viewFSCarbonFile.listFiles().length == 1); + } + + @Test + public void testListFilesForException() throws IOException { + viewFSCarbonFile = new ViewFSCarbonFile(fileStatusWithOutDirectoryPermission); + + new MockUp() { + @Mock + public Path getPath() { + return new Path(file.getAbsolutePath()); + } + + }; + new MockUp() { + @Mock + public FileSystem getFileSystem(Configuration conf) throws IOException { + throw new IOException(); + } + + }; + new MockUp() { + @Mock + public FileStatus[] listStatus(Path var1) throws IOException { + + throw new IOException(); + } + + }; + viewFSCarbonFile = new ViewFSCarbonFile(fileStatus); + viewFSCarbonFile.listFiles(); + } + + @Test + public void testListFilesWithCarbonFilter() { + CarbonFileFilter carbonFileFilter = new CarbonFileFilter() { + + @Override + public boolean accept(CarbonFile file) { + return true; + } + }; + viewFSCarbonFile = new ViewFSCarbonFile(fileStatus); + assertTrue(viewFSCarbonFile.listFiles(carbonFileFilter).length == 1); + } + + @Test + public void testlistFilesWithoutFilter() { + CarbonFileFilter carbonFileFilter = new CarbonFileFilter() { + + @Override + public boolean accept(CarbonFile file) { + return false; + } + }; + new MockUp() { + @Mock + public FileSystem getFileSystem(Configuration conf) throws IOException { + return new ViewFileSystem(); + } + + }; + new MockUp() { + @Mock + public FileStatus[] listStatus(Path var1) throws IOException { + + FileStatus[] fileStatus = new FileStatus[]{new FileStatus(12L, true, 60, 120l, 180L, new Path(fileName))}; + return fileStatus; + } + + }; + viewFSCarbonFile = new ViewFSCarbonFile(fileStatus); + assertTrue(viewFSCarbonFile.listFiles(carbonFileFilter).length == 0); + } + + @Test + public void testGetParentFIle() { + new MockUp() { + @Mock + public FileSystem getFileSystem(Configuration conf) throws IOException { + return new DistributedFileSystem(); + } + + }; + new MockUp() { + @Mock + public Path getParent() { + return new Path(file.getAbsolutePath() + ); + } + + }; + new MockUp() { + @Mock + public Path getPath() { + return new Path(file.getAbsolutePath()); + } + + }; + new MockUp() { + @Mock + public FileStatus getFileStatus(Path f) throws IOException { + + return new FileStatus(12L, true, 60, 120l, 180L, new Path(file.getAbsolutePath())); + } + + }; + + viewFSCarbonFile = new ViewFSCarbonFile(fileStatus); + assertFalse(viewFSCarbonFile.getParentFile().equals(null)); + } + + @Test + public void testForNonDisributedSystem() { + viewFSCarbonFile = new ViewFSCarbonFile(fileStatus); + new MockUp() { + @Mock + public FileSystem getFileSystem(Configuration conf) throws IOException { + return new WebHdfsFileSystem(); + } + + }; + assertFalse(viewFSCarbonFile.renameForce(fileName)); + } + + @Test + public void testrenameForceForViewFileSystem() { + new MockUp() { + @Mock + public FileSystem getFileSystem(Configuration conf) throws IOException { + return new ViewFileSystem(); + } + + }; + new MockUp() { + @Mock + public boolean delete(Path f, boolean recursive) throws + IOException { + return true; + + } + + }; + new MockUp() { + @Mock + public boolean rename(Path src, Path dst) throws IOException { + return true; + + } + + }; + + assertTrue(viewFSCarbonFile.renameForce(fileName)); + + } +} http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/48316190/core/src/test/java/org/apache/carbondata/core/reader/sortindex/CarbonDictionarySortIndexReaderImplTest.java ---------------------------------------------------------------------- diff --git a/core/src/test/java/org/apache/carbondata/core/reader/sortindex/CarbonDictionarySortIndexReaderImplTest.java b/core/src/test/java/org/apache/carbondata/core/reader/sortindex/CarbonDictionarySortIndexReaderImplTest.java index e0708dc..585f33b 100644 --- a/core/src/test/java/org/apache/carbondata/core/reader/sortindex/CarbonDictionarySortIndexReaderImplTest.java +++ b/core/src/test/java/org/apache/carbondata/core/reader/sortindex/CarbonDictionarySortIndexReaderImplTest.java @@ -26,8 +26,8 @@ import java.util.UUID; import org.apache.carbondata.core.metadata.CarbonTableIdentifier; import org.apache.carbondata.core.metadata.ColumnIdentifier; -import org.apache.carbondata.core.datastorage.filesystem.CarbonFile; -import org.apache.carbondata.core.datastorage.impl.FileFactory; +import org.apache.carbondata.core.datastore.filesystem.CarbonFile; +import org.apache.carbondata.core.datastore.impl.FileFactory; import org.apache.carbondata.core.util.CarbonUtil; import org.apache.carbondata.core.writer.CarbonDictionaryWriter; import org.apache.carbondata.core.writer.CarbonDictionaryWriterImpl; http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/48316190/core/src/test/java/org/apache/carbondata/core/util/CarbonMetadataUtilTest.java ---------------------------------------------------------------------- diff --git a/core/src/test/java/org/apache/carbondata/core/util/CarbonMetadataUtilTest.java b/core/src/test/java/org/apache/carbondata/core/util/CarbonMetadataUtilTest.java index 5855262..7e9e18d 100644 --- a/core/src/test/java/org/apache/carbondata/core/util/CarbonMetadataUtilTest.java +++ b/core/src/test/java/org/apache/carbondata/core/util/CarbonMetadataUtilTest.java @@ -24,7 +24,7 @@ import mockit.MockUp; import org.apache.carbondata.core.datastore.block.SegmentProperties; import org.apache.carbondata.core.metadata.index.BlockIndexInfo; -import org.apache.carbondata.core.datastorage.compression.WriterCompressModel; +import org.apache.carbondata.core.datastore.compression.WriterCompressModel; import org.apache.carbondata.core.metadata.BlockletInfoColumnar; import org.apache.carbondata.core.metadata.ValueEncoderMeta; import org.apache.carbondata.format.*; http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/48316190/core/src/test/java/org/apache/carbondata/core/util/CarbonUtilTest.java ---------------------------------------------------------------------- diff --git a/core/src/test/java/org/apache/carbondata/core/util/CarbonUtilTest.java b/core/src/test/java/org/apache/carbondata/core/util/CarbonUtilTest.java index 37f1ef6..c928d36 100644 --- a/core/src/test/java/org/apache/carbondata/core/util/CarbonUtilTest.java +++ b/core/src/test/java/org/apache/carbondata/core/util/CarbonUtilTest.java @@ -31,10 +31,10 @@ import org.apache.carbondata.core.metadata.Encoding; import org.apache.carbondata.core.metadata.schema.table.column.CarbonDimension; import org.apache.carbondata.core.metadata.schema.table.column.CarbonMeasure; import org.apache.carbondata.core.metadata.schema.table.column.ColumnSchema; -import org.apache.carbondata.core.datastorage.columnar.ColumnGroupModel; -import org.apache.carbondata.core.datastorage.compression.WriterCompressModel; -import org.apache.carbondata.core.datastorage.filesystem.LocalCarbonFile; -import org.apache.carbondata.core.datastorage.impl.FileFactory; +import org.apache.carbondata.core.datastore.columnar.ColumnGroupModel; +import org.apache.carbondata.core.datastore.compression.WriterCompressModel; +import org.apache.carbondata.core.datastore.filesystem.LocalCarbonFile; +import org.apache.carbondata.core.datastore.impl.FileFactory; import org.apache.carbondata.core.metadata.ValueEncoderMeta; import org.apache.carbondata.core.scan.model.QueryDimension; http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/48316190/core/src/test/java/org/apache/carbondata/core/util/DataFileFooterConverterTest.java ---------------------------------------------------------------------- diff --git a/core/src/test/java/org/apache/carbondata/core/util/DataFileFooterConverterTest.java b/core/src/test/java/org/apache/carbondata/core/util/DataFileFooterConverterTest.java index f1b8070..9b90755 100644 --- a/core/src/test/java/org/apache/carbondata/core/util/DataFileFooterConverterTest.java +++ b/core/src/test/java/org/apache/carbondata/core/util/DataFileFooterConverterTest.java @@ -26,9 +26,9 @@ import org.apache.carbondata.core.metadata.ColumnarFormatVersion; import org.apache.carbondata.core.datastore.block.TableBlockInfo; import org.apache.carbondata.core.metadata.blocklet.DataFileFooter; import org.apache.carbondata.core.metadata.blocklet.SegmentInfo; -import org.apache.carbondata.core.datastorage.FileHolder; -import org.apache.carbondata.core.datastorage.impl.FileFactory; -import org.apache.carbondata.core.datastorage.impl.FileHolderImpl; +import org.apache.carbondata.core.datastore.FileHolder; +import org.apache.carbondata.core.datastore.impl.FileFactory; +import org.apache.carbondata.core.datastore.impl.FileHolderImpl; import org.apache.carbondata.core.reader.CarbonFooterReader; import org.apache.carbondata.core.reader.CarbonIndexFileReader; import org.apache.carbondata.core.reader.ThriftReader; http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/48316190/core/src/test/java/org/apache/carbondata/core/util/ValueCompressionUtilTest.java ---------------------------------------------------------------------- diff --git a/core/src/test/java/org/apache/carbondata/core/util/ValueCompressionUtilTest.java b/core/src/test/java/org/apache/carbondata/core/util/ValueCompressionUtilTest.java index 17fe306..0e024e9 100644 --- a/core/src/test/java/org/apache/carbondata/core/util/ValueCompressionUtilTest.java +++ b/core/src/test/java/org/apache/carbondata/core/util/ValueCompressionUtilTest.java @@ -23,29 +23,29 @@ import static org.junit.Assert.assertTrue; import java.nio.ByteBuffer; -import org.apache.carbondata.core.datastorage.compression.MeasureMetaDataModel; -import org.apache.carbondata.core.datastorage.compression.WriterCompressModel; -import org.apache.carbondata.core.datastorage.compression.ValueCompressionHolder; -import org.apache.carbondata.core.datastorage.compression.decimal.CompressionMaxMinByte; -import org.apache.carbondata.core.datastorage.compression.decimal.CompressionMaxMinDefault; -import org.apache.carbondata.core.datastorage.compression.decimal.CompressionMaxMinInt; -import org.apache.carbondata.core.datastorage.compression.decimal.CompressionMaxMinLong; -import org.apache.carbondata.core.datastorage.compression.decimal.CompressionMaxMinShort; -import org.apache.carbondata.core.datastorage.compression.nondecimal.CompressionNonDecimalByte; -import org.apache.carbondata.core.datastorage.compression.nondecimal.CompressionNonDecimalDefault; -import org.apache.carbondata.core.datastorage.compression.nondecimal.CompressionNonDecimalInt; -import org.apache.carbondata.core.datastorage.compression.nondecimal.CompressionNonDecimalLong; -import org.apache.carbondata.core.datastorage.compression.nondecimal.CompressionNonDecimalMaxMinByte; -import org.apache.carbondata.core.datastorage.compression.nondecimal.CompressionNonDecimalMaxMinDefault; -import org.apache.carbondata.core.datastorage.compression.nondecimal.CompressionNonDecimalMaxMinInt; -import org.apache.carbondata.core.datastorage.compression.nondecimal.CompressionNonDecimalMaxMinLong; -import org.apache.carbondata.core.datastorage.compression.nondecimal.CompressionNonDecimalMaxMinShort; -import org.apache.carbondata.core.datastorage.compression.nondecimal.CompressionNonDecimalShort; -import org.apache.carbondata.core.datastorage.compression.none.CompressionNoneByte; -import org.apache.carbondata.core.datastorage.compression.none.CompressionNoneDefault; -import org.apache.carbondata.core.datastorage.compression.none.CompressionNoneInt; -import org.apache.carbondata.core.datastorage.compression.none.CompressionNoneLong; -import org.apache.carbondata.core.datastorage.compression.none.CompressionNoneShort; +import org.apache.carbondata.core.datastore.compression.MeasureMetaDataModel; +import org.apache.carbondata.core.datastore.compression.WriterCompressModel; +import org.apache.carbondata.core.datastore.compression.ValueCompressionHolder; +import org.apache.carbondata.core.datastore.compression.decimal.CompressionMaxMinByte; +import org.apache.carbondata.core.datastore.compression.decimal.CompressionMaxMinDefault; +import org.apache.carbondata.core.datastore.compression.decimal.CompressionMaxMinInt; +import org.apache.carbondata.core.datastore.compression.decimal.CompressionMaxMinLong; +import org.apache.carbondata.core.datastore.compression.decimal.CompressionMaxMinShort; +import org.apache.carbondata.core.datastore.compression.nondecimal.CompressionNonDecimalByte; +import org.apache.carbondata.core.datastore.compression.nondecimal.CompressionNonDecimalDefault; +import org.apache.carbondata.core.datastore.compression.nondecimal.CompressionNonDecimalInt; +import org.apache.carbondata.core.datastore.compression.nondecimal.CompressionNonDecimalLong; +import org.apache.carbondata.core.datastore.compression.nondecimal.CompressionNonDecimalMaxMinByte; +import org.apache.carbondata.core.datastore.compression.nondecimal.CompressionNonDecimalMaxMinDefault; +import org.apache.carbondata.core.datastore.compression.nondecimal.CompressionNonDecimalMaxMinInt; +import org.apache.carbondata.core.datastore.compression.nondecimal.CompressionNonDecimalMaxMinLong; +import org.apache.carbondata.core.datastore.compression.nondecimal.CompressionNonDecimalMaxMinShort; +import org.apache.carbondata.core.datastore.compression.nondecimal.CompressionNonDecimalShort; +import org.apache.carbondata.core.datastore.compression.none.CompressionNoneByte; +import org.apache.carbondata.core.datastore.compression.none.CompressionNoneDefault; +import org.apache.carbondata.core.datastore.compression.none.CompressionNoneInt; +import org.apache.carbondata.core.datastore.compression.none.CompressionNoneLong; +import org.apache.carbondata.core.datastore.compression.none.CompressionNoneShort; import org.apache.carbondata.core.util.ValueCompressionUtil.DataType; import org.junit.Test; http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/48316190/core/src/test/java/org/apache/carbondata/core/writer/CarbonDictionaryWriterImplTest.java ---------------------------------------------------------------------- diff --git a/core/src/test/java/org/apache/carbondata/core/writer/CarbonDictionaryWriterImplTest.java b/core/src/test/java/org/apache/carbondata/core/writer/CarbonDictionaryWriterImplTest.java index 4994942..bee220b 100644 --- a/core/src/test/java/org/apache/carbondata/core/writer/CarbonDictionaryWriterImplTest.java +++ b/core/src/test/java/org/apache/carbondata/core/writer/CarbonDictionaryWriterImplTest.java @@ -39,8 +39,8 @@ import org.apache.carbondata.core.metadata.ColumnIdentifier; import org.apache.carbondata.core.path.CarbonStorePath; import org.apache.carbondata.core.path.CarbonTablePath; import org.apache.carbondata.core.constants.CarbonCommonConstants; -import org.apache.carbondata.core.datastorage.filesystem.CarbonFile; -import org.apache.carbondata.core.datastorage.impl.FileFactory; +import org.apache.carbondata.core.datastore.filesystem.CarbonFile; +import org.apache.carbondata.core.datastore.impl.FileFactory; import org.apache.carbondata.core.reader.CarbonDictionaryColumnMetaChunk; import org.apache.carbondata.core.reader.CarbonDictionaryMetadataReaderImpl; import org.apache.carbondata.core.reader.CarbonDictionaryReaderImpl;