- Nothing is built outside the target directory anymore

o	I moved the static parts of the client and server distributions to “src/assembly/resources” and added an assembly that builds the client and server inside the target directory (You need to update the documentation on this)
o	The sever is now available at server/target/iotdb-server-0.9.0-SNAPSHOT
o	The client is now available at client/target/iotdb-client-0.9.0-SNAPSHOT
o	I updated the integration tests to work with these new locations
-	I updated the distribution module (binary-distribution) to simply include and unpack the client and server assemblies, which greatly simplifies the assembly itself.
-	In the integration-tests you use a process builder to get the current working directory … you can access this in the “user.dir” System property.
-	There was a large mixture of artifacts with different versions in the classpath.
o	I set all versions to the same using a big dependencyManagement block in the master pom
o	I removed the version of every external dependency and moved it into the main dependencyManagement block in the root pom (except dependencies only used in the examples, for these I added a dependencyManagement block in the example pom). This way you instantly identify external dependencies.
o	I added an enforcer rule to fail the build if two differing versions of one artifact are being used in the build (This should eliminate this problem from re-occuring)
o	I replaced the usage of “${project.version}” with the real version (There is no need to manually update these versions and this way when looking at the pom you instantly know the version … keep in mind if an artifact is deployed to maven central, the user doesn’t have the code and therefore he always has to scroll up to the top in order to see which version is used)
-	There were some imports related to Jdk 11 no longer providing some APIs, I moved those imports to a maven profile, which is activated based on the JDK version
-	HDFSInputTest created a file in “spark/test/” … if the test failed, the rat plugin would complain the next time it’s run.

I checked the build with all tests on Oracle-Java 8, Open-JDK 11, Oracle-JDK 12.
This commit is contained in:
Christofer Dutz 2019-08-05 14:41:25 +02:00
parent 5af81320c6
commit 9b355955ed
47 changed files with 641 additions and 270 deletions

1
.gitignore vendored
View File

@ -4,7 +4,6 @@
**/lib/**
**/data/**
tsfile/src/test/resources/perTestInputData
# Eclipse IDE files
**/.classpath
**/.project

View File

