You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@carbondata.apache.org by kunal642 <gi...@git.apache.org> on 2016/10/28 13:23:41 UTC
[GitHub] incubator-carbondata pull request #270: CARBONDATA-346
GitHub user kunal642 opened a pull request:
https://github.com/apache/incubator-carbondata/pull/270
CARBONDATA-346
Be sure to do all of the following to help us incorporate your contribution
quickly and easily:
- [x] Make sure the PR title is formatted like:
`[CARBONDATA-<Jira issue #>] Description of pull request`
- [x] Make sure tests pass via `mvn clean verify`. (Even better, enable
Travis-CI on your fork and ensure the whole test matrix passes).
- [x] Replace `<Jira issue #>` in the title with the actual Jira issue
number, if there is one.
- [ ] If this contribution is large, please file an Apache
[Individual Contributor License Agreement](https://www.apache.org/licenses/icla.txt).
- [x] Testing done
Please provide details on
- Whether new unit test cases have been added or why no new tests are required?
- What manual testing you have done?
- Any additional information to help reviewers in testing this change.
- [ ] For large changes, please consider breaking it into sub-tasks under an umbrella JIRA.
---
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/kunal642/incubator-carbondata unit_test_core
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/incubator-carbondata/pull/270.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #270
----
commit 3356acc98d2e62eae97d6fb0056c5b8b1d588199
Author: kunal642 <ku...@knoldus.in>
Date: 2016-10-28T10:34:52Z
added jacoco plugin
commit c399884ef0241095486813f43b6c222724588443
Author: kunal642 <ku...@knoldus.in>
Date: 2016-10-28T10:35:20Z
updated unit tests for CarbonUtil
commit 83e75aade3014db1b1601cb39cb28f67013b378f
Author: kunal642 <ku...@knoldus.in>
Date: 2016-10-28T10:36:02Z
Updated unit test for CarbonUtilException
commit bc7b135bc1fad3b8d10ba1ec6cf3669e2a9443f2
Author: kunal642 <ku...@knoldus.in>
Date: 2016-10-28T13:09:11Z
reverted updates to pom.xml
----
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] incubator-carbondata pull request #270: [CARBONDATA-346] Add unit test for C...
Posted by ravipesala <gi...@git.apache.org>.
Github user ravipesala commented on a diff in the pull request:
https://github.com/apache/incubator-carbondata/pull/270#discussion_r87453971
--- Diff: core/src/test/java/org/apache/carbondata/core/util/CarbonUtilTest.java ---
@@ -18,18 +18,746 @@
*/
package org.apache.carbondata.core.util;
-import junit.framework.TestCase;
+import mockit.Mock;
+import mockit.MockUp;
+import org.apache.carbondata.core.carbon.datastore.chunk.DimensionChunkAttributes;
+import org.apache.carbondata.core.carbon.datastore.chunk.impl.FixedLengthDimensionDataChunk;
+import org.apache.carbondata.core.carbon.metadata.blocklet.DataFileFooter;
+import org.apache.carbondata.core.carbon.metadata.blocklet.datachunk.DataChunk;
+import org.apache.carbondata.core.carbon.metadata.datatype.DataType;
+import org.apache.carbondata.core.carbon.metadata.encoder.Encoding;
+import org.apache.carbondata.core.carbon.metadata.schema.table.column.CarbonDimension;
+import org.apache.carbondata.core.carbon.metadata.schema.table.column.CarbonMeasure;
+import org.apache.carbondata.core.carbon.metadata.schema.table.column.ColumnSchema;
+import org.apache.carbondata.core.datastorage.store.columnar.ColumnGroupModel;
+import org.apache.carbondata.core.datastorage.store.compression.ValueCompressionModel;
+import org.apache.carbondata.core.datastorage.store.filesystem.LocalCarbonFile;
+import org.apache.carbondata.core.datastorage.store.impl.FileFactory;
+import org.apache.carbondata.core.keygenerator.mdkey.NumberCompressor;
+import org.apache.carbondata.core.metadata.ValueEncoderMeta;
+import org.apache.carbondata.scan.model.QueryDimension;
+import org.apache.hadoop.security.UserGroupInformation;
+import org.glassfish.grizzly.memory.HeapBuffer;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
import org.junit.Test;
+import org.pentaho.di.core.exception.KettleException;
+import java.io.*;
+import java.nio.ByteBuffer;
+import java.nio.channels.FileChannel;
+import java.util.ArrayList;
+import java.util.List;
+import static junit.framework.TestCase.*;
-public class CarbonUtilTest extends TestCase {
+public class CarbonUtilTest {
- @Test public void testGetBitLengthForDimensionGiveProperValue() {
- int[] cardinality = { 10, 1, 10000, 1, 2, 3 };
- int[] dimensionBitLength =
- CarbonUtil.getDimensionBitLength(cardinality, new int[] { 1, 1, 3, 1 });
- int[] expectedOutPut = { 8, 8, 14, 2, 8, 8 };
- for (int i = 0; i < dimensionBitLength.length; i++) {
- assertEquals(expectedOutPut[i], dimensionBitLength[i]);
+ @BeforeClass
+ public static void setUp() throws Exception{
+ new File("../core/src/test/resources/testFile.txt").createNewFile();
+ new File("../core/src/test/resources/testDatabase").mkdirs();
+
+ }
+
+ @Test
+ public void testGetBitLengthForDimensionGiveProperValue() {
+ int[] cardinality = {200, 1, 10000, 1, 10, 3};
+ int[] dimensionBitLength =
+ CarbonUtil.getDimensionBitLength(cardinality, new int[]{1, 1, 3, 1});
+ int[] expectedOutPut = {8, 8, 14, 2, 8, 8};
+ for (int i = 0; i < dimensionBitLength.length; i++) {
+ assertEquals(expectedOutPut[i], dimensionBitLength[i]);
+ }
+ }
+
+ @Test(expected = IOException.class)
+ public void testCloseStreams() throws IOException {
+ FileReader stream = new FileReader("../core/src/test/resources/testFile.txt");
+ BufferedReader br = new BufferedReader(stream);
+ CarbonUtil.closeStreams(br);
+ br.ready();
+ }
+
+ @Test
+ public void testToGetCardinality() {
+ int result = CarbonUtil.getIncrementedCardinality(10);
--- End diff --
add more checks by passing more different values here.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] incubator-carbondata pull request #270: [CARBONDATA-346] Add unit test for C...
Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:
https://github.com/apache/incubator-carbondata/pull/270
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---