Skip to content
Permalink
Browse files
[IOTDB-1797][IOTDB-1799] Compatibility of Apache IoTDB with InfluxDB …
…- Intergration Framework (#4081)

Co-authored-by: Steve Yurong Su <rong@apache.org>
  • Loading branch information
jun0315 and SteveYurongSu committed Oct 8, 2021
1 parent bb8c7fa commit 726f25969e971bad773604bb1deb6957f8e48810
Show file tree
Hide file tree
Showing 12 changed files with 951 additions and 18 deletions.
@@ -0,0 +1,64 @@
# Licensed 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.

name: InfluxDB Protocol Test

on:
push:
branches:
- master
- 'rel/*'
paths-ignore:
- 'docs/**'
pull_request:
branches:
- master
- 'rel/*'
paths-ignore:
- 'docs/**'
# allow manually run the action:
workflow_dispatch:

env:
MAVEN_OPTS: -Dhttp.keepAlive=false -Dmaven.wagon.http.pool=false -Dmaven.wagon.http.retryHandler.class=standard -Dmaven.wagon.http.retryHandler.count=3

jobs:
ubuntu:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: 11

- name: Cache Maven packages
uses: actions/cache@v2
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2-

- name: Build Distribution Zip
run: ./mvnw.sh -B -DskipTests clean install

- name: Build Docker Image
run: |
docker build . -f docker/src/main/Dockerfile-single -t "iotdb:$GITHUB_SHA"
docker images
- name: IT Test
shell: bash
run: |
cd influxdb-protocol && mvn -B clean compile post-integration-test -Dtest.port.closed=true
@@ -52,4 +52,5 @@ jobs:
- name: IT/UT Test
shell: bash
# we do not compile client-cpp for saving time, it is tested in client.yml
run: mvn -B clean post-integration-test -Dtest.port.closed=true -P '!testcontainer'
# we can skip influxdb-protocol because it has been tested separately in influxdb-protocol.yml
run: mvn -B clean post-integration-test -Dtest.port.closed=true -P '!testcontainer,!influxdb-protocol'
@@ -29,18 +29,18 @@ jobs:
fail-fast: false
max-parallel: 20
matrix:
java: [8, 11, 17]
# to reduce the CI time cost; we split the whole CI to 3 parts:
# modules except the server and the cluster:
# -Diotdb.skip.test=true -Dcluster.skip.test=true
# the server module:
# -pl server -am -DskipTests=true -Diotdb.test.only=true
# the cluster module:
# -pl cluster -am -DskipTests=true -Dcluster.test.only=true
# but we just add labels here to make the action name more graceful
it_task: ['others',
'server',
'cluster'
java: [ 8, 11, 17 ]
# to reduce the CI time cost; we split the whole CI to 3 parts:
# modules except the server and the cluster:
# -Diotdb.skip.test=true -Dcluster.skip.test=true
# the server module:
# -pl server -am -DskipTests=true -Diotdb.test.only=true
# the cluster module:
# -pl cluster -am -DskipTests=true -Dcluster.test.only=true
# but we just add labels here to make the action name more graceful
it_task: [ 'others',
'server',
'cluster'
]
runs-on: windows-latest

@@ -100,13 +100,14 @@ jobs:
- name: Test Server Module with Maven
shell: bash
if: ${{ matrix.it_task == 'server'}}
run: source ~/.bash_profile && mvn -B clean integration-test -Dtest.port.closed=true -pl server -am -DskipTests=true -Diotdb.test.only=true
run: source ~/.bash_profile && mvn -B clean integration-test -Dtest.port.closed=true -pl server -am -DskipTests=true -Diotdb.test.only=true
- name: Test Cluster Module with Maven
shell: bash
if: ${{ matrix.it_task == 'cluster'}}
run: source ~/.bash_profile && mvn -B clean integration-test -Dtest.port.closed=true -pl cluster -am -DskipTests=true -Dcluster.test.only=true
run: source ~/.bash_profile && mvn -B clean integration-test -Dtest.port.closed=true -pl cluster -am -DskipTests=true -Dcluster.test.only=true
- name: Test Other Modules with Maven
shell: bash
if: ${{ matrix.it_task == 'others'}}
run: source ~/.bash_profile && mvn -B clean integration-test -Dtest.port.closed=true -Diotdb.test.skip=true -Dcluster.test.skip=true
# we can skip influxdb-protocol because it has been tested separately in influxdb-protocol.yml
run: source ~/.bash_profile && mvn -B clean integration-test -Dtest.port.closed=true -Diotdb.test.skip=true -Dcluster.test.skip=true -P '!influxdb-protocol'

@@ -49,7 +49,7 @@ jobs:
restore-keys: ${{ runner.os }}-m2-
- name: IT/UT Test
# we do not compile client-cpp for saving time, it is tested in client.yml
run: mvn -B clean compile post-integration-test -Dtest.port.closed=true -Pcode-coverage -P '!testcontainer'
run: mvn -B clean compile post-integration-test -Dtest.port.closed=true -Pcode-coverage -P '!testcontainer,!influxdb-protocol'
- name: Code Coverage (Coveralls)
if: ${{ success() && (github.event_name == 'pull_request_target' || github.event_name == 'push')}}
run: |
@@ -0,0 +1,35 @@
<!--
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.
-->

# 切换方案

假如您原先接入 InfluxDB 的业务代码如下:

```java
InfluxDB influxDB = InfluxDBFactory.connect(openurl, username, password);
```

您只需要将 InfluxDBFactory 替换为 **IoTDBInfluxDBFactory** 即可实现业务向 IoTDB 的切换:

```java
InfluxDB influxDB = IoTDBInfluxDBFactory.connect(openurl, username, password);
```

@@ -0,0 +1,135 @@
<?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.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.apache.iotdb</groupId>
<artifactId>iotdb-parent</artifactId>
<version>0.13.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>influxdb-protocol</artifactId>
<name>InfluxDB Protocol</name>
<description>compatible with the protocol of influxdb.</description>
<properties>
<influxdb.test.skip>false</influxdb.test.skip>
<influxdb.it.skip>${influxdb.test.skip}</influxdb.it.skip>
<influxdb.ut.skip>${influxdb.test.skip}</influxdb.ut.skip>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>org.apache.iotdb</groupId>
<artifactId>iotdb-session</artifactId>
<version>0.13.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.iotdb</groupId>
<artifactId>iotdb-thrift</artifactId>
<version>0.13.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.influxdb</groupId>
<artifactId>influxdb-java</artifactId>
<version>2.21</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.version}</version>
</dependency>
<dependency>
<groupId>org.antlr</groupId>
<artifactId>antlr4-runtime</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<skipTests>${influxdb.ut.skip}</skipTests>
<systemProperties>
<IOTDB_CONF>src/test/resources</IOTDB_CONF>
</systemProperties>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<executions>
<execution>
<id>run-integration-tests</id>
<phase>integration-test</phase>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
<configuration>
<skipTests>${influxdb.test.skip}</skipTests>
<skipITs>${influxdb.it.skip}</skipITs>
</configuration>
</plugin>
<plugin>
<groupId>org.antlr</groupId>
<artifactId>antlr4-maven-plugin</artifactId>
<version>${antlr4.version}</version>
<executions>
<execution>
<configuration>
<listener>false</listener>
<visitor>true</visitor>
</configuration>
<goals>
<goal>antlr4</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>3.2.0</version>
<executions>
<execution>
<id>add-source</id>
<phase>generate-sources</phase>
<goals>
<goal>add-source</goal>
</goals>
<configuration>
<sources>
<source>${project.build.directory}/generated-sources/antlr4</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

0 comments on commit 726f259

Please sign in to comment.