@ -31,8 +31,6 @@
<name>IoTDB Client</name>
<description>A Client tool.</description>
<properties>
<common.cli.version>1.3.1</common.cli.version>
<jline.version>2.14.5</jline.version>
<cli.test.skip>false</cli.test.skip>
<cli.it.skip>${cli.test.skip}</cli.it.skip>
<cli.ut.skip>${cli.test.skip}</cli.ut.skip>
@ -41,68 +39,27 @@
<dependency>
<groupId>org.apache.iotdb</groupId>
<artifactId>iotdb-jdbc</artifactId>
<version>${project.version}</version>
<version>0.9.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>commons-cli</groupId>
<artifactId>commons-cli</artifactId>
<version>${common.cli.version}</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.1</version>
</dependency>
<dependency>
<groupId>me.tongfei</groupId>
<artifactId>progressbar</artifactId>
<version>0.7.3</version>
</dependency>
<dependency>
<groupId>jline</groupId>
<artifactId>jline</artifactId>
<version>${jline.version}</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<configuration>
<filesets>
<fileset>
<directory>${project.basedir}/cli/lib</directory>
<includes>
<include>**/*.jar</include>
</includes>
<followSymlinks>false</followSymlinks>
</fileset>
</filesets>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${project.basedir}/cli/lib</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<outputDirectory>${project.basedir}/cli/lib</outputDirectory>
</configuration>
</plugin>
<!--using `mvn test` to run UT, `mvn verify` to run ITs
Reference: https://antoniogoncalves.org/2012/12/13/lets-turn-integration-tests-with-maven-to-a-first-class-citizen/-->
<plugin>
@ -130,6 +87,26 @@
<skipITs>${cli.it.skip}</skipITs>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<executions>
<!-- Package binaries-->
<execution>
<id>client-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<descriptors>
<descriptor>src/assembly/client.xml</descriptor>
</descriptors>
<appendAssemblyId>false</appendAssemblyId>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<profiles>

View File

@ -0,0 +1,40 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
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.
-->
<assembly>
<id>client</id>
<formats>
<format>dir</format>
<format>zip</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<dependencySets>
<dependencySet>
<outputDirectory>lib</outputDirectory>
</dependencySet>
</dependencySets>
<fileSets>
<fileSet>
<directory>src/assembly/resources</directory>
<outputDirectory>/</outputDirectory>
</fileSet>
</fileSets>
</assembly>

View File

@ -20,9 +20,7 @@ package org.apache.iotdb.cli.client;
import static org.junit.Assert.assertEquals;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.*;
import java.util.ArrayList;
import java.util.List;
@ -50,13 +48,24 @@ public abstract class AbstractScript {
}
}
protected String getCurrentPath(String... command) throws IOException {
ProcessBuilder builder = new ProcessBuilder(command);
builder.redirectErrorStream(true);
Process p = builder.start();
BufferedReader r = new BufferedReader(new InputStreamReader(p.getInputStream()));
String path = r.readLine();
return path;
protected String getCliPath() {
// This is usually always set by the JVM
File userDir = new File(System.getProperty("user.dir"));
if(!userDir.exists()) {
throw new RuntimeException("user.dir " + userDir.getAbsolutePath() + " doesn't exist.");
}
File targetDir = new File(userDir, "target");
File[] files = targetDir.listFiles(new FileFilter() {
@Override
public boolean accept(File pathname) {
return pathname.isDirectory() && pathname.getName().startsWith("iotdb-client-");
}
});
if(files.length != 1) {
throw new RuntimeException(
"Exactly one directory starting with 'iotdb-client-' should have been found, but was " + files.length);
}
return files[0].getAbsolutePath();
}
protected abstract void testOnWindows() throws IOException;

View File

@ -50,9 +50,9 @@ public class StartClientScriptIT extends AbstractScript {
final String[] output = {"````````````````````````", "Starting IoTDB Client",
"````````````````````````",
"IoTDB> Connection Error, please check whether the network is available or the server has started. Host is 127.0.0.1, port is 6668."};
String dir = getCurrentPath("cmd.exe", "/c", "echo %cd%");
String dir = getCliPath();
ProcessBuilder builder = new ProcessBuilder("cmd.exe", "/c",
dir + File.separator + "cli" + File.separator + "sbin" + File.separator + "start-client.bat",
dir + File.separator + "sbin" + File.separator + "start-client.bat",
"-h",
"127.0.0.1", "-p", "6668", "-u", "root", "-pw", "root");
testOutput(builder, output);
@ -63,9 +63,9 @@ public class StartClientScriptIT extends AbstractScript {
final String[] output = {"---------------------", "Starting IoTDB Client",
"---------------------",
"IoTDB> Connection Error, please check whether the network is available or the server has started. Host is 127.0.0.1, port is 6668."};
String dir = getCurrentPath("pwd");
String dir = getCliPath();
ProcessBuilder builder = new ProcessBuilder("sh",
dir + File.separator + "cli" + File.separator + "sbin" + File.separator + "start-client.sh",
dir + File.separator + "sbin" + File.separator + "start-client.sh",
"-h",
"127.0.0.1", "-p", "6668", "-u", "root", "-pw", "root");
testOutput(builder, output);

View File

@ -52,9 +52,9 @@ public class ExportCsvTestIT extends AbstractScript{
"````````````````````````````````````````````````",
"Encounter an error when exporting data, error is: Connection Error, "
+ "please check whether the network is available or the server has started."};
String dir = getCurrentPath("cmd.exe", "/c", "echo %cd%");
String dir = getCliPath();
ProcessBuilder builder = new ProcessBuilder("cmd.exe", "/c",
dir + File.separator + "cli" + File.separator + "tools" + File.separator + "export-csv.bat",
dir + File.separator + "tools" + File.separator + "export-csv.bat",
"-h", "127.0.0.1", "-p", "6668", "-u", "root", "-pw", "root", "-td", "./");
testOutput(builder, output);
}
@ -66,9 +66,9 @@ public class ExportCsvTestIT extends AbstractScript{
"------------------------------------------",
"Encounter an error when exporting data, error is: Connection Error, "
+ "please check whether the network is available or the server has started."};
String dir = getCurrentPath("pwd");
String dir = getCliPath();
ProcessBuilder builder = new ProcessBuilder("sh",
dir + File.separator + "cli" + File.separator + "tools" + File.separator + "export-csv.sh",
dir + File.separator + "tools" + File.separator + "export-csv.sh",
"-h", "127.0.0.1", "-p", "6668", "-u", "root", "-pw", "root", "-td", "./");
testOutput(builder, output);
}

View File

@ -52,9 +52,9 @@ public class ImportCsvTestIT extends AbstractScript {
"````````````````````````````````````````````````",
"Encounter an error when importing data, error is: Connection Error, please check whether "
+ "the network is available or the server has started."};
String dir = getCurrentPath("cmd.exe", "/c", "echo %cd%");
String dir = getCliPath();
ProcessBuilder builder = new ProcessBuilder("cmd.exe", "/c",
dir + File.separator + "cli" + File.separator + "tools" + File.separator + "import-csv.bat",
dir + File.separator + "tools" + File.separator + "import-csv.bat",
"-h", "127.0.0.1", "-p", "6668", "-u", "root", "-pw", "root", "-f", "./");
testOutput(builder, output);
}
@ -66,9 +66,9 @@ public class ImportCsvTestIT extends AbstractScript {
"------------------------------------------",
"Encounter an error when importing data, error is: Connection Error, please check whether "
+ "the network is available or the server has started."};
String dir = getCurrentPath("pwd");
String dir = getCliPath();
ProcessBuilder builder = new ProcessBuilder("sh",
dir + File.separator + "cli" + File.separator + "tools" + File.separator + "import-csv.sh",
dir + File.separator + "tools" + File.separator + "import-csv.sh",
"-h",
"127.0.0.1", "-p", "6668", "-u", "root", "-pw", "root", "-f", "./");
testOutput(builder, output);

View File

@ -83,4 +83,18 @@
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.apache.iotdb</groupId>
<artifactId>iotdb-server</artifactId>
<version>0.9.0-SNAPSHOT</version>
<type>zip</type>
</dependency>
<dependency>
<groupId>org.apache.iotdb</groupId>
<artifactId>iotdb-client</artifactId>
<version>0.9.0-SNAPSHOT</version>
<type>zip</type>
</dependency>
</dependencies>
</project>

View File

@ -22,23 +22,19 @@
<assembly>
<id>bin</id>
<formats>
<format>dir</format>
<format>zip</format>
</formats>
<includeBaseDirectory>true</includeBaseDirectory>
<moduleSets>
<moduleSet>
<!-- Forces the assembly module to be moved to the end of the build -->
<useAllReactorProjects>true</useAllReactorProjects>
<dependencySets>
<dependencySet>
<includes>
<include>org.apache.iotdb:iotdb-server</include>
<include>org.apache.iotdb:iotdb-client</include>
<include>*:zip:*</include>
</includes>
<binaries>
<outputDirectory>lib</outputDirectory>
<unpack>false</unpack>
</binaries>
</moduleSet>
</moduleSets>
<outputDirectory>/</outputDirectory>
<unpack>true</unpack>
</dependencySet>
</dependencySets>
<files>
<file>
<source>${maven.multiModuleProjectDirectory}/README.md</source>
@ -67,25 +63,5 @@
<directory>${maven.multiModuleProjectDirectory}/docs</directory>
<outputDirectory>docs</outputDirectory>
</fileSet>
<fileSet>
<directory>${maven.multiModuleProjectDirectory}/server/iotdb/conf</directory>
<outputDirectory>conf</outputDirectory>
</fileSet>
<fileSet>
<directory>${maven.multiModuleProjectDirectory}/server/iotdb/sbin</directory>
<outputDirectory>sbin</outputDirectory>
</fileSet>
<fileSet>
<directory>${maven.multiModuleProjectDirectory}/client/cli/sbin</directory>
<outputDirectory>sbin</outputDirectory>
</fileSet>
<fileSet>
<directory>${maven.multiModuleProjectDirectory}/server/iotdb/tools</directory>
<outputDirectory>tools</outputDirectory>
</fileSet>
<fileSet>
<directory>${maven.multiModuleProjectDirectory}/client/cli/tools</directory>
<outputDirectory>tools</outputDirectory>
</fileSet>
</fileSets>
</assembly>

View File

@ -39,33 +39,11 @@
<dependency>
<groupId>org.apache.iotdb</groupId>
<artifactId>iotdb-jdbc</artifactId>
<version>0.9.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.kafka</groupId>
<artifactId>kafka_2.10</artifactId>
<version>0.8.2.0</version>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</exclusion>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>8</source>
<target>8</target>
</configuration>
</plugin>
</plugins>
</build>
</project>

View File

@ -30,17 +30,54 @@
<packaging>pom</packaging>
<artifactId>iotdb-examples</artifactId>
<name>IoTDB Examples</name>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.apache.iotdb</groupId>
<artifactId>iotdb-jdbc</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
</dependencyManagement>
<properties>
<zookeeper.version>3.4.6</zookeeper.version>
</properties>
<modules>
<module>kafka</module>
<module>rocketmq</module>
</modules>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>8</source>
<target>8</target>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.apache.kafka</groupId>
<artifactId>kafka_2.10</artifactId>
<version>0.8.2.0</version>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</exclusion>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.rocketmq</groupId>
<artifactId>rocketmq-client</artifactId>
<version>4.4.0</version>
</dependency>
<dependency>
<groupId>org.apache.zookeeper</groupId>
<artifactId>zookeeper</artifactId>
<version>${zookeeper.version}</version>
</dependency>
</dependencies>
</dependencyManagement>
</project>

View File

@ -34,23 +34,11 @@
<dependency>
<groupId>org.apache.iotdb</groupId>
<artifactId>iotdb-jdbc</artifactId>
<version>0.9.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.rocketmq</groupId>
<artifactId>rocketmq-client</artifactId>
<version>4.4.0</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>8</source>
<target>8</target>
</configuration>
</plugin>
</plugins>
</build>
</project>

View File

@ -61,7 +61,7 @@
<dependency>
<groupId>org.apache.iotdb</groupId>
<artifactId>iotdb-jdbc</artifactId>
<version>${project.version}</version>
<version>0.9.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>

View File

@ -36,15 +36,11 @@
<dependency>
<groupId>org.apache.iotdb</groupId>
<artifactId>tsfile</artifactId>
<version>${project.version}</version>
<version>0.9.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-client</artifactId>
<version>${hadoop.version}</version>
</dependency>
</dependencies>
<build>
<plugins/>
</build>
</project>

View File

@ -39,12 +39,12 @@
<dependency>
<groupId>org.apache.iotdb</groupId>
<artifactId>tsfile</artifactId>
<version>${project.version}</version>
<version>0.9.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.iotdb</groupId>
<artifactId>service-rpc</artifactId>
<version>${project.version}</version>
<version>0.9.0-SNAPSHOT</version>
</dependency>
</dependencies>
<build>
@ -96,17 +96,6 @@
<skipITs>${jdbc.it.skip}</skipITs>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.rat</groupId>
<artifactId>apache-rat-plugin</artifactId>
<configuration>
<excludes>
<exclude>example/data/kafka_data.csv</exclude>
<exclude>**/*.iml</exclude>
<exclude>**/*.log</exclude>
</excludes>
</configuration>
</plugin>
</plugins>
</build>
<profiles>

386
pom.xml
View File

@ -60,6 +60,15 @@
<commons.collections4>4.0</commons.collections4>
<thrift.version>0.9.3</thrift.version>
<airline.version>0.8</airline.version>
<jackson.version>2.8.8</jackson.version>
<antlr3.version>3.5.2</antlr3.version>
<common.cli.version>1.3.1</common.cli.version>
<common.codec.version>1.13</common.codec.version>
<common.collections.version>3.2.2</common.collections.version>
<common.lang.version>2.6</common.lang.version>
<common.lang3.version>3.8.1</common.lang3.version>
<common.logging.version>1.1.3</common.logging.version>
<jline.version>2.14.5</jline.version>
<!-- URL of the ASF SonarQube server -->
<sonar.host.url>https://builds.apache.org/analysis</sonar.host.url>
<!-- Exclude all generated code -->
@ -81,6 +90,259 @@
<artifactId>logback-classic</artifactId>
<version>${logback.version}</version>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>1.2.31</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<version>${jackson.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>${jackson.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>${jackson.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.module</groupId>
<artifactId>jackson-module-paranamer</artifactId>
<version>${jackson.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.module</groupId>
<artifactId>jackson-module-scala_2.11</artifactId>
<version>${jackson.version}</version>
</dependency>
<dependency>
<groupId>com.google.code.findbugs</groupId>
<artifactId>jsr305</artifactId>
<version>3.0.2</version>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>21.0</version>
</dependency>
<dependency>
<groupId>com.sun.istack</groupId>
<artifactId>istack-commons-runtime</artifactId>
<version>3.0.8</version>
</dependency>
<dependency>
<groupId>com.sun.xml.fastinfoset</groupId>
<artifactId>FastInfoset</artifactId>
<version>1.2.16</version>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>${common.lang.version}</version>
</dependency>
<dependency>
<groupId>commons-cli</groupId>
<artifactId>commons-cli</artifactId>
<version>${common.cli.version}</version>
</dependency>
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>${common.codec.version}</version>
</dependency>
<dependency>
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>
<version>${common.collections.version}</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>${common.io.version}</version>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>${common.logging.version}</version>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty</artifactId>
<version>3.9.9.Final</version>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-all</artifactId>
<version>4.1.17.Final</version>
</dependency>
<dependency>
<groupId>javax.annotation</groupId>
<artifactId>javax.annotation-api</artifactId>
<version>1.3.2</version>
</dependency>
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.4.0-b180725.0427</version>
</dependency>
<dependency>
<groupId>jline</groupId>
<artifactId>jline</artifactId>
<version>${jline.version}</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.version}</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
</dependency>
<dependency>
<groupId>me.tongfei</groupId>
<artifactId>progressbar</artifactId>
<version>0.7.3</version>
<exclusions>
<!-- This transitive dependency duplicates classes from jline:jline:jar:2.14.5:compile -->
<exclusion>
<groupId>org.fusesource.jansi</groupId>
<artifactId>jansi</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.antlr</groupId>
<artifactId>antlr-runtime</artifactId>
<version>${antlr3.version}</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-collections4</artifactId>
<version>${commons.collections4}</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>${common.lang3.version}</version>
</dependency>
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-client</artifactId>
<version>${hadoop.version}</version>
</dependency>
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-core_2.11</artifactId>
<version>${spark.version}</version>
</dependency>
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-sql_2.11</artifactId>
<version>${spark.version}</version>
</dependency>
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-core-asl</artifactId>
<version>1.9.13</version>
</dependency>
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-mapper-asl</artifactId>
<version>1.9.13</version>
</dependency>
<dependency>
<groupId>org.glassfish.jaxb</groupId>
<artifactId>jaxb-runtime</artifactId>
<version>2.4.0-b180725.0644</version>
<exclusions>
<exclusion>
<groupId>jakarta.activation</groupId>
<artifactId>jakarta.activation-api</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.javassist</groupId>
<artifactId>javassist</artifactId>
<version>3.24.0-GA</version>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<version>1.10.19</version>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>2.23.0</version>
</dependency>
<dependency>
<groupId>org.objenesis</groupId>
<artifactId>objenesis</artifactId>
<version>3.0.1</version>
</dependency>
<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-core</artifactId>
<version>2.0.2</version>
</dependency>
<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-api-mockito2</artifactId>
<version>2.0.2</version>
</dependency>
<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-module-junit4</artifactId>
<version>2.0.2</version>
</dependency>
<dependency>
<groupId>org.scala-lang</groupId>
<artifactId>scala-library</artifactId>
<version>${scala.version}</version>
</dependency>
<dependency>
<groupId>org.scala-lang</groupId>
<artifactId>scala-reflect</artifactId>
<version>${scala.version}</version>
</dependency>
<dependency>
<groupId>org.scalatest</groupId>
<artifactId>scalatest_2.11</artifactId>
<version>3.0.5</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jcl-over-slf4j</artifactId>
<version>1.7.25</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jul-to-slf4j</artifactId>
<version>1.7.25</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.25</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.7.25</version>
</dependency>
<dependency>
<groupId>org.xerial.snappy</groupId>
<artifactId>snappy-java</artifactId>
<version>1.0.5-M1</version>
</dependency>
<dependency>
<groupId>org.apache.thrift</groupId>
<artifactId>libthrift</artifactId>
@ -107,31 +369,13 @@
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<version>1.10.19</version>
<scope>test</scope>
</dependency>
<!-- for jdk-11 -->
<dependency>
<groupId>javax.annotation</groupId>
<artifactId>javax.annotation-api</artifactId>
<version>1.3.2</version>
</dependency>
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.4.0-b180725.0427</version>
</dependency>
<dependency>
<groupId>org.glassfish.jaxb</groupId>
<artifactId>jaxb-runtime</artifactId>
<version>2.4.0-b180725.0644</version>
</dependency>
</dependencies>
<modules>
<module>tsfile</module>
@ -202,6 +446,8 @@
<exclude>**/*.iml</exclude>
<!-- Runtime log -->
<exclude>**/*.log</exclude>
<!-- Exclude CVS files -->
<exclude>**/*.cvs</exclude>
<!-- licenses -->
<exclude>licenses/*</exclude>
<!-- generated by Github -->
@ -210,14 +456,8 @@
<exclude>.checkstyle</exclude>
<!--Generated by Apache Release -->
<exclude>local-snapshots-dir/**</exclude>
<!--IoTDB data files-->
<exclude>iotdb/data/**</exclude>
<exclude>iotdb/logs/**</exclude>
<exclude>src/test/resources/*.json</exclude>
<!-- for tsfile module -->
<!-- if `mvn clean` is not executed and `mvn test` is interrupted, then perTestInputData may be not deleted -->
<exclude>src/test/resources/perTestInputData</exclude>
<exclude>src/test/resources/*.json</exclude>
<!-- JSON can't contain comments and therefore no Apache header -->
<exclude>*.json</exclude>
<exclude>NOTICE-binary</exclude>
<exclude>LICENSE-binary</exclude>
</excludes>
@ -234,9 +474,44 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>3.0.0-M1</version>
<version>3.0.0-M2</version>
<!--$NO-MVN-MAN-VER$-->
<executions>
<!-- Ensure we're not mixing dependency versions -->
<execution>
<id>enforce-version-convergence</id>
<configuration>
<rules>
<dependencyConvergence/>
</rules>
</configuration>
<goals>
<goal>enforce</goal>
</goals>
</execution>
<!--
Fails the build if classes are included from multiple
artifacts and these are not identical.
-->
<!--execution>
<id>enforce-ban-duplicate-classes</id>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<rules>
<banDuplicateClasses>
<scopes>
<scope>compile</scope>
<scope>provided</scope>
</scopes>
<findAllDuplicates>true</findAllDuplicates>
<ignoreWhenIdentical>true</ignoreWhenIdentical>
</banDuplicateClasses>
</rules>
<fail>true</fail>
</configuration>
</execution-->
<!-- Make sure no dependencies are used for which known vulnerabilities exist. -->
<execution>
<id>vulnerability-checks</id>
@ -264,6 +539,11 @@
<artifactId>ossindex-maven-enforcer-rules</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>org.codehaus.mojo</groupId>
<artifactId>extra-enforcer-rules</artifactId>
<version>1.2</version>
</dependency>
</dependencies>
</plugin>
<!--
@ -504,6 +784,58 @@
<thrift.exec-cmd.args>+x ${project.build.directory}/tools/${thrift.executable}</thrift.exec-cmd.args>
</properties>
</profile>
<!-- Some APIs were removed in Java 11, so we need to add replacements -->
<profile>
<id>java-11-and-above</id>
<activation>
<!-- This needs to be updated as soon as Java 20 is shipped -->
<jdk>[11,20)</jdk>
</activation>
<dependencies>
<!-- for jdk-11 -->
<dependency>
<groupId>javax.annotation</groupId>
<artifactId>javax.annotation-api</artifactId>
</dependency>
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
</dependency>
<dependency>
<groupId>org.glassfish.jaxb</groupId>
<artifactId>jaxb-runtime</artifactId>
</dependency>
</dependencies>
<!--build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>3.0.0-M2</version>
<executions>
<execution>
<id>enforce-ban-duplicate-classes</id>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<rules combine.children="append">
<banDuplicateClasses>
<ignoreClasses>
<ignoreClass>javax.activation.*</ignoreClass>
<ignoreClass>javax.servlet.*</ignoreClass>
<ignoreClass>javax.ws.*</ignoreClass>
</ignoreClasses>
</banDuplicateClasses>
</rules>
<fail>true</fail>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build-->
</profile>
<!--
Self activating profile, that activates itself as soon as a "src/main/thrift" directory is found.
The different plugins here download the thrift executable matching the current os, make that

View File

@ -30,8 +30,6 @@
<artifactId>iotdb-server</artifactId>
<name>IoTDB Server</name>
<properties>
<antlr3.version>3.5.2</antlr3.version>
<common.lang3.version>3.8.1</common.lang3.version>
<iotdb.test.skip>false</iotdb.test.skip>
<iotdb.it.skip>${iotdb.test.skip}</iotdb.it.skip>
<iotdb.ut.skip>${iotdb.test.skip}</iotdb.ut.skip>
@ -40,35 +38,32 @@
<dependency>
<groupId>org.apache.iotdb</groupId>
<artifactId>service-rpc</artifactId>
<version>${project.version}</version>
<version>0.9.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.iotdb</groupId>
<artifactId>tsfile</artifactId>
<version>${project.version}</version>
<version>0.9.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.iotdb</groupId>
<artifactId>iotdb-jdbc</artifactId>
<version>${project.version}</version>
<version>0.9.0-SNAPSHOT</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-collections4</artifactId>
<version>${commons.collections4}</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.antlr/antlr-runtime -->
<dependency>
<groupId>org.antlr</groupId>
<artifactId>antlr-runtime</artifactId>
<version>${antlr3.version}</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.commons/commons-lang3 -->
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>${common.lang3.version}</version>
</dependency>
<dependency>
<groupId>io.airlift</groupId>
@ -78,52 +73,21 @@
<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-core</artifactId>
<version>2.0.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-module-junit4</artifactId>
<version>2.0.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-api-mockito2</artifactId>
<version>2.0.2</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<configuration>
<filesets>
<fileset>
<directory>${project.basedir}/iotdb/lib</directory>
<includes>
<include>**/*.jar</include>
</includes>
<followSymlinks>false</followSymlinks>
</fileset>
<fileset>
<directory>${project.basedir}/data</directory>
<includes>
<include>**/*</include>
</includes>
<followSymlinks>false</followSymlinks>
</fileset>
<fileset>
<directory>${project.basedir}/logs</directory>
<includes>
<include>**/*</include>
</includes>
<followSymlinks>false</followSymlinks>
</fileset>
</filesets>
</configuration>
</plugin>
<plugin>
<groupId>org.antlr</groupId>
<artifactId>antlr3-maven-plugin</artifactId>
@ -136,29 +100,6 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${project.basedir}/iotdb/lib</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<outputDirectory>${project.basedir}/iotdb/lib</outputDirectory>
</configuration>
</plugin>
<!--using `mvn test` to run UT, `mvn verify` to run ITs
Reference: https://antoniogoncalves.org/2012/12/13/lets-turn-integration-tests-with-maven-to-a-first-class-citizen/-->
<plugin>
@ -186,6 +127,26 @@
<skipITs>${iotdb.it.skip}</skipITs>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<executions>
<!-- Package binaries-->
<execution>
<id>server-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<descriptors>
<descriptor>src/assembly/server.xml</descriptor>
</descriptors>
<appendAssemblyId>false</appendAssemblyId>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<profiles>

