parquet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From alexleven...@apache.org
Subject parquet-mr git commit: PARQUET-297: Tests for PR 213 (Version generator)
Date Fri, 19 Jun 2015 00:50:30 GMT
Repository: parquet-mr
Updated Branches:
  refs/heads/master ad4432103 -> 079bcd033


PARQUET-297: Tests for PR 213 (Version generator)

Adds tests for #213

How's this look @rdblue @kostya-sh ?

Author: Alex Levenson <alexlevenson@twitter.com>

Closes #218 from isnotinvain/tests-for-pr-213 and squashes the following commits:

8ee996b [Alex Levenson] Fix group indexes off by 1
b239a2a [Alex Levenson] Add license header :p
38fc78d [Alex Levenson] Add test for Version generator


Project: http://git-wip-us.apache.org/repos/asf/parquet-mr/repo
Commit: http://git-wip-us.apache.org/repos/asf/parquet-mr/commit/079bcd03
Tree: http://git-wip-us.apache.org/repos/asf/parquet-mr/tree/079bcd03
Diff: http://git-wip-us.apache.org/repos/asf/parquet-mr/diff/079bcd03

Branch: refs/heads/master
Commit: 079bcd0339f30343c01c5fd3d5521be4b822d30f
Parents: ad44321
Author: Alex Levenson <alexlevenson@twitter.com>
Authored: Thu Jun 18 17:50:28 2015 -0700
Committer: Alex Levenson <alexlevenson@twitter.com>
Committed: Thu Jun 18 17:50:28 2015 -0700

----------------------------------------------------------------------
 parquet-common/pom.xml                          |  6 ++
 .../java/org/apache/parquet/VersionTest.java    | 62 ++++++++++++++++++++
 pom.xml                                         |  1 +
 3 files changed, 69 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/parquet-mr/blob/079bcd03/parquet-common/pom.xml
----------------------------------------------------------------------
diff --git a/parquet-common/pom.xml b/parquet-common/pom.xml
index eacf2ab..d026d9d 100644
--- a/parquet-common/pom.xml
+++ b/parquet-common/pom.xml
@@ -36,6 +36,12 @@
   </properties>
 
   <dependencies>
+    <dependency>
+        <groupId>org.semver</groupId>
+        <artifactId>api</artifactId>
+        <version>${semver.api.version}</version>
+        <scope>test</scope>
+    </dependency>
   </dependencies>
 
   <build>

http://git-wip-us.apache.org/repos/asf/parquet-mr/blob/079bcd03/parquet-common/src/test/java/org/apache/parquet/VersionTest.java
----------------------------------------------------------------------
diff --git a/parquet-common/src/test/java/org/apache/parquet/VersionTest.java b/parquet-common/src/test/java/org/apache/parquet/VersionTest.java
new file mode 100644
index 0000000..e68b2f2
--- /dev/null
+++ b/parquet-common/src/test/java/org/apache/parquet/VersionTest.java
@@ -0,0 +1,62 @@
+/*
+ * 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.parquet;
+
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+/**
+ * This test doesn't do much, but it makes sure that the Version class
+ * was properly generated, and that it's VERSION_NUMBER field has been
+ * populated correctly. The hope is to catch any issues like the version
+ * being an empty string or something along those lines.
+ */
+public class VersionTest {
+
+  private void assertVersionValid(String v) {
+    try {
+      org.semver.Version.parse(v);
+    } catch (RuntimeException e) {
+      throw new RuntimeException(v + " is not a valid semver!" , e);
+    }
+  }
+
+  @Test
+  public void testVersion() {
+    assertVersionValid(Version.VERSION_NUMBER);
+  }
+
+  @Test
+  public void testFullVersion() {
+    // example: parquet-mr version 1.8.0rc2-SNAPSHOT (build ddb469afac70404ea63b72ed2f07a911a8592ff7)
+    String regex = "parquet-mr version (.*) \\(build (.*)\\)";
+    Pattern pattern = Pattern.compile(regex);
+    Matcher m = pattern.matcher(Version.FULL_VERSION);
+    assertTrue(Version.FULL_VERSION + " did not match " + pattern, m.matches());
+    assertVersionValid(m.group(1));
+    assertEquals(Version.VERSION_NUMBER, m.group(1));
+    assertFalse(m.group(2).isEmpty());
+  }
+}

http://git-wip-us.apache.org/repos/asf/parquet-mr/blob/079bcd03/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index c424071..c171660 100644
--- a/pom.xml
+++ b/pom.xml
@@ -90,6 +90,7 @@
     <pig.classifier />
     <thrift.version>0.7.0</thrift.version>
     <fastutil.version>6.5.7</fastutil.version>
+    <semver.api.version>0.9.33</semver.api.version>
   </properties>
 
   <modules>


Mime
View raw message