View File

@ -0,0 +1,40 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
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.
-->
<assembly>
<id>server</id>
<formats>
<format>dir</format>
<format>zip</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<dependencySets>
<dependencySet>
<outputDirectory>lib</outputDirectory>
</dependencySet>
</dependencySets>
<fileSets>
<fileSet>
<directory>src/assembly/resources</directory>
<outputDirectory>/</outputDirectory>
</fileSet>
</fileSets>
</assembly>

View File

@ -20,10 +20,7 @@ package org.apache.iotdb.db.script;
import static org.junit.Assert.assertEquals;
import java.io.BufferedReader;
import java.io.File;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.*;
import java.util.ArrayList;
import java.util.List;
import org.junit.After;
@ -51,19 +48,19 @@ public class EnvScriptIT {
}
private void testStartClientOnWindows(String suffix, String os) throws IOException {
String dir = getCurrentPath("cmd.exe", "/c", "echo %cd%");
String dir = getServerPath();
final String output = "If you want to change this configuration, please check conf/iotdb-env.sh(Unix or OS X, if you use Windows, check conf/iotdb-env.bat).";
String cmd =
dir + File.separator + "iotdb" + File.separator + "conf" + File.separator + "iotdb-env"
dir + File.separator + "conf" + File.separator + "iotdb-env"
+ suffix;
ProcessBuilder startBuilder = new ProcessBuilder("cmd.exe", "/c", cmd);
testOutput(dir, suffix, startBuilder, output, os);
}
private void testStartClientOnUnix(String suffix, String os) throws IOException {
String dir = getCurrentPath("pwd");
String dir = getServerPath();
final String output = "If you want to change this configuration, please check conf/iotdb-env.sh(Unix or OS X, if you use Windows, check conf/iotdb-env.bat).";
String cmd = dir + File.separator + "iotdb" + File.separator + "conf" + File.separator + "iotdb-env"
String cmd = dir + File.separator + "conf" + File.separator + "iotdb-env"
+ suffix;
ProcessBuilder builder = new ProcessBuilder("bash", cmd);
testOutput(cmd, suffix, builder, output, os);
@ -101,4 +98,25 @@ public class EnvScriptIT {
String path = r.readLine();
return path;
}
protected String getServerPath() {
// This is usually always set by the JVM
File userDir = new File(System.getProperty("user.dir"));
if(!userDir.exists()) {
throw new RuntimeException("user.dir " + userDir.getAbsolutePath() + " doesn't exist.");
}
File targetDir = new File(userDir, "target");
File[] files = targetDir.listFiles(new FileFilter() {
@Override
public boolean accept(File pathname) {
return pathname.isDirectory() && pathname.getName().startsWith("iotdb-server-");
}
});
if(files.length != 1) {
throw new RuntimeException(
"Exactly one directory starting with 'iotdb-server-' should have been found, but was " + files.length);
}
return files[0].getAbsolutePath();
}
}

View File

@ -29,38 +29,34 @@
</parent>
<artifactId>spark-tsfile</artifactId>
<packaging>jar</packaging>
<name>IoTDB Spark-TsFile</name>
<dependencies>
<dependency>
<groupId>org.apache.iotdb</groupId>
<artifactId>tsfile</artifactId>
<version>${project.version}</version>
<version>0.9.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-client</artifactId>
<version>${hadoop.version}</version>
</dependency>
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-core_2.11</artifactId>
<version>${spark.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-sql_2.11</artifactId>
<version>${spark.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.scala-lang</groupId>
<artifactId>scala-library</artifactId>
<version>${scala.version}</version>
</dependency>
<dependency>
<groupId>org.scalatest</groupId>
<artifactId>scalatest_2.11</artifactId>
<version>3.0.5</version>
<scope>test</scope>
</dependency>
</dependencies>
@ -91,4 +87,28 @@
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>java-11-and-above</id>
<activation>
<!-- This needs to be updated as soon as Java 20 is shipped -->
<jdk>[11,20)</jdk>
</activation>
<build>
<plugins>
<plugin>
<groupId>net.alchim31.maven</groupId>
<artifactId>scala-maven-plugin</artifactId>
<version>3.2.0</version>
<!-- Added to avoid problems with Java 11 and above -->
<configuration>
<args>
<arg>-nobootcp</arg>
</args>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>

View File

@ -30,7 +30,7 @@ import org.junit.Test;
public class HDFSInputTest {
private String folder = "../spark/src/test/resources/HDFSInputTest";
private String folder = "target/test-output/HDFSInputTest";
private String path = folder + "/test.tsfile";
private HDFSInput in;

View File

@ -44,17 +44,14 @@
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>1.2.31</version>
</dependency>
<dependency>
<groupId>org.xerial.snappy</groupId>
<artifactId>snappy-java</artifactId>
<version>1.0.5-M1</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>${common.io.version}</version>
</dependency>
</dependencies>
<build>